IFS module

Standalone IFS simulation code MJ Rizzo and the IFS team

Originally inspired by T. Brandt’s code for CHARIS

IFS.createWavecalFiles(par, lamlist, dlam=1.0)[source]

Creates a set of monochromatic IFS images to be used in wavelength calibration step

Parameters:

par: Parameter instance

Contains all IFS parameters

lamlist: list or array of floats

List of discrete wavelengths at which to create a monochromatic flat

dlam: float

Width in nm of the small band for each of the monochromatic wavelengths. Default is 1 nm. This has no effect unless we are trying to add any noise.

Notes

This function populates the fields par.lamlist and par.filelist which are subsequently used by the buildcalibrations function. If this createWavecalFiles is not called, the two fields need to be populated manually with the set of files and wavelengths that you want to use for the calibration.

IFS.polychromeIFS(par, inWavelist, inputcube, name='detectorFrame', parallel=True, QE=True, wavelist_endpts=None, dlambda=None, lam_arr=None, wavecalDir=None, noRot=False)[source]

Propagates an input cube through the Integral Field Spectrograph

Parameters:

par : Parameter instance

with at least the key IFS parameters, interlacing and scale

inWavelist : list of floats

List of wavelengths in nm corresponding to the center of each bin

inputcube : Image

or HDU. data is 3D ndarray with first dimension the same length as lamlist header needs to contain the ‘PIXSIZE’ and ‘LAM_C’ keywords

name: string

Name of the output file (without .fits extension)

parallel: boolean

Whether to use parallel computing for this (recommended)

QE: boolean

Whether to take into account wavelength-dependent detector QE (from file defined in par.QE)

wavelist_endpts: list of floats

List of the wavelengths in nm corresponding to the endpoints of the bins (array has to be one longer than wavelist)

dlambda: float

In case all the bins have the same size, use this parameter in nm. Replaces wavelist_endpts if set

lam_arr: list of floats

Temporary input vector of the wavelengths used to construct the polychrome. This is necessary in order to construct the wavelength calibration files. If the bandpass changes, one needs to pass an array of wavelengths covering the new bandpass. Need to work on this.

wavecal: string

This can be used to add a distortion already measured from lab data, for example. Put in there the full folder name where we can find a ‘lamsol.dat’ file.

noRot: boolean

A rarely used option that allows to NOT rotate the input cube, if we want to simulate sending a input map aligned with the lenslets

Returns:

detectorFrame : 2D array

Return the detector frame

IFS.prepareCube(par, wavelist, incube, QE=True, adjustment=1.0)[source]

Processes input cubes

IFS.reduceIFSMap(par, IFSimageName, method='optext', smoothbad=True, name=None, hires=False, dy=3, fitbkgnd=True, specialPolychrome=None, returnall=False, niter=10, pixnoise=0.0, normpsflets=False)[source]

Main reduction function

Uses various routines to extract an IFS detector map into a spectral-spatial cube.

Parameters:

par : Parameter instance

Contains all IFS parameters

IFSimageName : string or 2D ndarray

Path of image file, of 2D ndarray.

method : ‘lstsq’, ‘optext’

Method used for reduction. ‘lstsq’: use the knowledge of the PSFs at each location and each wavelength and fits the microspectrum as a weighted sum of these PSFs in the least-square sense. Can weigh the data by its variance. ‘optext’: use a matched filter to appropriately weigh each pixel and assign the fluxes, making use of the inverse wavlength calibration map. Then remap each microspectrum onto the desired wavelengths

Returns:

cube: 3D ndarray

Reduced IFS cube

IFS.reduceIFSMapList(par, IFSimageNameList, method='optext', parallel=True, smoothbad=True)[source]

Main reduction function

Uses various routines to extract an IFS detector map into a spectral-spatial cube.

Parameters:

par : Parameter instance

Contains all IFS parameters

IFSimageNameList : list

List of strings containing the paths to the image files

method : ‘lstsq’, ‘optext’

Method used for reduction. ‘lstsq’: use the knowledge of the PSFs at each location and each wavelength and fits the microspectrum as a weighted sum of these PSFs in the least-square sense. Can weigh the data by its variance. ‘optext’: use a matched filter to appropriately weigh each pixel and assign the fluxes, making use of the inverse wavlength calibration map. Then remap each microspectrum onto the desired wavelengths