Documentation of data frame processing

This script measures the intensity in every output, per spectral channel and computes the null depths. It relies on the library GLINT Pipeline’s classes to work.

The inputs are the datacubes (target or dark). The datacube of dark needs to be processed as it gives the distribution of dark currents in the different outputs used in the model fitting later. The datacube of target gives the null depth and the intensities are used to monitor any suspicious behavior if needed.

The products are HDF5 files structured as a dictionary (see glint_classes documentation). One HDF5 produces per datacube.

It contains:
  • 1d-arrays for the null depth, named nullX (with X=1..6). The elements of the array are the null depths per spectral channel.
  • 1d-array for the photometry, named pX (with X=1..4). It has the same structure as nullX.
  • 1d-array for the intensity in the null outputs, named IminusX (with X=1..6).
  • 1d-array for the intensity in the anti-null outputs, named IplusX (with X=1..6).
  • 1d-array containing the common spectral channels for all the outputs (as each output is slightly shifted from the others)
Some monitoring data can be created (but not saved):
  • Histograms of intensities of the photometries
  • Optimal parameters from a Gaussian fitting of the intensity profile in one output for one spectral channel
  • Evolution of the null depths along the frame axis for 10 spectral channels
  • Evolution of the measured intensities along the frame axis of every outputs according to different estimators

The monitoring is activated by setting the boolean variable debug = True.

In that case, it is strongly advised deactivate the save of the results and to process one frame of one datacube to avoid extremely long data processing.

In order to increase the SNR in the extraction of the flux in the photometric output, ones can create the spectra in them by averaging the frames. The spectra are then normalized so that their integral in the bandwidth is equal to 1. Therefore, the extraction of the photometries on a frame basis first estimates the total flux in bandwidth then the spectral flux is given by the product of this total flux with the spectra. However, the gain of SNR is barely significant so this mode should not be used.

This script is used in 3 steps.

First step: simply change the value of the variables in the Settings section:
  • save: boolean, True for saving products and monitoring data, False otherwise
  • no_noise: boolean, True for noise-free (simulated) data
  • nbfiles: 2-tuple of int, set the bounds between which the data files are selected. None is equivalent to 0 if it is the lower bound or -1 included or it is the upper one.
  • nb_img: 2-tuple of int, set the bounds between which the frame are selected, into a data file.
  • nulls_to_invert: list of null outputs to invert. Fill with nullX (X=1..6) or leave empty if no null is to invert (deprecated)
  • bin_frames: boolean, set True to bin frames
  • nb_frames_to_bin: number of frames to bin (average) together. If None, the whole stack is average into one frame. If the total number of frames is not a multiple of the binning value, the remaining frames are lost.
  • spectral_binning: bool, set to True to spectrally bins the outputs
  • wl_bin_min: scalar, lower bounds (in nm) of the bandwidth to bin, possibly in several chunks
  • wl_bin_max: scalar, upper bounds (in nm) of the bandwidth to bin, possibly in several chunks
  • bandwidth_binning: scalar, width of the chunks of spectrum to bin between the lower and upper bounds
  • mode_flux: string, choose the method to estimate the spectral flux in the outputs among:
    • amplitude uses patterns determined in the script glint_geometric_calibration and a linear least square is performed to get the amplitude of the pattern
    • model proceeds like amplitude but the integral of the flux is returned
    • windowed returns a weighted mean as flux of the spectral channel. The weights is the same pattern as the other modes above
    • raw returns the mean of the flux along the spatial axis over the whole width of the output
  • activate_estimate_spectrum, boolean, if True, the spectrum of the source in the photometric output is created.
  • nb_files_spectrum: tuple, range of files to read to get the spectra.
  • wavelength_bounds: tuple, bounds of the bandwidth one wants to keep after the extraction. Used in the method getIntensities. It works independantly of wl_bin_min and wl_bin_max.
  • suffix: str, suffix to distinguish plots respect to data present in the datafolder (e.g. dark, baselines, stars…)
Second step: change the value of the variables in the Inputs and Outputs sections:
  • datafolder: folder containing the datacube to use.
  • root: path to datafolder.
  • data_list: list of files in datafolder to open.
  • spectral_calibration_path: path to the spectral calibration files used to process the file
  • geometric_calibration_path: path to the geometric calibration files used to process the file (location and width of the outputs per spectral channel)

Third step: start the script and let it run.

glint_measure_null_depth2.gaussian(x, A, loc, sig)

Computes a Gaussian curve

Parameters:

x: values where the curve is estimated.

A: amplitude of the Gaussian.

x0: location of the Gaussian.

sig: scale of the Gaussian.

Returns:

Gaussian curve.