modules.reduction_utils
Library of miscellaneous functions used in the reduction pipeline for the Tull coude spectrograph
Last updated: DMK, 9/24/2023
Module Contents
Functions
|
|
|
Function to return 1D Gaussian. |
|
Function to perform iterative polynomial fitting based on sigma rejection with the residuals |
- modules.reduction_utils.make_header_manifest(header_manifest_file_name)
- Parameters:
header_manifest_file_name (str) – File name for the output header manifest CSV file.
- Returns:
header_df – The data frame with the header information being written to a CSV file.
- Return type:
pandas DataFrame
- modules.reduction_utils.gaussian_1d(x_values, amplitude, mean, sigma, background)
Function to return 1D Gaussian.
- Parameters:
x_values (array) – Array to evaluate the Gaussian at.
amplitude (float) – Amplitude of the Gaussian (value at mean above the background).
mean (float) – Mean of the Gaussian.
sigma (float) – Standard deviation of the Gaussian.
background (float) – Offset of the Gaussian.
- Returns:
y_values – Array of Gaussian values at input x_values array.
- Return type:
array
- modules.reduction_utils.polynomial_fit_sigma_reject(x_values, y_values, polynomial_degree, num_sigma_cut, num_iterations, y_limits=None, return_data=False)
Function to perform iterative polynomial fitting based on sigma rejection with the residuals
- Parameters:
x_values (array) – Array of x values to fit
y_values (array) – Array of y values to fit
polynomial_degree (int) – Degree of the polynomial to fit
num_sigma_cut (float) – The number of sigma beyond which residuals are rejected
num_iterations (int) – The number of iterations for fitting
y_limits (list, optional) – A list with the lower and upper limits for y data to fit. Default is None.
return_data (bool, optional) – Flag for whether or not to return the x and y data arrays that are included in the final fit. Default is False.
- Returns:
poly_fit (array) – The best fit polynomial coefficients, the output of numpy polyfit
x_values_to_fit (array, optional) – The x values included in the final fit that is output (after the iterative rejection). Returned if return_data is True.
y_data_to_fit (array, optional) – The y values included in the final fit that is output (after the iterative rejection). Returned if return_data is True.