LgModel

class jwst.ami.lg_model.LgModel(nrm_model, pixscale, bandpass, mask='jwst_ami', holeshape='hex', over=1, phi=None, chooseholes=None, affine2d=None)[source]

Bases: object

A class for conveniently dealing with an NRM object.

This class:

  • Defines mask geometry and detector-scale parameters.

  • Simulates PSF (broadband or monochromatic).

  • Builds a fringe model - either by user definition, or automated to data.

  • Fits model to data by least squares.

Masks: jwst_ami (formerly jwst_g7s6c)

Parameters:
nrm_modelNRMModel or NRMDefinition

Datamodel containing mask geometry information

pixscalefloat

Initial estimate of pixel scale in radians

bandpassndarray[float]

Array of the form: [(weight1, wavl1), (weight2, wavl2), ...]

maskstr

Keyword for built-in values

holeshapestr

Shape of apertures; default: “hex”

overint

Oversampling factor

phifloat 1D array

Distance of fringe from hole center in units of waves

chooseholeslist of strings, default None

E.g., ['B2', 'B4', 'B5', 'B6'] for a four-hole mask. If None, use the real seven-hole mask.

affine2dAffine2d

Affine2d object

Notes

Algorithm documented in Greenbaum, A. Z., Pueyo, L. P., Sivaramakrishnan, A., and Lacour, S., Astrophysical Journal vol. 798, Jan 2015. First written by Alexandra Greenbaum in 2014.

Methods Summary

create_modelpsf()

Make an image from the object's model and fit solutions.

fit_image(image, model_in[, dqm, weighted])

Run a least-squares fit on an input image.

make_model(fov[, psf_offset])

Generate the fringe model.

simulate(fov[, psf_offset])

Simulate a detector-scale PSF.

Methods Documentation

create_modelpsf()[source]

Make an image from the object’s model and fit solutions.

The result is stored in the self.modelpsf attribute.

fit_image(image, model_in, dqm=None, weighted=False)[source]

Run a least-squares fit on an input image.

Find the appropriate wavelength scale and rotation. If a model is not specified then this method will find the appropriate wavelength scale, rotation (and hopefully centering as well – This is not written into the object yet, but should be soon). Without specifying a model, this method can take a reference image (a cropped deNaNed version of the data) to run correlations. It is recommended that the symmetric part of the data be used to avoid piston confusion in scaling.

Parameters:
image2D float array

Input image

model_in2D float array

Model image

dqm2D array

Bad pixel mask of same dimensions as image

weightedbool

Use weighted operations in the least squares routine

make_model(fov, psf_offset=(0, 0))[source]

Generate the fringe model.

Use the attributes of the object with a bandpass that is either a single wavelength or a list of tuples of the form:

[(weight1, wavl1), (weight2, wavl2), ...]

The model is a collection of fringe intensities, where nholes = 7 means the model has a @D slice for each of 21 cosines, 21 sines, a DC-like, and a flux slice for a total of 44 2D slices.

Parameters:
fovint

Number of detector pixels on a side

psf_offsettuple of int

Offset from center of array in units of detector pixels.

Returns:
ndarray[float]

Generated fringe model in the shape of (fov, fov, N * (N - 1) + 2) that is also stored as self.model

simulate(fov, psf_offset=(0, 0))[source]

Simulate a detector-scale PSF.

Use parameters input from the call and already stored in the object, and generate a simulation FITS header storing all of the parameters used to generate that PSF. If the input bandpass is one number, it will calculate a monochromatic PSF.

Parameters:
fovint

Number of detector pixels on a side

psf_offsettuple of int

Offset from center of array in units of detector pixels.

Returns:
float 2D array

Simulated PSF of shape (fov, fov) that is also stored as self.psf