regularizepsf.psf#
Representations of point spread functions.
Classes#
Model for a simple PSF. |
|
Model for a PSF that varies over the field of view. |
|
A PSF represented as a set of arrays. |
Functions#
|
Decorate a SimpleFunctionalPSF. |
|
|
|
Decorate to create a VariedFunctionalPSF. |
Module Contents#
- class regularizepsf.psf.SimpleFunctionalPSF(function: collections.abc.Callable)#
Model for a simple PSF.
Create a PSF object.
- Parameters:
function –
- Python function representing the PSF,
first two parameters must be x and y and must return an numpy array
- _f: collections.abc.Callable#
- _signature: inspect.Signature#
- _parameters: set[str]#
- __call__(row: numbers.Real | numpy.ndarray, col: numbers.Real | numpy.ndarray, **kwargs: dict[str, Any]) numbers.Real | numpy.ndarray #
Get the PSF value at (row, col).
- property parameters: set[str]#
Get the parameters of this PSF.
- as_array_psf(coordinates: list[tuple[int, int]], size: int, **kwargs) ArrayPSF #
Convert FunctionalPSF to an ArrayPSF.
- property f: collections.abc.Callable#
Retrieve the PSF functional form for calling.
- regularizepsf.psf.simple_functional_psf(arg: Any = None) SimpleFunctionalPSF #
Decorate a SimpleFunctionalPSF.
- class regularizepsf.psf.VariedFunctionalPSF(vary_function: collections.abc.Callable, base_psf: SimpleFunctionalPSF, validate_at_call: bool = True)#
Model for a PSF that varies over the field of view.
Create a VariedFunctionalPSF object.
- Parameters:
vary_function (Callable) – function used to vary the parameters of the base_psf
base_psf (Callable) – base form of the PSF
validate_at_call (bool) – whether to check if parameters are valid at each call, turning off may be faster but is risky
- _vary_function#
- _base_psf#
- validate_at_call = True#
- parameterization_signature#
- _origin_parameters: set[str]#
- __call__(row: numbers.Real | numpy.ndarray, col: numbers.Real | numpy.ndarray) numbers.Real | numpy.ndarray #
Get the PSF value at (row, col).
- property parameters: set[str]#
Get the parameters of this PSF.
- simplify(row: int, col: int) SimpleFunctionalPSF #
Simplify this VariedFunctionalPSF to a SimpleFunctionalPSF by evaluating at (row, col).
- regularizepsf.psf._varied_functional_psf(base_psf: SimpleFunctionalPSF) VariedFunctionalPSF #
- regularizepsf.psf.varied_functional_psf(base_psf: SimpleFunctionalPSF = None) VariedFunctionalPSF #
Decorate to create a VariedFunctionalPSF.
- class regularizepsf.psf.ArrayPSF(values_cube: regularizepsf.util.IndexedCube, fft_cube: regularizepsf.util.IndexedCube | None = None, workers: int | None = None)#
A PSF represented as a set of arrays.
Initialize an ArrayPSF model.
- Parameters:
values_cube (IndexedCube) – PSF model where keys are upper left coordinates of array patches in the image
fft_cube (IndexedCube) – fft of the model
workers (int | None) – Maximum number of workers to use for parallel computation of FFT. If negative, the value wraps around from os.cpu_count(). See scipy.fft.fft for more details. Only used if fft_cube is None.
- _values_cube#
- _fft_cube = None#
- _workers = None#
- property coordinates: list[tuple[int, int]]#
Get the keys of the PSF model, i.e., where it is evaluated as an array.
- property values: numpy.ndarray#
Get the model values.
- property fft_evaluations: numpy.ndarray#
Get the model values.
- __getitem__(coord: tuple[int, int]) numpy.ndarray #
Evaluate the PSF model at specific coordinates.
- fft_at(coord: tuple[int, int]) numpy.ndarray #
Retrieve the FFT evaluation at a coordinate.
- save(path: pathlib.Path) None #
Save the PSF model to a file. Supports h5 and FITS.
- Parameters:
path (pathlib.Path) – where to save the PSF model
- Return type:
None
- classmethod load(path: pathlib.Path) ArrayPSF #
Load the PSF model from a file. Supports h5 and FITS.
- Parameters:
path (pathlib.Path) – where to load the PSF model from
- Returns:
loaded model
- Return type:
- visualize_psfs(fig: matplotlib.figure.Figure | None = None, fig_scale: int = 1, all_patches: bool = False, imshow_args: dict | None = None) None #
Visualize the PSF model.
- visualize_ffts(fig: matplotlib.figure.Figure | None = None, fig_scale: int = 1, all_patches: bool = False, imshow_args: dict | None = None) None #
Visualize the fft of the PSF.
- property sample_shape: tuple[int, int]#
Get the sample shape for this PSF model.
- __len__() int #
Get the number of coordinates evaluated in this model.