This module contains all functionality related to creating and applying non-linearity coefficients from and to data.
Measure the intensity of each cell in each OTA in a number of input files
podi_nonlinearity.py file1.fits file2.fits
Fit all data and compute non-linearity coefficients
podi_nonlinearity.py -fit (-mint=0.0) (-maxt=100.0) (-minf=10.0) (-maxf=59000.0) (-order=3) input.datafile output.fits
- -mint=X and -maxt=X specify the minimum and maximum exposure times to be
- included in the fit
- -minf=X and -maxf limit the intensity-range allowed during the fit. This
- is useful to limit problematic andor saturated intensity ranges.
-order=X determines th epolynomial degree to be used in the fit.
Load the coefficient file and print the coefficients for a given OTA
podi_nonlinearity.py -load coefficients.fits OTA-number
Apply the correction to a overscan-subtracted raw-frame
podi_nonlinearity.py -correctraw input.fits coeffs.fits output.fits
Apply the non-linearity correction to a collectcells-reduced frame
podi_nonlinearity.py -correct input.fits coeffs.fits output.fits
Create a diagnostic plot, showing data, fit, and fit-residuals, for a given cell
podi_nonlinearity.py -plotdatafit data.file ota cellx celly coeffs.fits output.png
Create a map, showing the relative amplitude of the non-linearity correction relative to the input intensity, at a given intensity-level.
podi_nonlinearity.py -nonlinmap coeffs.fits output.png fluxlevel
Apply the gain correction
Select the non-linearity coefficients for the specified cell and compute the correction.
Evaluate the polynomial describing the non-linearity correction
Create a plot, for a given individual cell, showing the non-linearity measurements, polynomial fits for various degrees and the difference between data and fit,
Prepare the non-linearity data by measuring the mean/median intensity level in each and all cells in each of the given files.
All this data is then returned. During execution, the generated data is also written to disk into a file named “alldata.tmp”
Fit all non-linearity data for all cells, based on data created earlier.
Create a non-linearity map, showing (color-coded) the ratio of non-linearity correction to input data, for each cell across the entire focalplane.
Select the appropriate non-linearity coefficient file based on a history file and a given MJD timestamp.
Perform a polynomial fit to all data of a given cell. Mostly a wrapper around scipy.optimize.leastsq.