GLINT Pipeline’s classes¶
Classes used by the GLINT Data Reduction Software
-
class
glint_classes.
ChipProperties
(data=None, nbimg=(None, None), transpose=False)¶ Class handling the determination of the properties of the chip.
-
getRatioCoeff
(beam, zeta_coeff)¶ Determines the flux ratio between the different outputs
Parameters: - beam: int,
id (1..4) of the intput.
- zeta_coeff: dic
Dictionary in which the flux ratios are stored.
Returns: - zeta_coeff: dic
Same dictionary as required in the parameters, with the new entries set by the
beam
parameters.
-
-
class
glint_classes.
File
(data=None, nbimg=(None, None), transpose=False)¶ Management of the HDF5 datacube generated by GLINT
Parameters: - data: string (optional)
Path to the datacube to load. If
None
, datacube full of 0 is created, with same dimension as real data (nbimg, 344, 96). In that case, parameternbimg
cannot beNone
.- nbimg: tup (optional)
Load all frames of the datacube at path
data
from the first to the second-1 element of the tuple. It cannot be(None, None)
if mock data is created.- transpose: bol (optional)
If
True
, swappes the 2nd and 3rd axis of the datacube.
-
binning
(arr, binning, axis=0, avg=False)¶ Bin frames together
Parameters: - arr: nd-array
Array containing data to bin
- binning: int
Number of frames to bin
- axis: int
axis along which the frames are
- avg: bol
If
True
, the method returns the average of the binned frame. Otherwise, return its sum.
Attributes: Change the attributes
- data: ndarray
datacube
-
cosmeticsFrames
(dark, nonoise=False)¶ NOTE FROM 2020-06-26: Deprecated:
dark
must be a 2d-array full of 0. The cosmetics is performed on the outputs themselves instead of the whole frame. The attributes are meaningless but kept for comptability and further changes.Remove dark and bias from data frames. Directly acts on
data
attribute. Compute the variance and standard deviation of the background noise in a signal-free area of the frames.Parameters: - dark: 2d-array
Average dark
- nbimg: tup (optional)
Load all frames of the datacube at path
data
from the first to the second-1 element of the tuple. It cannot be(None, None)
if mock data is created.- nonoise: bool
Set to
True
if data does not have any detector noise (e.g. simulated one). It skips the cosmetics and set estimation of the background variance/std to zero
Attributes: Change the attributes
- data: ndarray
data frame
- bg_std: ndarray
Standard deviation of the background of each frame
- bg_var: ndarray
Variance of the background of each frame
-
loadfile
(data=None, nbimg=None, transpose=False)¶ Load the datacube when a File-object is created.
Parameters: - data: string (optional)
Path to the datacube to load. If
None
, datacube full of 0 is created, with same dimension as real data (nbimg, 344, 96). In that case, parameternbimg
cannot beNone
.- nbimg: tup (optional)
Load all frames of the datacube at path
data
from the first to the second-1 element of the tuple. It cannot be(None, None)
if mock data is created.- transpose: bol (optional)
If
True
, swappes the 2nd and 3rd axis of the datacube.
Attributes: Return the attributes
- data: ndarray
loaded or created datacube
- nbimg: float
number of frames in the data ndarray
-
class
glint_classes.
Null
(data=None, nbimg=(None, None), transpose=False)¶ Class handling the measurement of the null and photometries from bias-corrected frame.
-
computeNullDepth
()¶ Deprecated. Compute the null depth per spectral channel, per frame, per model, for each output.
Attributes: Creates the following attributes
- nullX: ndarray
Estimated null depth of the Xth null, based on the
amplitude
attribute.- nullX_err: ndarray
Estimated uncertainty of the estimated Xth null from the
amplitude
attribute.- null_modelX: ndarray
Estimated null depth of the Xth null, based on the
integ_model
attribute.- null_modelX_err: ndarray
Estimated uncertainty of the estimated Xth null from the
integ_model
attribute.- null_windowedX: ndarray
Estimated null depth of the Xth null, based on the
integ_windowed
attribute.- null_windowedX_err: ndarray
Estimated uncertainty of the estimated Xth null from the
integ_windowed
attribute.- null_rawX: ndarray
Estimated null depth of the Xth null, based on the
raw
attribute.- null_raw1_err: ndarray
Estimated uncertainty of the estimated Xth null from the
raw
attribute.
-
error_null
(null, Iminus, Iplus, Iminus_err, Iplus_err)¶ Deprecated.
Propagate the error on intensities estimations to the null depth. We assume independant and Gaussian distributed values.
Parameters: null: array, estimated null depths
Iminus: array, intensity from the conventional null output
Iplus: array, intensity from the conventional antinull output
Iminus_err: array, error on the intensity from the conventional antinull output
Iplus_err: array, error on the intensity from the conventional antinull output
Returns: Error on the null depth
-
getChannels
(channel_pos, sep, spatial_axis, **kwargs)¶ Extract the 16 channels/outputs from frames
Parameters: - channel_pos: list, array-like
Expected position of the arrays
- sep: float
Separation (in pixels) between two consecutive channels
- spatial_axis: 1d-array
Position-coordinate of each channel
- kwargs: optional
Can add the keyword
dark
associated with the average dark of each channel to perform their cosmetics instead of using thecosmeticsFrames
method from classFile
.
Attributes: Create the attributes
- slices: 4d-darray
Subframes of each channel. Structure as follow: (frame, spectral axis, channel ID, spatial axis)
- slices_axes: ndarray
Spatial coordinates of each channel
-
getIntensities
(mode, wl_bounds=(0, <sphinx.ext.autodoc.importer._MockObject object>))¶ Gets the intensity per spectral channel, per frame, per model, for each output.
Parameters: - mode: str,
- Select the way the flux is estimated in every outputs:
amplitude
uses patterns determined in the scriptglint_geometric_calibration
and a linear least square is performed to get the amplitude of the patternmodel
proceeds likeamplitude
but the integral of the flux is returnedwindowed
returns a weighted mean as flux of the spectral channel. The weights is the same pattern as the other modes aboveraw
returns the mean of the flux along the spatial axis over the whole width of the output
- wl_bounds:tup, optional
Set the bounds of the bandwidth to keep, in nanometer. Default is to keep all the common spectral channels to all outputs.
Attributes: - pX: ndarray,
Estimated flux in the photometric output X=1..4, from the
amplitude
attribute.- pX_err: ndarray,
Uncertainty on the estimated flux in the photometric output X
- IminusX: ndarray,
Estimated flux in the null output X=1..6, from the
amplitude
attribute.- IplusX: ndarray,
Estimated flux in the antinull output X=1..6, from the
amplitude
attribute.- pX_model: ndarray
Estimated flux in the photometric output X=1..4, from the
integ_model
attribute.- pX_model_err: ndarray
Uncertainty on the estimated flux in the photometric output X
- Iminus_modelX: ndarray
Estimated flux in the null output X=1..6, from the
integ_model
attribute.- Iplus_modelX: ndarray
Estimated flux in the antinull output X=1..6, from the
integ_model
attribute.- pX_windowed: ndarray
Estimated flux in the photometric output X=1..4, from the
integ_windowed
attribute.- pX_windowed_err: ndarray
Uncertainty on the estimated flux in the photometric output X
- Iminus_windowedX: ndarray
Estimated flux in the null output X=1..6, from the
integ_windowed
attribute.- Iplus_windowedX: ndarray
Estimated flux in the antinull output X=1..6, from the
integ_windowed
attribute.- pX_raw: ndarray
Estimated flux in the photometric output X=1..4, from the
raw
attribute.- pX_raw_err: ndarray
Uncertainty on the estimated flux in the photometric output X
- Iminus_rawX: ndarray
Estimated flux in the null output X=1..6, from the
raw
attribute.- Iplus_rawX: ndarray
Estimated flux in the antinull output X=1..6, from the
raw
attribute.
-
getSpectralFlux
(spectral_axis, positions, widths, mode_flux, debug=False)¶ Wrapper getting the flux per spectral channel of each output.
Parameters: - spectral_axis: ndarray
Common spectral axis in pixel for every outputs
- position: array-like
Positions of each output respect to the column of pixels.
- width: array-like
Widths of each output respect to the column of pixels.
- mode_flux: string, choose the method to estimate the spectral flux in the outputs among:
amplitude
uses patterns determined in the scriptglint_geometric_calibration
and a linear least square is performed to get the amplitude of the patternmodel
proceeds likeamplitude
but the integral of the flux is returnedwindowed
returns a weighted mean as flux of the spectral channel. The weights is the same pattern as the other modes aboveraw
returns the mean of the flux along the spatial axis over the whole width of the output. If chosen, other modes are not calculated andpositions
,widths
are not used. Otherwise, the raw mode is used as well as the given mode.
- debug: bool
Debug mode. If
True
, use the python/numpy function_getSpectralFlux
which is slow and allow visual check of the well behaviour of the model fitting. Strongly recommended to load only one block and one frame of data and deactivated the save of the final products. IfFalse
, use the numba function_getSpectralFluxNumba
. For fast and routine use of the measurement of the flux.
Attributes: Creates the following attributes
- raw: ndarray
Estimation of the spectral flux by simply summing
slices
along spatial axis- raw_err:ndarray, deprecated
Estimation of the uncertainty of the estimation of the raw flux.
- amplitude: ndarray
Estimation of the spectral flux as the amplitude of the Gaussian profile fitted by numpy’s linear leastsquare method.
- residuals_reg: ndarray
Residuals from the fit which gives
amplitude
attribute.- amplitude_fit: ndarray
From debug-mode only. Estimation of the spectral flux as the amplitude of the Gaussian profile fitted by the scipy’s curve_fit method, assuming a gaussian profile.
- residuals_fit: ndarray
From debug-mode only. Residuals of the fit performed by the scipy’s curve_fit method
- cov: scalar
From debug-mode only. Covariance estimated by the scipy’s curve_fit method
- amplitude_error: ndarray
Uncertainty of the estimation of
amplitude
-
getTotalFlux
()¶ I keep it otherwise some part of code do not work anymore. It is useless though. This method monitores the flux in one spectral channel (column of pixel 56) for the four photometric outputs.
-
matchSpectralChannels
(wl_to_px_coeff, px_to_wl_coeff)¶ All tracks are slightly shifted respect to each other. Need to define the common wavelength to all of them and create a matching map between the spectral channels of every tracks.
Parameters: - wl_to_px_coeff: ndarray
Polynomial coefficients converting wavelength to pixel position along the spectral axis of the frames.
- px_to_wl_coeff: ndarray
Polynomial coefficients converting pixel position to wavelength along the spectral axis of the frames.
Attributes: Creates the following attributes
- wl_scale: ndarray
Wavelength scale for each output, in nanometer.
- px_scale: ndarray
Wavelength scale for each output, in pixel.
-
save
(path, date)¶ Saves intermediate products for further analyses, into HDF5 file format. The different intensities and null are gathered into dictionaries.
Parameters: - path: str
Path of the file to save. Must contain the name of the file.
- date: str
date of the acquisition of the data (YYYY-MM-DD).
Returns: HDF5 file containing the measured spectral intensities of each output, for each frames, and their uncertainties.
Keywords identifies the nature of the stored data.
- Comments into the file contains the following attributes:
- date: date of the acquisition of the data;
- nbimg: number of frames;
- array shape: shape of the data into the data sets.
-
spectralBinning
(wl_min, wl_max, bandwidth, wl_to_px_coeff)¶ Method for keeping or binning a spectral band. It changes the attributes
pX
,IminusX
,IplusX
(X=1..6),px_scale
andwl_scale
of the object.Parameters: - wl_min: scalar
Lower bound of the bandwidth to keep/bin, in nm
- wl_max: scalar
Upper bound of the bandwidth to keep/bin, in nm
- bandwidth: scalar or None
Width of the spectrum to bin (in nm), should be lower or equal to the difference between wl_min and wl_max. If it is higher, the whole spectrum is binned. If None, the whole band is binned and the average value is taken.
- wl_to_px_coeff: array
Coefficient of conversion from wavelength to pixel position
-
-
glint_classes.
gaussian
(x, A, B, C, loc, sig)¶ Computes a gaussian curve
Parameters: - x: (N,) array
Values for which the gaussian is estimated
- A: float
amplitude of the gaussian curve
- loc: float
center of the curve
- sig: float>0
scale factor of the curve
Returns: The gaussian curve respect to x values