get_slopes

mmtwfs.wfs.get_slopes(data, ref, pup_mask, fwhm=7.0, thresh=5.0, cen=[255, 255], cen_thresh=0.8, cen_sigma=10.0, cen_tol=50.0, spot_snr_thresh=3.0, plot=True)[source] [edit on github]

Analyze a WFS image and produce pixel offsets between reference and observed spot positions.

Parameters
datastr or 2D np.ndarray

FITS file or np.ndarray containing WFS observation

refTable

Table of reference apertures

pup_maskstr or 2D np.ndarray

FITS file or np.ndarray containing mask used to register WFS spot pattern via cross-correlation

fwhmfloat (default: 7.0)

FWHM of convolution kernel applied to image by the spot finding algorithm

threshfloat (default: 5.0)

Number of sigma above background for a spot to be considered detected

cenlist-like with 2 elements (default: [255, 255])

Expected position of the center of the WFS spot pattern in form [X_cen, Y_cen]

cen_threshfloat (default: 0.8)

Masking threshold as fraction of peak value used in find_peaks

cen_sigmafloat (default: 10.0)

Width of gaussian filter applied to image by center_pupil

cen_tolfloat (default: 50.0)

Tolerance for difference between expected and measureed pupil center

spot_snr_threshfloat (default: 3.0)

S/N tolerance for a WFS spot to be considered valid for analysis

plotbool

Toggle plotting of image with aperture overlays

Returns
resultsdict
Results of the wavefront slopes measurement packaged into a dict with the following keys:

slopes - mask np.ndarry containing the slope values in pixel units pup_coords - pupil coordinates for the position for each slope value spots - Table as returned by photutils star finder routines src_aps - CircularAperture for each detected spot spacing - list-like of form (xspacing, yspacing) containing the mean spacing between rows and columns of spots center - list-like of form (xcen, ycen) containing the center of the spot pattern ref_mask - np.ndarray of matched spots in reference image src_mask - np.ndarray of matched spots in the data image spot_sigma - sigma of a gaussian fit to a co-addition of detected spots figures - dict of figures that are optionally produced grid_fit - dict of best-fit parameters of grid fit used to do fine registration between source and reference spots