Preprocessing
This module has preprocessing functions such as frame binning, frame sorting, list chunking.
Still work in progress.
- preprocessing.binning(arr, binning, axis=0, avg=False)
Bin elements together.
Parameters
- arrnd-array
Array containing data to bin.
- binningint
Number of frames to bin.
- axisint, optional
Axis along which the frames are binned. The default is 0.
- avgbool, optional
if
True
, the method returns the average of the binned frame. Otherwise, return its sum. The default is False.
Returns
- arrnd-array
Binned array.
- cropped_idxarray
Index of the kept frames.
- preprocessing.divide_chunks(l, n)
Yield successive n-sized chunks from l.
Parameters
- lint
Size of the list to chunk.
- nint
Size of a chunk of the list.
Yields
- yield
Generator of the chunks.
- preprocessing.get_injection_and_spectrum(photoA, photoB, wl_scale, wl_bounds)
Get the distributions of the broadband injections and the spectra of beams A and B.
Parameters
- photoAarray-like
Values of the photometric output of beam A.
- photoBarray-like
Values of the photometric output of beam B.
- wl_scalearray-like
Wavelength of the spectra in nm.
- wl_bounds2-tuple, optional
Boundaries between which the spectra are extracted. The wavelengths are expressed in nm.
Returns
- 2-tuple of 2d-array
The first element contains the broadband injection of beams A and B, respectively. The second element contains the spectra of beams A and B, respectively.
- preprocessing.sortFrames(dic_data, kw_list, nb_frames_to_bin, quantile, factor_minus, factor_plus, which_null, starname, plot=False, save_path='')
Perform sigmal-clipping to remove frames non-normally distributed phase fluctuations.
Sigma-clipping to filter the frames which phase is not Gaussian (e.g. because of LWE). Fluxes of the null and antinull outputs are analysed in two steps. In the first step, for a given output, values between two thresholds are kept. The base is the upper bound for the antinull output or the lower bound for the null output. The base is defined as the median of the measurements which lower than the quantile (typically 10%) of the total sample in the null output, and upper for the antinull output. The second threshold is defined as the base plus or minus the standard deviation of the global sample wieghted by a coefficient. In the second step, frames for which both fluxes are kept are saved, the others are discarded.
Parameters
- dic_datadict
Contains the extracted data from files by the function
load_data
.- kw_list: list-like of two elements
The 2 keywords of the data from dic_data to use.
- nb_frames_to_binint
Number of frames to bin before applying the filter. It is used to increase the SNR and exhibit the phase noise over the detector noise.
- quantilefloat between 0 and 1
First quantile taken to determine the base threshold.
- factor_minusfloat
Factor applied to the std of the null flux to determine the second threshold.
- factor_plusfloat
Factor applied to the std of the antinull flux to determine the second threshold.
- which_nullstring
Indicates on which baseline the filter is applied.
- starnamestring
Name of the star.
- plotbool, optional
If
True
, it displays the time serie of the binned frames, the thresholds and highlights the filtered frames. The default is False. The default is False.- save_pathstring, optional
Path where the plots is saved in png format (dpi = 150). The default is ‘’.
Returns
- new_dicdict
New dictionary with only the saved data points.
- idx_good_framesarray
Index of the kept frames in the input dictionary.
- intensities: 2-tuple
Arrays of fluxes in null and anti-null outputs.