Skip to content

DispersedPRF API Documentation

Dispersed PSF

Bases: pandoraaperture.prf.PRF

Special case where PRF is dispersed in a line

Special PRF class for making Pixel Response Functions that is dispersed across pixels.

Parameters:

Name Type Description Default
trace_row

Row position within the spectral trace that corresponds to each element in the flux array. Units of pixels.

required
trace_column

Column position within the spectral trace 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).

(400, 80)
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)

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, pixel_resolution=0.25) 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
pixel_resolution

The separation between different elements in the PRF model in pixels. For example 0.25 means there will be approximately 0.25 pixels between each element.

0.25

from_reference(name='nirda', pixel_resolution=0.25) classmethod

Load a PRF from pandoraref.

Parameters:

Name Type Description Default
name str

Name of detector, choose from VISDA or NIRDA.

'nirda'
pixel_resolution

The separation between different elements in the PRF model in pixels. For example 0.25 means there will be approximately 0.25 pixels between each element.

0.25

plot(**kwargs)

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

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

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.