diff --git a/scos_actions/actions/interfaces/measurement_action.py b/scos_actions/actions/interfaces/measurement_action.py index c5241f84..c52f1724 100644 --- a/scos_actions/actions/interfaces/measurement_action.py +++ b/scos_actions/actions/interfaces/measurement_action.py @@ -51,21 +51,16 @@ def create_capture_segment( ) sensor_cal = self.sensor.sensor_calibration_data # Set calibration metadata if it exists - if ( - sensor_cal is not None - and measurement_result["applied_calibration"] is not None - ): - capture_segment.sensor_calibration = self.get_calibration( - measurement_result - ) + cal_meta = self.get_calibration(measurement_result) + if cal_meta is not None: + capture_segment.sensor_calibration = cal_meta return capture_segment def get_calibration(self, measurement_result: dict) -> ntia_sensor.Calibration: cal_meta = None if ( - self.sensor.sensor_calibration_data - is measurement_result["applied_calibration"] - is not None + self.sensor.sensor_calibration_data is not None + and measurement_result["applied_calibration"] is not None ): cal_meta = ntia_sensor.Calibration( datetime=self.sensor.sensor_calibration_data["datetime"], @@ -120,12 +115,6 @@ def create_metadata( self.sigmf_builder.set_classification(measurement_result["classification"]) except KeyError: logger.warning(warning_str.format("classification")) - try: - self.sigmf_builder.set_last_calibration_time( - measurement_result["calibration_datetime"] - ) - except KeyError: - logger.warning(warning_str.format("calibration_datetime")) try: cap = measurement_result["capture_segment"] logger.debug(f"Adding capture:{cap}") diff --git a/scos_actions/hardware/sensor.py b/scos_actions/hardware/sensor.py index 18adfeaa..6179c421 100644 --- a/scos_actions/hardware/sensor.py +++ b/scos_actions/hardware/sensor.py @@ -363,7 +363,8 @@ def acquire_time_domain_samples( measurement_result["applied_calibration"]["compression_point"] = ( self.sensor_calibration_data["compression_point"] ) - + applied_cal = measurement_result["applied_calibration"] + logger.debug(f"Setting applied_calibration to: {applied_cal}") else: # No sensor calibration exists msg = "Unable to scale samples without sensor calibration data" diff --git a/scos_actions/metadata/sigmf_builder.py b/scos_actions/metadata/sigmf_builder.py index 2ed489e7..1e6106df 100644 --- a/scos_actions/metadata/sigmf_builder.py +++ b/scos_actions/metadata/sigmf_builder.py @@ -426,11 +426,6 @@ def add_annotation(self, start_index, length, annotation_md): start_index=start_index, length=length, metadata=annotation_md ) - def set_last_calibration_time(self, last_cal_time): - self.sigmf_md.set_global_field( - "ntia-sensor:calibration_datetime", last_cal_time - ) - def add_to_global(self, key, value): self.sigmf_md.set_global_field(key, value)