WFS

class mmtwfs.wfs.WFS(config={}, plot=True, **kwargs)[source] [edit on github]

Bases: object

Defines configuration pattern and methods common to all WFS systems

Methods Summary

calculate_cc(zv)

Convert Zernike coma (Z07 and Z08) into arcsec of secondary center-of-curvature tilts.

calculate_focus(zv)

Convert Zernike defocus to um of secondary offset.

calculate_primary(zv[, threshold, mask])

Calculate force corrections to primary mirror and any required focus offsets.

calculate_recenter(fit_results[, defoc])

Perform zero-coma hexapod tilts to align the pupil center to the center-of-rotation.

clear_corrections()

Clear all applied WFS corrections

clear_m1_corrections()

Clear corrections applied to the primary mirror.

clear_m2_corrections()

Clear corrections sent to the secondary mirror, specifically the 'wfs' offsets.

connect()

Set state to connected

disconnect()

Set state to disconnected

fit_wavefront(slope_results[, plot])

Use results from self.measure_slopes() to fit a set of zernike polynomials to the wavefront shape.

get_fliplr([mode])

Determine if the WFS image needs to be flipped left/right

get_flipud([mode])

Determine if the WFS image needs to be flipped up/down

get_mode(hdr)

If mode is not specified, either set it to the default mode or figure out the mode from the header.

measure_slopes(fitsfile[, mode, plot, ...])

Take a WFS image in FITS format, perform background subtration, pupil centration, and then use get_slopes() to perform the aperture placement and spot centroiding.

process_image(fitsfile)

Process the image to make it suitable for accurate wavefront analysis.

pupil_mask([hdr])

Load and return the WFS spot mask used to locate and register the pupil

ref_pupil_location(mode[, hdr])

Get the center of the pupil on the reference image

ref_spot_fwhm()

Calculate the Airy FWHM in pixels of a perfect WFS spot from the optical prescription and detector pixel size

reference_aberrations(mode, **kwargs)

Create reference ZernikeVector for 'mode'.

seeing(mode, sigma[, airmass])

Given a sigma derived from a gaussian fit to a WFS spot, deconvolve the systematic width from the reference image and relate the remainder to r_0 and thus a seeing FWHM.

trim_overscan(data[, hdr])

Use the DATASEC in the header to determine the region to trim out.

Methods Documentation

calculate_cc(zv)[source] [edit on github]

Convert Zernike coma (Z07 and Z08) into arcsec of secondary center-of-curvature tilts.

calculate_focus(zv)[source] [edit on github]

Convert Zernike defocus to um of secondary offset.

calculate_primary(zv, threshold=<Quantity 0. nm>, mask=[])[source] [edit on github]

Calculate force corrections to primary mirror and any required focus offsets. Use threshold to determine which terms in ‘zv’ to use in the force calculations. Any terms with normalized amplitude less than threshold will not be used in the force calculation. In addition, individual terms can be forced to be masked.

calculate_recenter(fit_results, defoc=1.0)[source] [edit on github]

Perform zero-coma hexapod tilts to align the pupil center to the center-of-rotation. The location of the CoR is configured to be at self.cor_coords.

clear_corrections()[source] [edit on github]

Clear all applied WFS corrections

clear_m1_corrections()[source] [edit on github]

Clear corrections applied to the primary mirror. This includes the ‘m1spherical’ offsets sent to the secondary.

clear_m2_corrections()[source] [edit on github]

Clear corrections sent to the secondary mirror, specifically the ‘wfs’ offsets.

connect()[source] [edit on github]

Set state to connected

disconnect()[source] [edit on github]

Set state to disconnected

fit_wavefront(slope_results, plot=True)[source] [edit on github]

Use results from self.measure_slopes() to fit a set of zernike polynomials to the wavefront shape.

get_fliplr(mode=None)[source] [edit on github]

Determine if the WFS image needs to be flipped left/right

get_flipud(mode=None)[source] [edit on github]

Determine if the WFS image needs to be flipped up/down

get_mode(hdr)[source] [edit on github]

If mode is not specified, either set it to the default mode or figure out the mode from the header.

measure_slopes(fitsfile, mode=None, plot=True, flipud=False, fliplr=False)[source] [edit on github]

Take a WFS image in FITS format, perform background subtration, pupil centration, and then use get_slopes() to perform the aperture placement and spot centroiding.

process_image(fitsfile)[source] [edit on github]

Process the image to make it suitable for accurate wavefront analysis. Steps include nuking cosmic rays, subtracting background, handling overscan regions, etc.

pupil_mask(hdr=None)[source] [edit on github]

Load and return the WFS spot mask used to locate and register the pupil

ref_pupil_location(mode, hdr=None)[source] [edit on github]

Get the center of the pupil on the reference image

ref_spot_fwhm()[source] [edit on github]

Calculate the Airy FWHM in pixels of a perfect WFS spot from the optical prescription and detector pixel size

reference_aberrations(mode, **kwargs)[source] [edit on github]

Create reference ZernikeVector for ‘mode’.

seeing(mode, sigma, airmass=None)[source] [edit on github]

Given a sigma derived from a gaussian fit to a WFS spot, deconvolve the systematic width from the reference image and relate the remainder to r_0 and thus a seeing FWHM.

trim_overscan(data, hdr=None)[source] [edit on github]

Use the DATASEC in the header to determine the region to trim out. If no header provided or if the header doesn’t contain DATASEC, return data unchanged.