modules.radial_velocity

Functions to measure radial velocities from extracted echelle spectra.

Created by DMK on 11/20/2023

Last updated by DMK on 11/22/2023

Module Contents

Functions

make_saphires_ls_file(orders_to_use, data_wavelength, ...)

Function to generate the input ls wavelength file for sahpires broadening function computation.

bootstrap_sample_bf_rvs(bf_tar, bf_tar_spec, num_samples)

Perform bootstrap sampling of combining order by order broadening functions to get a set of RV samples for measuring the star's RV value and error.

make_rv_compiled_excel(file_indices, output_file_name, ...)

Function to read in science frames with RV measurements and output them as a CSV of the night for easy access.

plot_bootstrap_rv_result(bf_tar, bf_tar_spec, bc_vel, ...)

Function to make two-panel plot for the RV bootstrap result. One panel shows the order by order and combined BFs, and one panel shows the histogram of the bootstrap RV samples.

measure_radial_velocity(file_indices, header_df, config)

Main script to run for measuring radial velocities using broadening functions.

modules.radial_velocity.make_saphires_ls_file(orders_to_use, data_wavelength, ls_file_name)

Function to generate the input ls wavelength file for sahpires broadening function computation.

Parameters:
  • orders_to_use (pandas DataFrame) – The data from the file pre-defining which orders and ranges to use for the BF computation. Has columns ‘order’, ‘wave_start’, ‘wave_end’, and ‘flag’.

  • data_wavelength (array) – The data wavelength array.

  • ls_file_name (str) – Name of the ls file.

Return type:

None.

modules.radial_velocity.bootstrap_sample_bf_rvs(bf_tar, bf_tar_spec, num_samples)

Perform bootstrap sampling of combining order by order broadening functions to get a set of RV samples for measuring the star’s RV value and error. This is done by combining different sets of orders with replacement.

Parameters:
  • bf_tar (array) – The array of keys for the saphires tar_spec dictionary. Each key is an order.

  • bf_tar_spec (dict) – The saphires-defined dictionary for each order with broadening function/spectrum information. The result of various saphires functions.

  • num_samples (int) – The number of bootstrap samples to generate.

Returns:

rv_samples – The velocity centroid of the Gaussian fit to each sampled combined BF.

Return type:

array

modules.radial_velocity.make_rv_compiled_excel(file_indices, output_file_name, header_df, config)

Function to read in science frames with RV measurements and output them as a CSV of the night for easy access.

Parameters:
  • file_indices (array) – The file indices (in the header information file) of science observations with extracted spectra to measure RVs for.

  • output_file_name (str) – File name for the output RV compilation CSV.

  • header_df (pandas DataFrame) – The compiled information from the file headers.

  • config (dict) – The overall config file defined using YAML with all parameters for running the reduction and analysis pipeline.

Return type:

None.

modules.radial_velocity.plot_bootstrap_rv_result(bf_tar, bf_tar_spec, bc_vel, rv_samples, file_name)

Function to make two-panel plot for the RV bootstrap result. One panel shows the order by order and combined BFs, and one panel shows the histogram of the bootstrap RV samples.

Parameters:
  • bf_tar (array) – The array of keys for the saphires tar_spec dictionary. Each key is an order.

  • bf_tar_spec (dict) – The saphires-defined dictionary for each order with broadening function/spectrum information. The result of various saphires functions.

  • bc_vel (float) – The barycentric velocity correction (in km/s).

  • rv_samples (array) – The bootstrap RV samples.

  • file_name (str) – File name to save the plot to.

Return type:

None.

modules.radial_velocity.measure_radial_velocity(file_indices, header_df, config)

Main script to run for measuring radial velocities using broadening functions.

Parameters:
  • file_indices (array) – The file indices (in the header information file) of science observations with extracted spectra to measure RVs for.

  • header_df (pandas DataFrame) – The compiled information from the file headers.

  • config (dict) – The overall config file defined using YAML with all parameters for running the reduction and analysis pipeline.

Return type:

None.