Module containing routines that operate on point spread function data
Class | S |
Undocumented |
Class | S1 |
Undocumented |
Function | apply |
At the moment doesn't actually apply an offset, just shifts the data so the point at offsets is now the center. |
Function | fit |
Fits a model to some data with some error on that data. |
Function | get |
Gets the location of the brightest pixel (not an offset from the center) |
Function | get |
Gets the location of the center of mass along axes (not an offset from the data center) |
Function | get |
Get a boolean map of outliers in a numpy array. Assumes a normal distribution. |
Function | get |
Find regions of interest in a numpy array by thresholding the array. |
Function | normalise |
Ensure an array of data fufils the following conditions: |
Function | objective |
Given a model function, some data, and the error on that data; returns an objective function that for either 'minimise'-ing or 'maximise'-ing the difference/similarity of the model and data. |
Function | remove |
Remove the offsets of data over the specified axes , ignore any `mask`ed pixels. |
Function | scipy |
Given some function that implements the same protocol as [scipy minimise](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize) returns a callable that accepts a PriorParamSet, a scipy-compatible objective function, a list of variable parameters, a list of constant parameters, and returns the fitted variable parameters. |
Function | trim |
Truncate a numpy array about it's center. |
Constant | P |
Undocumented |
Constant | Q |
Undocumented |
Type Variable |
|
Undocumented |
Type Variable | M |
Undocumented |
Type Variable | N |
Undocumented |
Type Variable | T |
Undocumented |
Type Variable |
|
Undocumented |
Variable | _lgr |
Undocumented |
At the moment doesn't actually apply an offset, just shifts the data so the point at offsets
is now the center.
# Arguments #
- data : np.ndarray
- Array to recentre
- axes : tuple[int,...]
- Axes to get centre of mass and recentre along.
- offsets : np.ndarray
- Offsets to apply to data, will shift data's grid by this amount.
PriorParamSet
, flattened_psf_model_callable: Callable[ P, np.ndarray[ S[ N], T]]
, psf_data: np.ndarray[ S[ N], T]
, psf_err: np.ndarray[ S[ N], T]
, fitting_function: Callable[ [ PriorParamSet, Callable[ Q, float]], Q]
, objective_function_factory: Callable[ [ Callable[ P, np.ndarray[ S[ N], T]], np.ndarray[ S[ N], T], np.ndarray[ S[ N], T]], Callable[ Q, float]]
= functools.partial(str | bool | None
= None) -> tuple[ np.ndarray[ S[ N], T], dict[ str, Any], dict[ str, Any]]
:
¶
Fits a model to some data with some error on that data.
np.ndarray
, axes: tuple[ int, ...]
, roi_mask: np.ndarray | None
= None) -> np.ndarray
:
¶
Gets the location of the brightest pixel (not an offset from the center)
## ARGUMENTS ##
- data : np.ndarray
- Array to recentre
- axes : tuple[int,...]
- Axes to get centre of mass and recentre along.
- roi_mask : np.ndarray | None = None
- Mask for the region of interest. If present will restrict calculations to this region.
np.ndarray
, axes: tuple[ int, ...]
, roi_mask: np.ndarray | None
= None) -> np.ndarray
:
¶
Gets the location of the center of mass along axes
(not an offset from the data
center)
## ARGUMENTS ##
- data : np.ndarray
- Array to recentre
- axes : tuple[int,...]
- Axes to get centre of mass and recentre along.
- roi_mask : np.ndarray | None = None
- Mask for the region of interest. If present will restrict calculations to this region.
Get a boolean map of outliers in a numpy array. Assumes a normal distribution.
# ARGUMENTS #
- data : np.ndarray
- Data to get outlier mask of.
- axes : tuple[int,...]
- Axes over which to get outlier mask
- n_sigma : float = 5
- Number of standard deviations away from the mean a member of
data
must be to be considered an outlier
np.ndarray
, axes: tuple[ int, ...]
, threshold: float
= 0.01, n_largest_regions: None | int
= 1) -> np.ndarray
:
¶
Find regions of interest in a numpy array by thresholding the array.
## ARGUMENTS ##
- data : np.ndarray
- Array to get region of interest of
- axes : tuple[int,...]
- Axes to get region of interest along.
- threshold : float = 1E-2
- When finding region of interest, only values larger than this fraction of the maximum value are included.
- n_largest_regions : None | int = 1
- When finding region of interest, if using a threshold will only use the n_largest_regions in the calculation.
A region is defined as a contiguous area where value >=
threshold
alongaxes
. I.e., in a 3D cube, if we recentre about the COM on the sky (CELESTIAL) axes the regions will be calculated on the sky, not in the spectral axis (for example).
np.ndarray
, axes: tuple[ int, ...] | None
= None, cutout_shape: tuple[ int, ...] | None
= None, recentre_around_centre_of_mass=False, remove_background=True) -> np.ndarray
:
¶
Ensure an array of data fufils the following conditions:
- odd shape, to ensure a centre pixel exists
- centre array on brightest pixel
- ensure array sums to 1
- cut out a region around the centre to remove unneeded data.
Given a model function, some data, and the error on that data; returns an objective function that for either 'minimise'-ing or 'maximise'-ing the difference/similarity of the model and data.
Given some function that implements the same protocol as [scipy minimise](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize) returns a callable that accepts a PriorParamSet, a scipy-compatible objective function, a list of variable parameters, a list of constant parameters, and returns the fitted variable parameters.
np.ndarray
, axes: tuple[ int, ...]
, output_shape: tuple[ int, ...]
) -> np.ndarray
:
¶
Truncate a numpy array about it's center.
# ARGUMENTS #
- data : np.ndarray
- Data to trim around centre pixel, will remove pixels that are greater than shape[i]/2 from the centre pixel.
- axes : tuple[int,...]
- Axes over which to operate
- output_shape : tuple[int,...]
- Desired shape of
axes
after trimming