poplar.utilities
¶
Module Contents¶
Functions¶
|
One-dimensional linear interpolation for monotonically increasing sample |
|
Computes detection probabilities from optimal snr values with respect to a detection threshold using the survival function of |
|
Computes the selection function (i.e. the mean detection probability) from a set of optimal snr values with respect to a detection threshold using the survival function of |
- poplar.utilities.interpolate(x: torch.Tensor, xp: torch.Tensor, fp: torch.Tensor) torch.Tensor ¶
One-dimensional linear interpolation for monotonically increasing sample points.
Returns the one-dimensional piecewise linear interpolant to a function with given discrete data points \((xp, fp)\), evaluated at \(x\).
From https://github.com/pytorch/pytorch/issues/50334#issuecomment-1247611276.
- Parameters:
- xtorch.Tensor
the \(x\)-coordinates at which to evaluate the interpolated values.
- xptorch.Tensor
the \(x\)-coordinates of the data points, must be increasing.
- fptorch.Tensor
the \(y\)-coordinates of the data points, same length as xp.
- Returns:
- torch.Tensor
the interpolated values, same size as x
- poplar.utilities.detection_probabilty_from_optimal_snr(optimal_snr: Union(np.ndarray, torch.tensor, float), threshold: float, number_of_detectors=1)¶
Computes detection probabilities from optimal snr values with respect to a detection threshold using the survival function of a non-central chi-square distribution.
This function is not GPU-compatible and will therefore force synchronisation and movement of data between CPU and GPU. The outputs will be on the same device as the inputs.
- Parameters:
- optimal_snrnp.ndarray or torch.tensor
Optimal snr values to convert into detection probabilities.
- thresholdfloat
The detection threshold.
- number_of_detectorsint, optional
The number of detectors in use, by default 1
- Returns:
- detection_probabilities: np.ndarray or torch.tensor
The resuling detection probablities for the given detection threshold.
- poplar.utilities.selection_function_from_optimal_snr(optimal_snr: Union(np.ndarray, torch.tensor), threshold: float, number_of_detectors=1)¶
Computes the selection function (i.e. the mean detection probability) from a set of optimal snr values with respect to a detection threshold using the survival function of a non-central chi-square distribution.
This function is not GPU-compatible and will therefore force synchronisation and movement of data between CPU and GPU. The outputs will be on the same device as the inputs.
- Parameters:
- optimal_snrnp.ndarray or torch.tensor
Optimal snr values to convert into detection probabilities.
- thresholdfloat
The detection threshold.
- number_of_detectorsint, optional
The number of detectors in use, by default 1
- Returns:
- selection function: np.ndarray or torch.tensor
The resuling selection function for the given detection threshold.