liger_iris_sim.utils.psf_utils
Functions
|
Crops a AO PSF parametrized by the telescope diameter and wavelength. |
|
Extend a PSF by fitting a power-law to its wings and padding the array. |
|
Get the PSF for a given instrument and mode. |
|
Get the PSF for a given instrument and mode. |
|
Shift the phase of a PSF image. |
- crop_AO_psf(psf: ndarray, scale: float, wave: float, colldiam: float, n: int = 100)[source]
Crops a AO PSF parametrized by the telescope diameter and wavelength.
In other words, the PSF is cropped to a size of
n * wavelength / colldiam, wherewavelength / colldiamis the diffraction limit of the telescope at the given wavelength.The PSF must have an odd number of rows and columns, and the center of the PSF is assumed to be at the center of the array.
- Parameters:
psf (np.ndarray) – The PSF to crop.
scale (float) – The size of a PSF pixel in arcsec.
wave (float) – The wavelength in microns.
colldiam (float) – The effective collimating diameter in meters.
n (int, optional) – The number of lambda / D’s to crop by. Defaults to 100.
- Returns:
psf_out (np.ndarray:) – The new PSF.
- extend_psf_powerlaw(psf: ndarray, rmin: float, extend_factor: float = 1.5, blend_width: float = 10.0, alpha_min: float = 2.0, eps: float = 1e-12) ndarray[source]
Extend a PSF by fitting a power-law to its wings and padding the array.
- Parameters:
psf (ndarray (ny, nx)) – Input PSF, assumed centred.
rmin (float) – Radius (px) at which the power-law fit begins and the blend is centred. Should be in the wing regime, beyond the AO-corrected core.
extend_factor (float) – Linear scale factor for the output array (must be > 1).
blend_width (float) – Full radial width (px) of the cosine blend transition centred on rmin. The PSF is used purely inside rmin-blend_width/2; the power law purely outside rmin+blend_width/2; a smooth cosine ramp joins them. Increase if the transition looks abrupt.
eps (float) – Small floor to avoid log(0).
- get_psf(instrument_name: str, instrument_mode: str | None = None, wave: float | None = None, xs: float | None = None, ys: float | None = None, xdet: float | None = None, ydet: float | None = None, output_plate_scale: float | None = None, recenter_to_odd_shape: bool = True, extend_powerlaw: bool | None = None) tuple[ndarray, dict][source]
Get the PSF for a given instrument and mode.
- Parameters:
instrument_name (str) – The name of the instrument (e.g. ‘Liger’, ‘Iris’).
instrument_mode (str, optional) – The instrument mode (e.g. ‘img’, ‘ifs’). Not used for Liger.
wave (float, optional) – The wavelength for which to retrieve the PSF.
xs (float, optional) – The spatial offset in arcseconds from the PSF center. Defaults to (0, 0).
ys (float, optional) – The spatial offset in arcseconds from the PSF center. Defaults to (0, 0).
xdet (float, optional) – The detector offset in pixels from the PSF center. Defaults to (0, 0).
ydet (float, optional) – The detector offset in pixels from the PSF center. Defaults to (0, 0).
output_plate_scale (float, optional) – If provided, the PSF will be resampled to this plate scale in arcsec/pixel.
recenter_to_odd_shape (bool, optional) – If True, the output PSF will be recentered to have an odd number of rows and columns. Default is True.
extend_powerlaw (bool | None, optional) – If True, the PSF will be extended with a power-law tail. If None, the PSF will be extended if the instrument is Liger in imaging mode. Default is None.
- get_psfs(instrument_name: str, instrument_mode: str | None = None, wave: float | None = None, xs: float | None = None, ys: float | None = None, xdet: float | None = None, ydet: float | None = None, output_plate_scale: float | None = None, recenter_to_odd_shape: bool = True, extend_powerlaw: bool | None = None) tuple[ndarray, dict][source]
Get the PSF for a given instrument and mode.
- Parameters:
instrument_name (str) – The name of the instrument (e.g. ‘Liger’, ‘Iris’).
instrument_mode (str, optional) – The instrument mode (e.g. ‘img’, ‘ifs’). Not used for Liger.
wave (float, optional) – The wavelength for which to retrieve the PSF.
xs (np.ndarray, optional) – The spatial offset in arcseconds from the PSF center. Defaults to (0, 0).
ys (np.ndarray, optional) – The spatial offset in arcseconds from the PSF center. Defaults to (0, 0).
xdet (np.ndarray, optional) – The detector offset in pixels from the PSF center. Defaults to (0, 0).
ydet (np.ndarray, optional) – The detector offset in pixels from the PSF center. Defaults to (0, 0).
output_plate_scale (float, optional) – If provided, the PSF will be resampled to this plate scale in arcsec/pixel.
recenter_to_odd_shape (bool, optional) – If True, the output PSF will be recentered to have an odd number of rows and columns. Default is True.
extend_powerlaw (bool | None, optional) – If True, the PSF will be extended with a power-law tail. If None, the PSF will be extended if the instrument is Liger in imaging mode. Default is None.
- shift_psf_phase(psf: ndarray, dx: float, dy: float) ndarray[source]
Shift the phase of a PSF image.