DanishAlgorithm#

class lsst.ts.wep.estimation.DanishAlgorithm(lstsqKwargs=None, binning=1, jointFitPair=True, modelSpiderShadows=False, bkgOrder=0, doAoiThroughput=False, systematicLossAlpha=0.0, triangleMode=False)#

Bases: WfAlgorithm

Wavefront estimation algorithm class for Danish.

The Danish algorithm is based on Janish 2012: http://hdl.handle.net/1721.1/78543 Implemented and improved by Josh Meyers: jmeyers314/danish

Parameters:
  • lstsqKwargs (dict, optional) – A dictionary containing any of the keyword arguments for scipy.optimize.least_squares, except fun, x0, jac, or args.

  • binning (int, optional) – Binning factor to apply to the donut stamps before estimating Zernike coefficients. The default value of 1 means no binning.

  • jointFitPair (bool, optional) – Whether to jointly fit intra/extra pairs, when a pair is provided. If False, Zernikes are estimated for each individually, then averaged. (the default is True)

  • modelSpiderShadows (bool = False,) – Whether to include the spider shadows or not in the danish forward model.

  • bkgOrder (int = 0,) – The order of the background polynomial to fit. A value of -1 means no background fitting, a value of 0 is a constant background, etc.

  • doAoiThroughput (bool, optional) – Whether to apply angle-of-incidence throughput correction in the danish forward model. (the default is False)

  • systematicLossAlpha (float, optional) – Fractional systematic uncertainty for the loss function. The effective per-pixel variance becomes var + model + (alpha*model)**2, which caps per-pixel SNR. A value of 0 (the default) recovers the standard chi-squared loss.

  • triangleMode (bool, default: False)

Attributes Summary

binning

Binning factor to apply to donut stamps.

history

The algorithm history.

jointFitPair

Whether to jointly fit intra/extra pairs.

lstsqKwargs

Keyword arguments for scipy.optimize.least_squares

requiresPairs

Whether the algorithm requires pairs to estimate Zernikes.

triangleMode

Whether to use the triangle mode in the danish forward model.

Methods Summary

prepImage(image, zkStart, instrument)

Prepare a donut stamp image for danish.

Attributes Documentation

binning#

Binning factor to apply to donut stamps.

history#

The algorithm history.

The history is a dictionary that contains intermediate products from the Zernike fitting. The dict contains entries for “intra” and/or “extra”, plus the final zernike estimate under “zk”.

The “intra” and “extra” entries are dictionaries that contain the following entries

  • “image” - the image that is being fit

  • “variance” - the background variance that was used for fitting

  • “nollIndices” - Noll indices for which Zernikes are estimated

  • “zkStart” - the starting Zernike coefficients

  • “lstsqResult” - dictionary of results returned by least_squares

  • “zkFit” - the Zernike coefficients fit to the donut

  • “zkSum” - zkFit + the intrinsic Zernikes

  • “model” - the final forward-modeled donut image

  • “GalSimFFTSizeError” - whether this was hit during least_squares

Note the units for all Zernikes are in meters, and all Zernikes start with Noll index 4.

jointFitPair#

Whether to jointly fit intra/extra pairs.

lstsqKwargs#

Keyword arguments for scipy.optimize.least_squares

requiresPairs#

Whether the algorithm requires pairs to estimate Zernikes.

triangleMode#

Whether to use the triangle mode in the danish forward model.

Methods Documentation

prepImage(image, zkStart, instrument)#

Prepare a donut stamp image for danish.

This creates the background mask if needed, estimates the background noise, subtracts the median background, applies binning, and trims the image to an odd size. It is useful both for fitting and for preparing donut stamps for plotting.

Parameters:
  • image (Image) – The ts_wep image of the donut stamp. Note the image array is modified in place by subtracting the median background.

  • zkStart (np.ndarray) – The starting point for the Zernikes, used to create the background mask if one does not already exist.

  • instrument (Instrument) – The ts_wep Instrument.

Return type:

tuple[ndarray, float]

Returns:

  • np.ndarray – The prepared image array.

  • float – The robust estimate of the background noise standard deviation.