WEP Developer Guide¶
Wavefront estimation pipeline (WEP) calculates the wavefront error in annular Zernike polynomials up to 22 terms based on the intra- and extra-focal donut images. The wavefront error is determined by solving the transport of intensity equation (TIE) that approximates the change of intensity mainly comes from the wavefront error. For an in-depth explanation of the algorithm that solves the TIE equation see the following technote: SITCOMTN-046: AOS Algorithm for Wavefront Estimation.
Main Classes¶
Important classes:
WfEstimator
calculates the wavefront error in annular Zernike polynomials up to 22 terms 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:
FilterType
defines the type of active filter.CamType
defines the type of camera.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.
Figure 1 Class diagram of wep¶
WfEstimator: Calculate the wavefront error in annular Zernike polynomials up to 22 terms based on the defocal donut images.
ParamReader: Parameter reader class to read the yaml configuration files used in the calculation.
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.cwfs¶
This module calculates the wavefront error by solving the TIE.
Figure 2 Class diagram of wep.cwfs¶
Algorithm: Algorithm class to solve the TIE to get the wavefront error.
CompensableImage: Compensable image class to project the donut image from the image plane to the pupil plane.
Image: Image class to have the function to get the donut center.
Instrument: Instrument class to have the instrument information used in the Algorithm class to solve the TIE.
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 the 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.
BaseCwfsTestCase: Base class for CWFS tests.
DonutTemplateFactory: Factory for creating donut template objects used by CentroidConvolveTemplate.
DonutTemplateDefault: Default donut template class.
DonutTemplateModel: DonutTemplateDefault child class to make donut templates using an Instrument model.
DonutTemplatePhosim: DonutTemplateDefault child class to make donut templates from templates created with Phosim. See here for more information on creating and using Phosim donut templates.
wep.deblend¶
This module does the image deblending.
Figure 3 Class diagram of wep.deblend¶
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.
Figure 4 Class diagram of wep.task¶
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.
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.
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.
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. |
|
|
Initialization of parameter reader of yaml format class. |
|
Initialize the wavefront estimator class. |
lsst.ts.wep.cwfs Package¶
Classes¶
|
Initialize the Algorithm class. |
Base class for CWFS tests |
|
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. |
|
|
Instantiate the class of CompensableImage. |
Default Donut Template class. |
|
Factory used to create template maker object to generate donut template images CentroidConvolveTemplate. |
|
Class to make the donut templates from the Instrument model. |
|
Class to make the donut templates from phosim template images. |
|
|
Image class for wavefront estimation. |
Instrument class to have the instrument information used in the Algorithm class to solve the TIE. |
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¶
|
Reformat afwCatalog into a pandas dataframe 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¶
|
Run Zernike Estimation on corner wavefront sensors (CWFS) |
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
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 |
|
Holds a list of DonutStamp objects with additional functions to get metadata as well as save as FITS files. |
|
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¶
|
Calculate the wavefront surface in the basis of annular Zernike polynomial. |
|
Get the coefficients of annular Zernike polynomials by fitting the wavefront surface. |
|
Evaluate the gradient of annular Zernike polynomials in a certain direction. |
|
Evaluate the Jacobian of annular Zernike polynomials in a certain order. |
|
Calculate the wavefront surface in the basis of Zernike polynomial. |
|
Get the coefficients of Zernike polynomials by fitting the wavefront surface. |
|
Evaluate the gradient of Zernike polynomials in a certain axis. |
|
Evaluate the Jacobian of Zernike polynomials in a certain order. |
|
Fit the wavefront surface on pupil (e.g. |
|
Create configuration dictionary for the instrument. |
|
Extract the central image. |
|
Apply regular expression to find repackaged amplifier image files. |
|
Get the bright star catalog (BSC) database type. |
|
Get the camera name for policy files from CamType. |
|
Get the camera type from instrument name. |
|
Get the camera type from instrument name used by the LSST DM middleware for each instrument. |
|
Get the centroid find type. |
Get the directory of configuration files. |
|
|
Get the deblend donut type. |
|
Get the defocal distance for the instrument |
|
Get the donut template type. |
|
Get the FilterType associated with the name of the bandpass accessed in an exposure using |
|
Get the image type. |
Get the path of module. |
|
Get the obs_lsst command line task configuration directory. |
|
|
Map the reference filter to the G filter. |
|
Extend the boundary of image. |
|
Plot the Zernike polynomials (zk). |
|
Read the PhoSim setting data (segmentation or focal plane layout). |
|
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. |
Classes¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.