scopesim.effects.psf_utils module

scopesim.effects.psf_utils.cutout_kernel(image, fov_header, kernel_header=None)[source]
scopesim.effects.psf_utils.get_bkg_level(obj, bg_w)[source]

Determine the background level of image or cube slices.

Returns a scalar if obj is a 2d image or a vector if obj is a 3D cube (one value for each plane). The method for background determination is decided by self.meta[“bkg_width”]: If 0, the background is returned as zero (implying no background subtraction). If -1, the background is estimated as the median of the entire image (or cube plane). If positive, the background is estimated as the median of a frame of width bkg_width around the edges.

scopesim.effects.psf_utils.get_psf_wave_exts(hdu_list, wave_key='WAVE0')[source]

Return a dict of {extension : wavelength}.

Parameters:
hdu_list
Returns:
wave_set, wave_ext
scopesim.effects.psf_utils.get_strehl_cutout(fov_header, strehl_imagehdu)[source]
scopesim.effects.psf_utils.get_total_wfe_from_table(tbl)[source]
scopesim.effects.psf_utils.make_strehl_map_from_table(tbl, pixel_scale=<Quantity 1. arcsec>)[source]
scopesim.effects.psf_utils.nearest_index(x, x_array)[source]
scopesim.effects.psf_utils.nmrms_from_strehl_and_wavelength(strehl: float, wavelength, strehl_hdu, plot=False) float[source]

Return the wavefront error needed to make a PSF with desired strehl ratio.

Parameters:
strehlfloat

[0.001, 1] Desired strehl ratio. Values 1<sr<100 will be scale to <1

wavelengthfloat

[um]

strehl_hdunp.ndarray

2D map of strehl ratio as a function of wavelength [um] and residual wavefront error [nm RMS]

plotbool
Returns:
nmfloat

[nm] residual wavefront error for generating an on-axis AnisoCADO PSF with the desired strehl ratio at a given wavelength

scopesim.effects.psf_utils.rescale_kernel(image, scale_factor, spline_order)[source]
scopesim.effects.psf_utils.rotational_blur(image, angle)[source]

Rotate and coadd an image over a given angle to imitate a blur.

Parameters:
imagearray

Image to blur

anglefloat

[deg] Angle over which the image should be rotationally blurred

Returns:
image_rotarray

Blurred image

scopesim.effects.psf_utils.round_kernel_edges(kernel)[source]
scopesim.effects.psf_utils.sigma2gauss(sigma, x_size=15, y_size=15)[source]
scopesim.effects.psf_utils.strehl2sigma(strehl)[source]
scopesim.effects.psf_utils.wfe2gauss(wfe, wave, width=None)[source]
scopesim.effects.psf_utils.wfe2strehl(wfe, wave)[source]