emicorr_refwave

jwst.emicorr.emicorr.emicorr_refwave(data, pdq, refwave, nsamples, rowclocks, frameclocks, period_in_pixels, fit_ints_separately=False, nphases_opt=500)[source]

Derive the best amplitude and phase for the EMI waveform, subtract it off.

This routine works by choosing pixels with modest scatter among the reads, and then finding the amplitude and phase of a supplied reference waveform that, when subtracted, makes these pixels’ ramps as straight as possible. The straightness of the ramps is measured by chi squared after fitting lines to each one.

Parameters:
datandarray

4D data to correct, shape (nints, ngroups, nrows, ncols). Modified in-place.

pdqndarray

2D pixeldq array, shape (nrows, ncols)

refwavendarray

Reference waveform, 1D array

nsamplesint

Number of samples of each pixel in each group: 1 for fast, 9 for slow

rowclocksint

Extra pixel times in each row before reading out the following row

frameclocksint

Pixel clock cycles in a reset frame

period_in_pixelsfloat

Period in pixel clock times of the waveform given by refwave

fit_ints_separatelybool, optional

Fit the integrations separately? If True, fit amplitude and phase for refwave independently for each integration. If False, fit for a single amplitude and phase across all integrations.

nphases_optint, optional

Number of phases to sample chi squared as a function of phase

Returns:
datandarray

The input 4D data array with the model waveform phased, scaled, and subtracted.