fit_data¶
- sofia_redux.instruments.fifi_ls.fit_ramps.fit_data(data, s2n=10, threshold=5, allow_zero_variance=True, average_ramps=True, bad_ramps=None)[source]¶
Applies linear fit (y = ax + b) over the second dimension of a 4D array.
Highly optimized for this particular problem. The flux is determined by the slope of the second dimension (ramps). After collapsing the ramp dimension, multiple ramps are averaged for each spaxel and spexel.
- Parameters:
- datanumpy.ndarray
(ramps/spaxel, ramplength, nwave, nspaxel)
- s2nfloat, optional
Signal-to-noise below which data will be considered questionable and will be ignored. Set <= 0 to turn off signal-to-noise filtering.
- thresholdfloat, optional
Robust rejection threshold (in sigma) for combining slopes of individual ramps.
- allow_zero_variancebool, optional
If True, does not set data points with zero variance to NaN. This option is here to replicate the behaviour of the previous IDL version.
- average_rampsbool, optional
If True, all ramps in the extension are averaged together. This is desirable for all modes except OTF scans.
- bad_rampsnumpy.ndarray, optional
If provided, should be an array of bool, matching the number of ramps/spaxel (data.shape[0]) where True indicates a bad ramp (e.g. due to grating position instability).
- Returns:
- numpy.ndarray, numpy.ndarray
flux and standard deviation arrays of size (spexel, spaxel) or (16, 25) for FIFI-LS.