RV_cube

RV_cube#

class RV_cube#

Bases: BASE

The RV cube stores the result of a SBART run of a given sub-Instrument.

It is also responsible for:

  • Provide a way of accessing SBART and /or CCF results

  • Apply RV corrections (drift, SA)

  • Store outputs to disk

  • Create plots and (crude) statistical analysis of the RV timeseries.

__init__(subInst, valid_frameIDs, instrument_properties, has_orderwise_rvs, is_SA_corrected, storage_mode, disable_SA_computation=False, invalid_frameIDs=None)#
It contains:
  • the SA correction value (and applies it)

  • THe (single) drift correction (And applies it)

  • The orderwise RVs, errors and Status

  • The final RV and errors (both raw and corrected)

property frameIDs: list[int]#
Return type:

list[int]

load_data_from(other)#

Load the information that is stored in a different RV_cube

Parameters:

other (RV_cube) – [description]

Return type:

None

add_extra_storage_unit(new_unit, generate_root=True)#
set_merged_mode(orders_to_skip)#
Return type:

None

update_skip_reason(orders, skip_reason)#
Return type:

None

ingest_dataClass_from_rolling(DataClassProxy)#
load_data_from_DataClass(DataClassProxy)#
Return type:

None

update_worker_information(worker_info)#
update_computed_precision(expected_precision, eniric_precision, eniric_template)#

Temporary measure to store the expected precision values. To be replaced by the Frame interface!

Parameters:
  • expected_precision ([type]) – [description]

  • eniric_precision ([type]) – [description]

update_computed_RVS(epoch_rv, epoch_error)#
Return type:

None

store_final_RV(frameID, epoch_rv, epoch_error)#
Return type:

None

store_order_data(frameID, order, RV, error, status)#
Return type:

None

add_new_frame(frameID, RVs, errors, status)#
Return type:

None

overwrite_existing_frame(frameID, RVs, errors, status)#
Return type:

None

get_RV_timeseries(which, apply_SA_corr, as_value, units=None, apply_drift_corr=None, include_invalid_frames=False)#

Return the RV timeseries.

Parameters:
  • which (str) – Name of the RV series: TM/previous

  • apply_SA_corr (bool) – Apply the SA correction

  • as_value (bool) – Convert from astropy units to “unitless” variable

  • units (astropy.units, optional) – If not None, convert to this unit. By default None

  • apply_drift_corr ([type], optional) – Force the application of the drift correction to be this var (TRUE/FALSE). This ignores the default settings for the instrument! By default None

Return type:

tuple[list, list, list]

Returns:

  • list (BJD of the observation)

  • list (list of all RVs)

  • list (list of the RV uncertainties)

Raises:
get_RV_from_ID(frameID, which, apply_SA_corr, as_value, units, apply_drift_corr=None)#

Retrieve the BJD, RV and RV_ERR from a given frameID.

Parameters:
  • frameID (int) – frameID

  • which (str) – TM/previous

  • apply_SA_corr (bool) – apply the SA correction

  • as_value (bool) – convert from astropy.units to value

  • units ([type]) – units to convert the original measurements

  • apply_drift_corr ([type], optional) – For the drift correction to be enable/disabled. If None, use the default for the instrument. By default None

Returns:

[description]

Return type:

[type]

compute_SA_correction()#

Compute the SA correction for each point. Returns zeros if the SA correction is disabled

Returns:

list with the SA value for each point

Return type:

list[RV_measurement[meter_second]]

get_storage_unit(storage_name)#
merge_tm_activity_units(name, unit)#
get_raw_TM_RVs()#
Return type:

tuple[list, list]

get_raw_DRS_RVs()#
Return type:

tuple[list, list]

get_TM_activity_indicator(act_name)#

Get the DLW measurements if they exist.Otherwise return array of nans

Parameters:

act_name

Returns:

  • list – Values

  • list – Uncertainties

get_frame_orderwise_status(frameID)#
Return type:

list[Status]

property subInst: str#
Return type:

str

has_data_from_subInst(subInst)#
Return type:

bool

property time_key: str#
Return type:

str

property obs_times: list[float]#

Provide a “time” of observation.

Can either be BJD of MJD (depends on which exists. If both exist,returns the BJD.

Return type:

list[float]

property N_orders: int#
Return type:

int

property N_obs: int#

Return the total number of observations

Return type:

int

property name: str#
Return type:

str

property data#
property problematic_orders: set#
Return type:

set

build_datablock(include_invalid_frames=False)#
Return type:

dict

compute_statistics(savefile=True)#

Compute the scatter and median uncertainty of the different timeseries

Parameters:
  • main_path (str) – Path to the “base” folder of the outputs

  • savefile (bool, optional) – Store to disk if True. By default True

export_skip_reasons(dataClassProxy)#
Return type:

None

export_results(keys, header, dataClassProxy, text=True, rdb=True, append=False, include_invalid_frames=False)#
plot_RVs(dataClassProxy)#

Plot & store the RV timeseries.

Parameters:

storage_path (str) – Main storage path

Return type:

None

export_txt(header, keys, append=False, include_invalid_frames=False)#

Export the data to a text file

Parameters:
  • path (str) – Path in which the file will be created

  • append (bool, optional) – instead of creating a new file, append to a previously existing one, by default False

  • add_to_filename (str, optional) – If it is not None, then add to the beginning of the filename, by default None

  • remove_header (bool, optional) – Avoid creating a header [with the description of each collumn] in the stored file, by default False

  • detailed_table (bool, optional) – write a detailed table with all of the information of the different corrections, by default True

export_rdb(append=False)#
export_complete_rdb()#

Export a complete rdb file.

Return type:

None

run_cromatic_interval_optimization(N_intervals=3, min_number_orders=10)#

Optimize the cromatic intervals using the order-wise RV precision.

Parameters:
  • N_intervals (int, optional) – Number of intervals to optimize. Defaults to 3.

  • min_number_orders (int, optional) – Minimum number of order in each interval. Defaults to 10.

Returns:

tabletexifier.Table with the results if everything went well. Otherwise, defaults to a None

Return type:

Table/None

trigger_data_storage(*args, **kwargs)#
classmethod load_cube_from_disk(subInst_path, load_full_flag=False, load_work_pkgs=False, SBART_version=None)#
add_relative_path(path_name, relative_structure)#
add_to_status(new_flag)#
classmethod config_help()#

Prints a message to terminal, showing all possible configurations and their constraints

classmethod control_parameters()#
property disk_save_enabled: bool#

True if there is any sort of disk savings active.

Return type:

bool

property disk_save_level: DISK_SAVE_MODE#

Return the current disk save level for this object.

Return type:

DISK_SAVE_MODE

generate_root_path(storage_path, no_logs=True)#
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 storage_name: str#
Return type:

str

update_disk_saving_level(level)#

Update the work level of the current object.

Return type:

None

update_work_mode_level(level)#

Update the disk save level.

Return type:

None

property work_mode: WORKING_MODE#

Return the current working mode for this object.

Return type:

WORKING_MODE