WEP Developer Guide¶
Wavefront estimation pipeline (WEP) calculates the wavefront error in annular Zernike polynomials based on the intra- and extra-focal donut images.
Main Classes¶
Important classes:
WfEstimator
calculates the wavefront error in annular Zernike polynomials based on the defocal donut images.
Important Pipeline Tasks:
task.GenerateDonutCatalogWcsTask
creates a donut source catalog from available reference catalogs.task.CutOutDonutsScienceSensorTask
cuts out donuts stamps in image from LSSTFam or ComCam sensors when provided input exposures and source catalog.task.CutOutDonutsCwfsTask
cuts out donuts stamps in image from LSSTCam corner wavefront sensors when provided input exposures and source catalog.task.CalcZernikesTask
calculates the Zernikes polynomials from donut stamps already stored in a butler repository.
Important enums:
BandLabel
defines the type of active filter.BscDbType
defines the type of bright star catalog database.
Modules¶
The classes and files for each module are listed below.
wep¶
This module is a high-level module to use other modules.
Instrument: Class that defines the geometry, mask model, Batoid model, etc. for different telescopes.
Image: Image class to have the function to get the donut center.
ImageMapper: Class that maps images between the pupil and image planes, and creates masks.
DonutImageCheck: Donut image check class to judge the donut image is effective or not.
DonutDetector: Detect donuts directly from an out of focus image by convolution with a template image.
wep.centroid¶
This module finds the centroids of donuts.
CentroidFindFactory: Factory for creating the centroid find object to calculate the centroid of donut.
CentroidDefault: Default centroid class.
CentroidRandomWalk: CentroidDefault child class to get the centroid of donut by the random walk model.
CentroidOtsu: CentroidDefault child class to get the centroid of donut by Otsu’s method.
CentroidConvolveTemplate: CentroidDefault child class to get the centroids of one or more donuts in an image by convolution with a template donut.
wep.estimation¶
This module estimates the wavefront error.
WfEstimator: Calculate the wavefront error in annular Zernike polynomials based on the defocal donut images.
WfAlgorithm: Base class for algorithms that estimate Zernikes from donut images.
WfAlgorithmFactory: Factory for creating the algorithm classes
TieAlgorithm: Class that estimates Zernikes by solving the transport of intensity equation.
wep.deblend¶
This module does the image deblending.
DeblendDonutFactory: Factory for creating the deblend donut object to deblend the bright star donut from neighboring stars.
DeblendDefault: Default deblend class.
DeblendAdapt: DeblendDefault child class to do the deblending by the adaptive threshold method.
nelderMeadModify: Do the numerical optimation according to the Nelder-Mead algorithm.
wep.task¶
This module has the tasks to run WEP as a pipeline with Gen 3 LSST DM middleware.
GenerateDonutDirectDetectTaskConnections: Connections setup for GenerateDonutDirectDetectTask to run in a pipeline with Gen 3 middleware.
GenerateDonutDirectDetectTaskConfig: Configuration setup for GenerateDonutDirectDetectTask.
GenerateDonutDirectDetectTask: Gen 3 middleware task to convolve the defocal postISRCCD exposure with a donut template and and create a catalog of donut sources for that exposure.
GenerateDonutCatalogOnlineTaskConfig: Configuration setup for GenerateDonutCatalogOnlineTask.
GenerateDonutCatalogOnlineTask: Task to take pointing information and create a catalog of donut sources in that pointing. Not a pipeline task.
GenerateDonutCatalogWcsTaskConnections: Connections setup for GenerateDonutCatalogWcsTask to run in a pipeline with Gen 3 middleware.
GenerateDonutCatalogWcsTaskConfig: Configuration setup for GenerateDonutCatalogWcsTask.
GenerateDonutCatalogWcsTask: Gen 3 middleware task to take the WCS from each detector in a postISRCCD exposure and create a catalog of donut sources for that exposure.
DonutSourceSelectorTaskConfig: Configuration setup for DonutSourceSelectorTask.
DonutSourceSelectorTask: Filter a reference catalog according to parameters specified in DonutSourceSelectorTaskConfig to create a catalog of donut sources acceptable for Zernike estimation.
DonutQuickMeasurementTaskConfig Configuration setup for DonutQuickMeasurementTask.
DonutQuickMeasurementTask: Run quick donut detection and measurement on exposures.
DonutStamp: Storage class for a single donut postage stamp and associated metadata.
DonutStamps: Gen 3 Butler readable storage class for a list of DonutStamp objects with helper functions to get metadata and to save DonutStamps object as FITS file.
RefCatalogInterface: Tools to pick out the pieces of a reference catalog in the Gen3 Butler that cover the sky area of a pointing.
CombineZernikesBaseTask: Base class for CombineZernikes tasks that combine the Zernike coefficients from multiple donuts on a detector into a single set of coefficients for the detector.
CombineZernikesBaseConfig: Configuration setup for CombineZernikesBaseTask.
CombineZernikesMeanTask: Gen 3 middleware task to combine the Zernike coefficients using an unweighted mean of coefficients from all donut pairs.
CombineZernikesSigmaClipTask: Gen 3 middleware task to combine the Zernike coefficients with a sigma clipping method that will remove donuts with outlier Zernike values from the final averaging of donut pairs.
CombineZernikesSigmaClipTaskConfig: Configuration setup for CombineZernikesSigmaClipTask.
EstimateZernikesBaseTask: Base class for EstimateZernikes subtasks that estimate the Zernike coefficients from donut images.
EstimateZernikesBaseConfig: Configuration for EstimateZernikesBase.
EstimateZernikesTieTask: Subtask that estimates Zernikes from stamps using the TIE algorithm.
EstimateZernikesTieConfig: Configuration for EstimateZernikesTieTask.
CalcZernikesTask: Gen 3 middleware task to calculate the zernikes from donut stamps that already exist in the butler.
CalcZernikesTaskConnections: Connections setup for CalcZernikesTask.
CalcZernikesTaskConfig: Configuration setup for CalcZernikesTask.
CutOutDonutsBaseTask: Base class for CutOutDonuts tasks.
CutOutDonutsBaseTaskConnections: Base connections class for CutOutDonuts tasks.
CutOutDonutsBaseTaskConfig: Base configuration class for CutOutDonuts tasks.
CutOutDonutsCwfsTask: Gen 3 middleware task to cut out donut stamps on LSST Corner Wavefront Sensors from donut catalogs produced by GenerateDonutCatalogs tasks.
CutOutDonutsCwfsTaskConfig: Configuration setup for CutOutDonutsCwfsTask.
CutOutDonutsScienceSensorTask: Gen 3 middleware task to cut out donut stamps on science sensors from donut catalogs produced by GenerateDonutCatalogs tasks.
CutOutDonutsScienceSensorTaskConnections: Connections setup for CutOutDonutsScienceSensorTask.
CutOutDonutsScienceSensorTaskConfig: Configuration setup for CutOutDonutsScienceSensorTask.
GenerateDonutFromRefitWcsTask: Optional pipeline task to take a catalog of detected donuts from GenerateDonutDirectDetectTask and fit a WCS to the input exposure and return a donut catalog using the new WCS and a reference catalog.
GenerateDonutFromRefitWcsTaskConnections: Connections setup for GenerateDonutFromRefitWcsTask.
GenerateDonutFromRefitWcsTaskConfig: Configuration setup for GenerateDonutFromRefitWcsTask.
GenerateDonutCatalogUtils: Common utility functions for the GenerateDonutCatalog…Tasks.
ExposurePairer: Subtask to pair intra- and extra-focal exposures heuristically.
TablePairer: Subtask to pair intra- and extra-focal exposures manually from a table. Use generatePairTable.py script as a useful starting point.
wep.utils¶
This module contains utility functions that are used elsewhere in WEP.
enumUtils: Enum definitions and related functions.
ioUtils: Functions for reading and writing files.
maskUtils: Functions for generating a mask model for an instrument.
taskUtils: Functions for running command line tasks from a python script.
zernikeUtils: Functions for evaluating and fitting Zernike polynomials.
plotUtils: Functions for plotting results.
miscUtils: Miscellaneous utility functions.
Python API reference¶
This section is autogenerated from docstrings.
lsst.ts.wep Package¶
Classes¶
Class to detect donuts directly from an out of focus image by convolution with a template image. |
|
|
Class to hold a donut image along with metadata. |
|
Class for mapping the pupil to the image plane, and vice versa. |
|
Object with relevant geometry of the primary mirror and focal plane. |
lsst.ts.wep.centroid Package¶
Classes¶
CentroidDefault child class to get the centroid of donut by convolution with a template donut image. |
|
Default Centroid class. |
|
Factory for creating the centroid find object to calculate the centroid of donut. |
|
CentroidDefault child class to get the centroid of donut by the Otsu's method. |
|
CentroidDefault child class to get the centroid of donut by the random walk model. |
lsst.ts.wep.estimation Package¶
Classes¶
|
Wavefront estimation algorithm class for Danish. |
|
Wavefront estimation algorithm class for the TIE solver. |
Base class for wavefront estimation algorithms |
|
Factory for loading different wavefront estimation algorithms. |
|
|
Class providing a high-level interface for wavefront estimation. |
lsst.ts.wep.deblend Package¶
Functions¶
|
Evaluate the function. |
|
Optimization of the Nelder-Mead algorithm. |
Classes¶
DeblendDefault child class to do the deblending by the adaptive threshold method. |
|
Default deblend class. |
|
Factory for creating the deblend donut object to deblend the bright star donut from neighboring stars. |
lsst.ts.wep.task Package¶
Functions¶
|
Add visit info from the exposure object to the catalog QTable metadata. |
|
Convert a dictionary (as from astropy metadata added by addVisitInfoToCatTable) back into a VisitInfo object. |
|
Reformat afwCatalog into an astropy QTable sorted by flux with the brightest objects at the top. |
|
Match the detector area to the reference catalog and then run the LSST DM reference selection task. |
Classes¶
|
Base class for calculating Zernike coeffs from pairs of DonutStamps. |
|
|
|
|
|
Calculate Zernikes using unpaired donuts. |
|
|
|
|
|
|
|
Base class for algorithms that combine Zernikes from the individual pairs of donuts on a detector into a single array of Zernike values for that detector. |
|
Combine the raw Zernike measurements into an average measurement with an unweighted mean. |
|
Combine the raw Zernike measurements into an average measurement by rejecting outliers with sigma clipping. |
|
Configuration for combining Zernike coefficients with sigma clipping. |
|
Base class for CutOutDonuts tasks. |
|
|
|
|
|
Cut out the donut postage stamps on corner wavefront sensors (CWFS) |
|
|
|
Run Zernike Estimation in full-array mode (FAM) |
|
|
|
Cutout donuts without pairing any exposures. |
|
|
|
|
|
|
|
|
|
Donut Source Selector that uses a nearest neighbors radius query to find all donuts within the pixel radius set in the config. |
|
|
|
Single donut stamp |
|
Donut Stamp Selector uses information about donut stamp calculated at the stamp cutting out stage to select those that specified criteria. |
|
|
|
Holds a list of DonutStamp objects with additional functions to get metadata as well as save as FITS files. |
|
|
|
Base class for estimating Zernike coefficients from DonutStamps. |
|
Danish-specific configuration parameters for Zernike estimation. |
|
Estimate Zernike coefficients using the TIE algorithm. |
|
TIE-specific configuration parameters for Zernike estimation. |
|
Estimate Zernike coefficients using the TIE algorithm. |
|
|
|
|
|
Construct a source catalog from reference catalogs and pointing information. |
|
Configuration for GenerateDonutCatalogOnlineTask. |
|
Create a WCS from boresight info and then use this with a reference catalog to select sources on the detectors for AOS. |
|
Configuration settings for GenerateDonutCatalogWcsTask. |
|
Specify the pipeline connections needed for GenerateDonutCatalogWcsTask. |
|
Generate donut template and convolve with the defocal image to detect sources on the detectors for AOS. |
|
Configuration settings for GenerateDonutDirectDetectTask. |
Specify the pipeline connections needed for GenerateDonutDirectDetectTask. |
|
|
Fit a new WCS to the image from a direct detect Donut Catalog and return the input exposure with the new WCS attached. |
|
Configuration settings for GenerateDonutCatalogWcsTask. |
Specify the pipeline inputs and outputs needed for FitDonutWcsTask. |
|
|
|
|
|
|
Class to provide tools to interact with reference catalog in Butler repository and select pieces of the catalog that cover the sky area of a pointing. |
|
|
|
lsst.ts.wep.utils Package¶
Functions¶
|
Bin a 2d array by averaging over non-overlapping blocks. |
|
Center the image by correlating with the template. |
|
Apply conditional sigma clipping to an array. |
|
Configure the class. |
|
Convert algorithm history to be saved in task metadata. |
|
Convert the history from the metadata back to original format. |
|
Convert Zernike amplitudes to quadrature contribution to the PSF FWHM. |
|
Create a GalSim Zernike object with the given coefficients. |
|
Create a donut template for the given detector. |
|
Create a basis of Zernike polynomials. |
|
Create a basis of Zernike gradient polynomials. |
|
Extract the central image. |
|
Fit the mask model for the telescope. |
|
Forward model a pair of donuts. |
|
Apply regular expression to find repackaged amplifier image files. |
|
Get the proper camera object for the donuts. |
Get the directory of configuration files. |
|
Get the path of module. |
|
Get the obs_lsst command line task configuration directory. |
|
|
Get the offset from the exposure. |
|
Get the gradient of the PSF FWHM with respect to each Zernike. |
|
Get the instrument to use for the task. |
|
Return the parity of the Zernike polynomials (Noll index >= 4). |
|
Merge the passed keyword arguments with the values stored in the file. |
|
Extend the boundary of image. |
|
Plot the residuals between the ImageMapper and Batoid. |
|
Plot the results of the mask fitting. |
|
Plot the mask elements as circles. |
|
Plot a roundtrip of the ImageMapper |
|
Plot the convergence of Zernike coefficients stored in the history. |
|
Plot the Zernike polynomials (zk). |
|
Return mask indicating if each point in the grid is inside the polygon. |
|
Print the yaml-formatted mask model. |
|
Prune the mask model so only necessary elements remain. |
|
Read the config yaml file and return the corresponding dictionary. |
|
Read the PhoSim setting data (segmentation or focal plane layout). |
Resolve a relative config path into an absolute path. |
|
|
Create a 2-d rotation matrix for given angle. |
|
Run the program w/o arguments. |
|
Search the position of donut on image. |
|
Format a command line call to clean up the data created by a pipeline. |
|
Write the content to file. |
|
Format a command line call to run a Gen 3 pipeline task. |
|
Evaluate the Zernike series. |
|
Fit Zernike polynomials to the surface. |
|
Evaluate the gradient of the Zernike series. |
Classes¶
|
|
|
|
|
|
|
|
|
|
|
A dictionary that aliases Enums and their corresponding values. |
|
|
|
Specifies whether the image is on the image or pupil plane. |
|
Contributing¶
To contribute, please start a new pull request on GitHub. Feature requests shall be filled in JIRA with ts_aos as the component. In all cases, reaching out to the contacts for this module is recommended.