kai.strehl

Functions

calc_strehl(file_list, out_file[, apersize, instrument])

Calculate the Strehl, FWHM, and RMS WFE for each image in a

calc_strehl_single(img_file, radius, dl_peak_flux_ratio)

calc_peak_flux_ratio(img, coords, radius[, skysub])

img : 2D numpy array

fit_gaussian2d(img, coords, boxsize[, plot, fwhm_min, ...])

Calculate the FWHM of an objected located at the pixel

fwhm_to_stddev(fwhm)

stddev_to_fwhm(stddev)

Module Contents

kai.strehl.calc_strehl(file_list, out_file, apersize=0.3, instrument=instruments.default_inst)[source]

Calculate the Strehl, FWHM, and RMS WFE for each image in a list of files. The output is stored into the specified <out_file> text file. The FWHM (and Strehl) is calculated over the specified aperture size using a 2D gaussian fit. The Strehl is estimated by using the star specified in the *.coo (one for each *.fits file) file and taking the max pixel flux / wide-aperture flux and normalizing by the same on a diffraction-limited image. Note that the diffraction limited image comes from an external file.

The format of the *.coo file should be: xpix ypix # everything else

The diffraction limited images come with the pipeline. For Keck, they are all obtained empirically using the NIRC2 camera and filters and they are sampled at 0.009952 arcsec / pixel. We will resample them as necessary. We will play fast and loose with them and use them for both NIRC2 and OSIRIS. They will be resampled as needed.

kai.strehl.calc_strehl_single(img_file, radius, dl_peak_flux_ratio, instrument=instruments.default_inst)[source]
kai.strehl.calc_peak_flux_ratio(img, coords, radius, skysub=True)[source]
img2D numpy array

The image on which to calculate the flux ratio of the peak to a wide-aperture.

coordslist or numpy array, length = 2

The x and y position of the source.

radiusint

The radius, in pixels, of the wide-aperture.

kai.strehl.fit_gaussian2d(img, coords, boxsize, plot=False, fwhm_min=1.7, fwhm_max=30, pos_delta_max=1.7)[source]

Calculate the FWHM of an objected located at the pixel coordinates in the image. The FWHM will be estimated from a cutout with the specified boxsize.

Parameters:
imgndarray, 2D

The image where a star is located for calculating a FWHM.

coordslen=2 ndarray

The [x, y] pixel position of the star in the image.

boxsizeint

The size of the box (on the side), in pixels.

fwhm_minfloat, optional

The minimum allowed FWHM for constraining the fit (pixels).

fwhm_maxfloat, optional

The maximum allowed FWHM for constraining the fit (pixels).

pos_delta_maxfloat, optional

The maximum allowed positional offset for constraining the fit (pixels). This ensures that the fitter doesn’t wonder off to a bad pixel.

kai.strehl.fwhm_to_stddev(fwhm)[source]
kai.strehl.stddev_to_fwhm(stddev)[source]