diff --git a/scos_actions/calibration/differential_calibration.py b/scos_actions/calibration/differential_calibration.py index ac518737..de877f8a 100644 --- a/scos_actions/calibration/differential_calibration.py +++ b/scos_actions/calibration/differential_calibration.py @@ -1,19 +1,3 @@ -""" -Dataclass implementation for "differential calibration" handling. - -A differential calibration provides loss values which represent excess loss -between the ``SensorCalibration.calibration_reference`` reference point and -another reference point. A typical usage would be for calibrating out measured -cable losses which exist between the antenna and the Y-factor calibration terminal. -At present, this is measured manually using a calibration probe consisting of a -calibrated noise source and a programmable attenuator. - -The ``DifferentialCalibration.calibration_data`` entries should be dictionaries -containing the key ``"loss"`` and a corresponding value in decibels (dB). A positive -value of ``"loss"`` indicates a LOSS going FROM ``DifferentialCalibration.calibration_reference`` -TO ``SensorCalibration.calibration_reference``. -""" - from dataclasses import dataclass from scos_actions.calibration.interfaces.calibration import Calibration @@ -21,6 +5,22 @@ @dataclass class DifferentialCalibration(Calibration): + """ + Dataclass implementation for "differential calibration" handling. + + A differential calibration provides loss values which represent excess loss + between the ``SensorCalibration.calibration_reference`` reference point and + another reference point. A typical usage would be for calibrating out measured + cable losses which exist between the antenna and the Y-factor calibration terminal. + At present, this is measured manually using a calibration probe consisting of a + calibrated noise source and a programmable attenuator. + + The ``DifferentialCalibration.calibration_data`` entries should be dictionaries + containing the key ``"loss"`` and a corresponding value in decibels (dB). A positive + value of ``"loss"`` indicates a LOSS going FROM ``DifferentialCalibration.calibration_reference`` + TO ``SensorCalibration.calibration_reference``. + """ + def update(self): """ SCOS Sensor should not update differential calibration files. diff --git a/scos_actions/calibration/interfaces/calibration.py b/scos_actions/calibration/interfaces/calibration.py index d89e1c50..70968ea6 100644 --- a/scos_actions/calibration/interfaces/calibration.py +++ b/scos_actions/calibration/interfaces/calibration.py @@ -1,7 +1,3 @@ -""" -TODO -""" - import dataclasses import json import logging @@ -19,6 +15,19 @@ @dataclasses.dataclass class Calibration: + """ + Base class to handle calibrated gains, noise figures, compression points, and losses. + The calibration_parameters defined the settings used to perform calibrations and the + order in which calibrations may be accessed in the calibration_data dictionary. + For example, if calibration_parameters where [frequency, sample_rate] then the + calibration for a particular frequency and sample rate would be accessed in + the calibration_data dictionary by the string value of the frequency and + sample rate, like calibration_data["3555000000.0"]["14000000.0"]. The + calibration_reference indicates the reference point for the calibration, e.d., + antenna terminal, or noise source output. The file_path determines where + updates (if allowed) will be saved. + """ + calibration_parameters: List[str] calibration_data: dict calibration_reference: str diff --git a/scos_actions/calibration/sensor_calibration.py b/scos_actions/calibration/sensor_calibration.py index 3224331e..90f32b7c 100644 --- a/scos_actions/calibration/sensor_calibration.py +++ b/scos_actions/calibration/sensor_calibration.py @@ -1,7 +1,3 @@ -""" -TODO -""" - import logging from dataclasses import dataclass from datetime import datetime @@ -18,6 +14,16 @@ @dataclass class SensorCalibration(Calibration): + """ + Extends the ``Calibration`` class to represent calibration + data that may be updated. Within scos-senso,``SensorCalibration`` + instances are used to handle calibration files generated prior + to deployment through a lab-based calibration as well as the result + of calibrations that are performed by the sensor in the field. This + class provides an implementation fo the update method to allow calibration + data to be updated with new values. + """ + last_calibration_datetime: str clock_rate_lookup_by_sample_rate: List[Dict[str, float]] sensor_uid: str @@ -41,8 +47,8 @@ def update( Update the calibration data by overwriting or adding an entry. This updates the instance variables of the ``SensorCalibration`` - object and additionally writes these changes to the specified - output file. + object and additionally writes these changes to file specified + by the instance's file_path property. :param params: Parameters used for calibration. This must include entries for all of the ``Calibration.calibration_parameters`` @@ -52,7 +58,6 @@ def update( :param gain_dB: Gain value from calibration, in dB. :param noise_figure_dB: Noise figure value for calibration, in dB. :param temp_degC: Temperature at calibration time, in degrees Celsius. - :param file_path: File path for saving the updated calibration data. """ logger.debug(f"Updating calibration file for params {params}") try: