modules.continuum_fit
Functions to continuum fit spectra with a spline.
Created by DMK on 11/13/2023
Last updated by DMK on 11/13/2023
Module Contents
Functions
|
Function to fit a spline to a spectrum with sigma rejection. Different sigma rejection levels below and above the fit are allowed (i.e. get rid of absorption lines) |
|
Main script to run for fitting the continuum of science spectra. Fits the continuum with a spline and outputs it to a new FITS extension. |
- modules.continuum_fit.continuum_fit_with_spline(x_values, y_values, x_knot_spacing, lower_sigma_reject, upper_sigma_reject, max_iter=10)
Function to fit a spline to a spectrum with sigma rejection. Different sigma rejection levels below and above the fit are allowed (i.e. get rid of absorption lines) It is assumed that no nans are present in the data provided.
- Parameters:
x_values (array) – Array of x values to fit (independent variable, e.g. wavelength).
y_values (array) – Array of y values to fit (dependent variable, e.g. flux).
x_knot_spacing (float) – The knot spacing for the B spline.
lower_sigma_reject (float) – The sigma level to reject points below the fit.
upper_sigma_reject (float) – The sigma level to reject points above the fit.
max_iter (int, optional) – The maximum number of sigma rejection iterations to perform. The default is 10.
- Returns:
spline_fit – The tuple defining the best fit spline, as output by scipy.interpolate. Elements are (spline knot array, spline coefficient array, spline degree).
- Return type:
tuple
- modules.continuum_fit.fit_spectra_continuum(file_indices, header_df, config)
Main script to run for fitting the continuum of science spectra. Fits the continuum with a spline and outputs it to a new FITS extension.
- 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.