SBART.Components.SpectrumComponent#
Classes
Allow an SBART object to hold spectral data, providing a common interface for it. |
- class Spectrum#
Bases:
BASE
Allow an SBART object to hold spectral data, providing a common interface for it. The goal of this class is to be a parent of the Frames and the templates (both stellar and telluric).
This class introduces new attributes and methods into the children classes with the goal of proving a unifying framework. Not only does it allow to store the flux information, but it also created a pixel-wise mask to reject “bad” pixels.
For more information we refer to the
Mask
class- __init__(**kwargs)#
- update_uncertainties(new_values)#
Allow to update the uncertainty values, which allows for manual SNR changes
- Parameters:
new_values – Numpy array with the new uncertainties
- Return type:
NoReturn
- regenerate_order_status()#
- check_if_data_correction_enabled(property_name)#
If we attempt to access the correction state from the outside (before opening the S2D arrays), we will get a wrong value (of False), as the corrections are yet to be applied. Thus, we check if the desired property is currently given as a input argument. If it is, return its value, otherwise default to the class property values!
- Return type:
bool
- trigger_data_storage(*args, **kwargs)#
- Return type:
NoReturn
- apply_BERV_correction(BERV_value)#
If it hasn’t been done before, apply the BERV correction to the wavelength solution of this frame.
- Parameters:
BERV_value (
Quantity
) –- Return type:
None
- remove_BERV_correction(BERV_value)#
Remove the BERV correction from a given observation
- Parameters:
BERV_value (
Quantity
) –
- apply_telluric_correction(wavelengths, model, model_uncertainty)#
Divide the spectra by a telluric correction model, without really accounting for model uncertainties. This shouldn’t be used in the current “state” ….
- Parameters:
wavelengths –
model –
model_uncertainty –
- get_BLAZE_function()#
Return the blaze function. If it is not available, attempt to compute it!
- get_data_from_spectral_order(order, include_invalid=False)#
Retrieve a single order from the S2D matrix
- Parameters:
order (int) – Order to retrive
include_invalid (bool) – If False, raise exception when attempting to access data from bad order
- Returns:
np.ndarray – wavelengths
np.ndarray – flux
np.ndarray – uncertainties
np.ndarray – Binary mask of the pixels
- get_data_from_full_spectrum()#
Retrieve the entire spectra. If we are working with S2D data: send the [N_orders, N_pixels] matrix If we are working with S1D data: send a single N_pixels 1-D array with the relevant information
- Returns:
np.ndarray – wavelengths
np.ndarray – Spectra
np.ndarray – Uncertainties
np.ndarray – Spectral mask, a binary mask which is set to one on the pixels to be discarded and zero otherwise.
- scale_spectra(factor)#
- Return type:
NoReturn
- set_frame_as_Zscore()#
Re-defining the frame as one with zero mean and unit-variance (z-score)
- Return type:
NoReturn
- close_arrays()#
Close the arrays that are currently open in memory. Next time we try to access them, the disk file will be re-opened. Saves RAM at the cost of more I/O operations
- Return type:
NoReturn
- property valid_orders#
- property bad_orders: Set[int]#
- Return type:
Set
[int
]
- property OrderStatus#
Return the Status of the entire Frame
- Return type:
OrderStatus
- property OrderWiseStatus: <property object at 0x7fde0deaed10>#
Returns the OrderStatus of the entire observation
- Return type:
OrderStatus
- property spectrum_information#
- property N_orders: int#
returns: Number of orders in the array :rtype: int
- property pixels_per_order: int#
returns: Number of pixels in each order :rtype: int
- property is_open: bool#
returns: True if it has the arrays loaded on memory :rtype: bool