Barycentric Correction Algorithm
- class modules.barycentric_correction.src.alg_barycentric_corr.BarycentricCorrectionAlg(obs_config, config=None, logger=None, logger_name=None)[source]
Barycentric velocity correction.
This module defines class ‘BarycentricCorrectionAlg’ and methods to calculate barycentric velocity correction and redshift for one single time point or a period of days.
- Parameters:
obs_config (dict|configparser.ConfigParser|None) – A dict instance or config context containing the key-value pairs related to the observation configuration for barycentric correction calculation.
logger (logging.Logger) – Instance of logging.Logger passed from external application.
logger_name (str, optional) – Selection of logger by the specified logger name. Defaults to None. Either the defined logger_name or the class name determines the logging.Logger instance for organizing the loggers.
- zb_range
An array containing minimum and maximum redshift value over a period of days.
- Type:
numpy.ndarray
- zb_list
Array of redshift values over a period of days.
- Type:
numpy.ndarray
- obs_config
A dict instance storing key-value pairs related to observation configuration. The key list includes the name as the constants defined in class, i.e. RA, DEC, PMRA, PMDEC, PX, RV, LAT, LON, ALT and SPEC.
- Type:
Note
The following constants define the properties included in the dict instance used for barycentric velocity correction or redshift calculation, i.e.
get_zb_long()andget_zb_from_bc_corr()- ALT = 'obsalt'
altitude of the observatory (meter)
- DEC = 'dec'
DEC J2000 of the target (degrees)
- EPOCH = 'epoch'
epoch in julian date
- LAT = 'obslat'
latitude of the observatory, North (+ve) and South (-ve) (degree)
- LON = 'obslon'
longitude of the observatory, East (+ve) and West (-ve) (degree)
- PMDEC = 'pmdec'
proper motion in DEC (mas/yr)
- PMRA = 'pmra'
proper motion in RA (mas/yr)
- PX = 'parallax'
parallax of the target (mas)
- RA = 'ra'
RA J2000 of the target (hours)
- RV = 'star_rv'
star radial velocity estimation (km/s)
- SPEC = 'instrument'
Observation instrument
- STARNAME = 'starname'
star name
- static find_existing_zb_file(ins, start_jd, days_period, target, data_path)[source]
Compose the file path storing the redshift values from barycentric correction over a period of days.
- Parameters:
ins (str) – Observation instrument.
start_jd (float) – Start day in Julian Date format.
days_period (int) – Total days.
target (str) – star name.
data_path (str) – Path of the data file. Defaults to None, meaning a default path based on the setting of start_jd, days_period and instrument under KPF data test directory is applied.
- Returns:
Data path. The default path is like ‘./+default_bc_file’ bc_corr_<start_jd>_<days_period>_<instrument>.csv*
- Return type:
- static get_bc_corr_period(obs_config, start_jd, days_period=None)[source]
Compute redshift values from barycentric velocity correction over a period of days.
- Parameters:
- Returns:
redshift from barycentric velocity correction for a period of days.
- Return type:
numpy.ndarray
- static get_zb_from_bc_corr(obs_config, start_jd, days_period=None, data_path=None, save_to_path=None)[source]
- Find the BC values for a period of days or a single day by calling Barycentric velocity correction function
or from an existing file and store the result to the specified file if there is.
- Parameters:
obs_config (dict) – A dict instance containing observation configuration.
start_jd (float) – Starting time point in Julian Date format.
days_period (int, optional) – Period of days for Barycentric correction calculation. Defaults to None. If the value is None or 1, it means the redshift of a single time point is computed, or a list of redshift values over a time period is either computed or accessed from a file as specified by data_path.
data_path (str, optional) – Path of the data file. Defaults to None for a default path per settings of jd, period, instrument and KPF data test directory.
save_to_path (str, optional) – Path of the output file. Defaults to None for no output.
- Returns:
An array of BC values (m/sec) over the specified period or a single time point.
- Return type:
numpy.ndarray
- get_zb_list(jd, period, data_path=None, save_to_path=None)[source]
Get redshift values over the period.
- Parameters:
- Returns:
redshift values over the period.
- Return type:
- get_zb_long(jd, period, data_path=None, save_to_path=None)[source]
Get minimum and maximum redshift over a period of time.
- Parameters:
jd (float) – Starting day in Julian Date format.
period (int) – Period of days.
data_path (str, optional) – The path of the file containing predefined redshift values over a period of days. It could be a path to a file or a directory. Defaults to None for a default path based on the setting of jd, period, instrument name and KPF data test directory.
save_to_path ((str, optional) – The path of the output file for the result. Defaults to None, meaning no output file created. It could be a path to a file or a directory.
- Returns:
Minimum and maximum redshift values during the period starting from jd. The first element in the array is the minimum and the second one is the maximum.
- Return type:
numpy.ndarray