SBART.template_creation.stellar_templates.Stellar_Template#
Classes
This object is the parent class of all StellarTemplates, implementing a common set of user configurations, data storage operations, among others. |
- class StellarTemplate#
Bases:
BaseTemplate
,Spectral_Modelling
This object is the parent class of all StellarTemplates, implementing a common set of user configurations, data storage operations, among others.
User parameters:
Parameter name
Mandatory
Default Value
Valid Values
Comment
NUMBER_WORKERS
False
1
Integer >= 0
[2]
MEMORY_SAVE_MODE
False
False
boolean
[3]
MINIMUM_NUMBER_OBS
False
3
Integer >= 0
[4]
[1] - How to propagate the spectral uncertainties [2] - Number of jobs at once [3] - Save RAM by clearing the frame’s S2D arrays from memory after using them [4] - Minimum number of valid observations needed to proceed with template creation
Note
This class also uses the User parameters defined by the
Spectral_Modelling
class
Note
Also check the User parameters of the parent classes for further customization options of SBART
- template_type = 'Stellar'#
- method_name = 'Base'#
- __init__(subInst, user_configs=None, loaded=False)#
- Parameters:
subInst (
str
) – sub-Instrument for which the template is going to be createduser_configs (
Optional
[dict
]) – Dictionary with the keys and values of the user parameters that have been described aboveloaded (
bool
) – True if the template was loaded from disk.
- create_stellar_template(dataClass, conditions)#
Trigger the start of the creatoin of the stellar template
- Parameters:
dataClass (
DataClass
) – Dataconditions (
spectral_conditions
) – Apply conditions over the frames that will be used to create the stellar template
- Raises:
StopComputationError – If the computations is triggered by some event
- Return type:
None
- add_new_frame_to_template(frame)#
Allow to inject a new observation into a pre-existing model. This base function checks for a match on the different flux corrections and ensures that the loaded Flag is set to False, so that it is possible to update the disk products afterwards.
- Parameters:
frame (Frame) – A new frame to inject into the stellar template
- Raises:
custom_exceptions.InvalidConfiguration: – If the flux corrections of the Frame do not match those from the stellar template
- evaluate_bad_orders()#
- Return type:
None
- check_if_used_frameID(frameID)#
- Parameters:
frameID (
int
) – ID of a given observations- Returns:
used – True if the frame was used for the construction of the template
- Return type:
bool
- trigger_data_storage(clobber)#
Check for validity of the template and, afterwards, trigger the data storage routine
- Parameters:
clobber – If True, delete old disk files before attempting to store the new ones.
- Raises:
FailedStorage – If the template was either loaded or not created
- Return type:
NoReturn
- store_template(clobber)#
Handle deletion of old disk files + apply checks to see if we want to store data to disk
- Parameters:
clobber (
bool
) –- Raises:
FailedStorage – If we attempt to remove the previous version of the template and it was not found on disk. TODO: is this a good idea? I would bet that it isn’t…..
- Return type:
None
- store_metrics()#
- load_from_file(root_path, loading_path)#
Interface to load a template from disk
TODO: we don’t really need the loading path… the root_path is enough for what we want to do…
- Parameters:
root_path – Root path for the template
loading_path (
str
) – Path to the actual template
- Raises:
NoDataError – If we attempt to load from a path that does not exist
- Return type:
None
- Return type:
None
- property storage_name: str#
Return the storage name for the stellar templates, which will include the name of the method, the RV source for the aligmenet
- Return type:
str
- interpolate_spectrum_to_wavelength(order, new_wavelengths, shift_RV_by, RV_shift_mode, remove_OB=None, include_invalid=False)#
Override of the interpolation algorithm to allow the rejection of OBs :param order: :param new_wavelengths: :param shift_RV_by: :param RV_shift_mode: :type remove_OB:
Optional
[Frame
] :param remove_OB: :param include_invalid:
- property iteration_number: int#
- Return type:
int
- update_RV_source_info(iteration_number, RV_source, merged_source)#
- property RV_keyword#