padre_meddea.housekeeping.calibration#
Provides functions to calibrate housekeeping data
Functions
|
Given a housekeeping timeseries, calibrate each column. |
|
Create a B-spline interpolation function for converting ADC values to physical values. |
|
Retrieve calibration data for a specific housekeeping parameter. |
|
Given a housekeeping name, return a calibration function to convert from uncalibrated measurements to physical values. |
|
Given a housekeeping name, return the inverse function to convert from physical values to uncalibrated data values. |
|
Given a time series with an error summary column, parse it out to its individual elements. |
- padre_meddea.housekeeping.calibration._get_calibration_func(hk_name: str)[source]#
Given a housekeeping name, return the calibration function to convert from uncalibrated data values to physical values.
- padre_meddea.housekeeping.calibration.calibrate_hk_ts(ts: TimeSeries) TimeSeries[source]#
Given a housekeeping timeseries, calibrate each column. Replaces the values in the columns with calibrated values. Columns with names that are not recognized are ignored. New
- Parameters:
housekeeping_ts – A timeseries or Table of uncalibrated housekeeping measurements
- Returns:
calibrated_ts
- padre_meddea.housekeeping.calibration.fit_bspline(hk_name: str) callable[source]#
Create a B-spline interpolation function for converting ADC values to physical values. This function retrieves calibration data for a specified housekeeping parameter and fits a B-spline interpolation to the ADC-to-value mapping. The returned function can be used to convert raw ADC readings to calibrated physical values with appropriate units.
- Parameters:
hk_name (str) – Name of the housekeeping parameter for which to create the calibration function.
- Returns:
callable – A function that takes ADC values as input and returns the corresponding calibrated physical values as a
u.Quantityobject with appropriate units.
Notes
The returned function handles unit conversion automatically based on the units of the calibration data.
- padre_meddea.housekeeping.calibration.get_calibration_data(hk_name: str) Table[source]#
Retrieve calibration data for a specific housekeeping parameter. This function reads calibration data from a CSV file named after the housekeeping parameter and returns it as an astropy QTable with ADC values and corresponding physical values with appropriate units.
- Parameters:
hk_name (str) – Name of the housekeeping parameter for which to retrieve calibration data. This will be used to find the corresponding CSV file.
- Returns:
astropy.table.Table – A table containing the calibration data with columns: - ‘adc’: ADC values (raw digital counts) - ‘value’: Physical values with appropriate units
Notes
The calibration CSV file is expected to have at least two columns: one named ‘adc’ and another column whose name represents the physical unit.
- padre_meddea.housekeeping.calibration.get_calibration_func(hk_name: str) callable[source]#
Given a housekeeping name, return a calibration function to convert from uncalibrated measurements to physical values.
- Parameters:
hk_name (str)
- Returns:
f (callable that returns physical quantities)
- padre_meddea.housekeeping.calibration.inverse_calibrate(hk_name: str, x: Quantity) float[source]#
Given a housekeeping name, return the inverse function to convert from physical values to uncalibrated data values.
- Parameters:
hk_name – The housekeeping name
x – The physical value
- Returns:
adc – The ADC value that converts into the given physical value.
- padre_meddea.housekeeping.calibration.parse_error_summary(hk_ts: TimeSeries) TimeSeries[source]#
Given a time series with an error summary column, parse it out to its individual elements.
- Parameters:
hk_ts (TimeSeries)
- Returns:
error_summary_ts (TimeSeries)