Skip to content

SpatialPRF API Documentation

Spatial PRF

Bases: pandoraaperture.prf.PRF

Special case where the PRF is a function of focal plane position.

Special PRF class for making Pixel Response Functions that change as a function of focal plane position.

Parameters:

Name Type Description Default
focal_row

Row position on the focal plane that corresponds to each element in the flux array. Units of pixels.

required
focal_column

Column position on the focal plane that corresponds to each element in the flux array. Units of pixels.

required
flux

Array of the flux of the PRF as a function of position. Usually normalized such that the total flux is 1.

required
pixel_size

True detector pixel size in dimensions of length/pixel

required
sub_pixel_size

PSF file pixel size in dimensions of length/pixel

required
scale

How much to scale the PRF by. Scale of 2 makes the PSF 2x broader. Default is 1.

1
imshape

Tuple of the shape of the true image. If using ROIs, use the shape of the image that each ROI is cut out from. Use format (row, column).

(2048, 2048)
imcorner

Tuple of the lower left corner of the image, i.e. it's origin. Use this to move the image around on the grid. If using a window mode, make sure to set this to the right corner. Use format (row, column).

(0, 0)

evaluate(location=None, normalize=True, gradients=False)

Evaluate the PRF model for a target at a given location on the detector.

Parameters:

Name Type Description Default
location

Location of the source on the detector. Use format (row, column). If not set will default to self._default_location which is in the middle of the image as set by imshape and imcorner.

None
normalize

Whether to normalize the input data so that the total flux is 1.

True
gradients

Whether to return gradients. If True, will return an additional 2 arrays that contain the gradients in each axis.

False

Returns:

Name Type Description
row_im ndarray

1D Array of integer row values at which the PRF is evaluated.

column_im ndarray

1D Array of integer column values at which the PRF is evaluated.

prf_im ndarray

2D Array of PRF values.

dprf_im ndarray

2, 2D arrays of the gradient of the PRF values. Only returned if gradients=True.

from_file(file) classmethod

Load a PRF object from a file.

Parameters:

Name Type Description Default
file

Input file to use. Choose either a string path to the file or an astropy.fits.HDUList object

required

from_reference(name='visda') classmethod

Load a PRF from pandoraref.

Parameters:

Name Type Description Default
name str

Name of detector, choose from VISDA or NIRDA.

'visda'

plot(**kwargs)

Plots the PRF. Use this functon to visually inspect the PRF.

to_PRF(location=None)

Converts a spatial PRF into a PRF evaluated at a single location, making it faster to compute multiple PRFs, if necessary.

Parameters:

Name Type Description Default
location

Location of the source on the detector. Use format (row, column). If not set will default to self._default_location which is in the middle of the image as set by imshape and imcorner.

None

to_sparse3d(location=None, normalize=True, gradients=False)

Converts this PRF object to a Sparse3D object.

Parameters:

Name Type Description Default
location

Location of the source on the detector. Use format (row, column). If not set will default to self._default_location which is in the middle of the image as set by imshape and imcorner.

None
normalize

Whether to normalize the input data so that the total flux is 1.

True
gradients

Whether to return gradients. If True, will return an additional 2 arrays that contain the gradients in each axis.

False

Returns:

Name Type Description
X Sparse3D

Sparse3D object containing the PRF at a given location.

dX0 Sparse3D

Sparse3D object containing the gradient of the PRF in axis 0 at a given location. Only returned if gradients=True.

dX1 Sparse3D

Sparse3D object containing the gradient of the PRF in axis 1 at a given location. Only returned if gradients=True.