DataClass#
- class DataClass#
Bases:
BASE
The user-facing object that handles the loading and data access to the spectral data, independently of the instrument. Furthermore, this must be launched as a proxyObject (insert docs here) in order to avoid problems with data syncronization and optimize the speed of the code.
- To use this class in SBART RV extraction routines, we place it in shared memory, allowing all processes to easily access
it. This is done with a proxyObject.
SBART already provides a DataClass object that is wrapped by a proxyObject:
from SBART.data_objects import DataClassManager manager = DataClassManager() manager.start() data_object = manager.DataClass(*args, **kwargs)
This data_object has all the functions that the DataClass object implements!
- __init__(input_files, storage_path, instrument, instrument_options, reject_subInstruments=None, target_name=None, sigma_clip_RVs=None)#
- Parameters:
input_files (
Iterable
[Union
[str
,Path
]]) – Either a path to a txt file, or a list of S2d filesstorage_path (
Union
[str
,Path
]) – Root path of the SBART outputsinstrument (
Type
[Frame
]) – Instrument that we will be loading data from. Must be an object of type SBART.Instrumentsinstrument_options (
dict
) –reject_subInstruments (
Optional
[Iterable
[str
]]) – Iterable with names of subInstruments to automatically rejecttarget_name (
Optional
[str
]) – Original name of the target. To be deprecatedsigma_clip_RVs (
Optional
[float
]) – If it is a positive integer, reject frames with a sigma clip on the DRS RVs
- load_previous_SBART_results(LoadingPath_previousRun, use_merged_cube=False)#
Load the results from a previous application of SBART, storing the RV and uncertainty inside the corresponding Frame object
- Parameters:
LoadingPath_previousRun (
Union
[str
,Path
]) –use_merged_cube (
bool
) –
- Raises:
SBART.utils.custom_exceptions.InvalidConfiguration – If the loaded data uses a different frameID scheme than the one currently in use or if we couldn’t find the RV outputs on disk
- reject_order_region_from_frame(frameID, order, region)#
- remove_activity_lines(lines)#
Find the wavelength windows in which activity-related lines are expected to appear, for all valid observations
- Parameters:
lines (Indicators) – Object with the wavelength blocks “original” positions.
TODO (#) –
- Return type:
None
- remove_telluric_features(Telluric_Template)#
- Return type:
None
- replace_frames_with_S2D_version(new_shape=None)#
In-place substitution of all frames with their S2D-compatible shapes!
- ingest_StellarModel(Stellar_Model)#
- Return type:
None
- select_common_wavelengths(wave_analysis_path, subInst)#
- reject_observations(conditions)#
Apply the conditions to evaluate if the VALID frame meets the specified conditions or not!
- Parameters:
conditions (
ConditionModel
) – Conditions set by the user- Return type:
None
- load_frame_by_ID(frameID)#
- Return type:
int
- set_all_as_Zscore_frames()#
- Return type:
NoReturn
- normalize_all()#
Launch the normalization for all (valid) frames
- Return type:
NoReturn
- update_uncertainties_of_frame(frameID, new_uncerts)#
Update the flux uncertainties of a given frame
Warning
This will change your measured data, be careful with this!!!
- Return type:
NoReturn
- normalize_all_from_subInst(subInst)#
Normalizing all (valid) frames from a given subInstrument :type subInst:
str
:param subInst:- Return type:
NoReturn
- scale_up_all_observations(factor)#
Multiply the flux and uncertainties by a given flux level (avoid possible SNR issues) :type factor:
float
:param factor:- Return type:
NoReturn
- load_all_from_subInst(subInst)#
Load all valid frames from a given subInstrument
- Parameters:
subInst (str) – subInstrument name
- Returns:
[description]
- Return type:
int
- close_frame_by_ID(frameID)#
- Return type:
int
- min_pixel_in_order()#
- Return type:
int
- get_subInst_from_frameID(frameID)#
- Return type:
str
- get_frame_OBS_order(frameID, order, include_invalid=False)#
Request the data from one spectral order.
- Parameters:
frameID (
int
) – FrameID of the observationorder (
int
) – NUmber of orderinclude_invalid (
bool
) – Orders can also be flagged as “invalid”. If False, the frame will raise an error when requesting the data
- update_interpol_properties_of_all_frames(new_properties)#
- update_interpol_properties_of_stellar_model(new_properties)#
- update_frame_interpol_properties(frameID, new_properties)#
Allow to update the interpolation settings from the outside, so that any object can configure the interpolation as it wishes
- Return type:
NoReturn
- interpolate_frame_order(frameID, order, new_wavelengths, shift_RV_by, RV_shift_mode, include_invalid=False)#
Interpolate a given order to a new wavelength solution
- get_frame_arrays_by_ID(frameID)#
Access data from the entire spectral range (i.e. all orders come as a matrix) :type frameID:
int
:param frameID:
- get_KW_from_frameID(KW, frameID)#
- get_filename_from_frameID(frameID, full_path=False)#
- Return type:
str
- get_status_by_frameID(frameID)#
- Return type:
Status
- collect_KW_observations(KW, subInstruments, include_invalid=False, conditions=None, return_frameIDs=False)#
Parse through the loaded observations and retrieve a specific KW from all of them. There is no sort of the files. The output will follow the order of the files loaded in memory!
- Parameters:
return_frameIDs (
bool
) –KW (str) – KW from the Frame.observation_info dictionary
subInstruments (Union[tuple, list]) – List of the subInstruments for which we want to retrieve the KW. If there are multiple entries, the output will follow the order of this list
include_invalid (bool, optional) – If True, also retrieve the KWs of Frames deemed to not be valid. By default False
- Returns:
List of the KW
- Return type:
list
- collect_RV_information(KW, subInst, frameIDs=None, include_invalid=False, units=None, as_value=True)#
Return the RV measurements (or BERV) from the observations of a given sub-Instrument
- Parameters:
KW (KW to request) – previousRV, previousRV_ERR or BERV
subInst (str) – Name of the sub-Instrument
frameIDs (None | list) – If not None, retrive only for the frameIDs inside the list. If they are not from subInst, an exception will be raised
include_invalid (bool, optional) – Include invalid observations, by default False
units ([type], optional) – units to convert the measurements, by default None
as_value (bool, optional) – provide a value instead of “units”, by default True
- Returns:
[description]
- Return type:
list
- Raises:
InvalidConfiguration – [description]
- get_valid_frameIDS()#
Get list of all available frame IDs (across all subInstruments)
- Returns:
[description]
- Return type:
list
- get_frameIDs_from_subInst(subInstrument, include_invalid=False)#
Get all frameIDs associated with a given instrument. By default, only returns the valid ones
- Parameters:
subInstrument (str) – SubInstrument name
include_invalid (bool, optional) – If True, also return IDs associated with the invalid frames, by default False
- Returns:
[description]
- Return type:
list
- get_frame_by_ID(frameID)#
Return the frame object that is associated with a given ID
- Parameters:
frameID (
int
) –- Return type:
- get_subInstruments_with_valid_frames()#
Find all subInstruments that have at least one valid observation
- Returns:
SubInstruments that have at least one valid observation
- Return type:
list
- get_available_subInstruments()#
- Return type:
list
- get_instrument_information()#
- Return type:
dict
- get_stellar_template(subInst)#
- get_stellar_model()#
- Return type:
- get_internalPaths()#
- trigger_data_storage()#
- Return type:
None
- generate_root_path(storage_path)#
Triggers the parent routine and also generates the root path for the Frames
- Parameters:
storage_path (
Path
) –- Return type:
NoReturn
- has_instrument_data(instrument)#
Check if the first loaded frame is of a given Instrument
Warning
in the off-chance that we mix data this will give problems…
- Return type:
bool
- show_loadedData_table()#
Compute the number of observations available in each subInstrument. Find the number of valid ( with and without warnings) and the invalid ones!
- Return type:
Table
- load_instrument_extra_information()#
See if the given instrument is one of the ones that has extra information to load. If so, then
- load_CARMENES_extra_information()#
CARMENES pipeline does not give RVs, we have to do an external load of the information
- Parameters:
shaq_folder (str) – Path to the main folder of shaq-outputs. where all the KOBE-*** targets live
- Return type:
None
- add_relative_path(path_name, relative_structure)#
- add_to_status(new_flag)#
- Return type:
NoReturn
- classmethod config_help()#
Prints a message to terminal, showing all possible configurations and their constraints
- classmethod control_parameters()#
- is_object_type(type_to_check)#
Check if this object is of a given type
- Parameters:
type_to_check (
str
) –- Return type:
bool
- property is_valid: bool#
- Return type:
bool
- json_ready()#
Concerts the current class into a json entry that can be easily saved/loaded to/from disk
- Return type:
Dict
[str
,Any
]
- load_from_file(root_path, loading_path)#
- Return type:
None
- property name: str#
- Return type:
str
- property storage_name: str#
- Return type:
str