PSF Class
This class implements tools needed to work with the PSF. Below is an example of the Pandora PSF in pixel space. This class enables users to work with the PSF files and
- Evaluate it at any grid point (e.g. position, temperature, wavelength)
- Evaluate the PRF (i.e. the PSF integrated on a pixel grid)
- Find the gradient of the PSF or PRF
Class to work with abstract PSFs
PSF class for making PSFs, PRFs, and traces.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
ndarray
|
Array of 1D vectors defining the value of each dimension for every element of |
required |
psf_flux
|
ndarray
|
ND array of flux values |
required |
dimension_names
|
List
|
List of names for each of the N dimensions in |
required |
dimension_units
|
List
|
List of |
required |
pixel_size
|
Quantity
|
True detector pixel size in dimensions of length/pixel |
required |
sub_pixel_size
|
Quantity
|
PSF file pixel size in dimensions of length/pixel |
required |
transpose
|
bool
|
Whether to transpose the input data in the column/row axis. |
False
|
freeze_dictionary
|
Dict
|
Dictionary of dimensions to freeze |
{}
|
check_bounds
|
bool
|
Whether to check if the inputs are within the bounds of the PSF model and have the right units. This check causes a small slowdown. |
True
|
extrapolate
|
bool
|
Whether to allow the PSF to be evaluated outside of the bounds (i.e. will extrapolate) |
False
|
scale
|
int
|
How much to scale the PSF grid. Scale of 2 makes the PSF 2x broader. Default is 1. |
1
|
bin
|
int
|
('Optional amount to bin the input PSF file by. Binning the PSF file will result in faster computation, but less accurate modeling. Default is 1.',) |
1
|
trace_pixel
property
Pixels corresponding to self.trace_sensitivity
trace_sensitivity
property
The sensitivity of a spectrum trace at the self.trace_wavelength
and self.trace_pixel
positions.
trace_wavelength
property
Wavelengths corresponding to self.trace_sensitivity
freeze_dimension(**kwargs)
Drop a dimension of the PSF model. Dropped dimension must exist in self.dimension_names.
Examples:
Freeze a PSF object p
to have row of 10 pixels and wavelength of 1.3 microns
Returns:
Name | Type | Description |
---|---|---|
new |
PSF
|
New PSF object |
from_file(name, file='/home/runner/work/pandora-psf/pandora-psf/src/pandorapsf/data/pandora_vis_2024-05.fits', transpose=False, extrapolate=False, scale=1, bin=1)
classmethod
Build a PSF class from an input fits file.
Parameters:
file: str or fits.HDUList Filename of PSF fits file, or opened hdulist. PSF cube must have a shape such that the first two dimensions are the x and y extent of the PSF. Defaults to visible PSF. transpose: bool Transpose the input file, i.e. rotate 90 degrees
Returns:
psf : pandorapsf.PSF Returns a PSF object
from_name(name, transpose=False, scale=1, bin=1)
staticmethod
Open a PSF file based on the detector name. This will automatically freeze dimensions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of detector |
required |
transpose
|
bool
|
Whether to transpose the input data in the column/row axis. |
False
|
scale
|
int
|
How much to scale the PSF grid. Scale of 2 makes the PSF 2x broader. Default is 1. |
1
|
bin
|
int
|
('Optional amount to bin the input PSF file by. Binning the PSF file will result in faster computation, but less accurate modeling. Default is 1.',) |
1
|
integrate_spectrum(wavelength, spectrum, wavelength_grid=None)
Create an integrated spectrum, integrated over wavelength bounds.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wavelength
|
ndarray
|
Array of wavelength values. If no wavelength unit is present, assumed to be in microns. |
required |
spectrum
|
ndarray
|
Array of spectrum intensity values. Should have units of erg / (Angstrom s cm2). |
required |
wavelength_grid
|
ndarray
|
Optional wavelength grid at which to integrate. If no grid is provided, will default to the
|
None
|
integrate_wavelength(teff=5500, logg=4.5, **kwargs)
Inte
Parameters:
Name | Type | Description | Default |
---|---|---|---|
teff
|
Effective temperature of a star in K. |
5500
|
|
logg
|
Surface gravity of a star. log(g) |
4.5
|
prf(row, column, gradients=False, **kwargs)
Bins the PSF down to the pixel scale.
Returns:
Name | Type | Description |
---|---|---|
row_array |
NDArray
|
Array of integer row positions |
column_array |
NDArray
|
Array of integer column positions |
prf |
ndarray
|
2D array of PRF flux values with shape (nrows, ncolumns) |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row
|
Row position on the detector |
required | |
column
|
Column position on the detector |
required | |
gradients
|
Whether to return gradients. If True, will return an additional 2 arrays that contain the gradients in each axis. |
False
|
psf(gradients=False, **kwargs)
Interpolate the PSF cube to a particular point
Returns:
Name | Type | Description |
---|---|---|
ar |
np.ndarray of shape self.shape
|
The interpolated PSF |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gradients
|
Whether to return gradients. If True, will return an additional 2 arrays that contain the gradients in each axis. |
False
|