Skip to content

Commit

Permalink
Fix get_calibration. Remove set_last_calibration_time.
Browse files Browse the repository at this point in the history
  • Loading branch information
dboulware committed Mar 22, 2024
1 parent b0e4a04 commit b1764c7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
21 changes: 5 additions & 16 deletions scos_actions/actions/interfaces/measurement_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down Expand Up @@ -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}")
Expand Down
3 changes: 2 additions & 1 deletion scos_actions/hardware/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 0 additions & 5 deletions scos_actions/metadata/sigmf_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit b1764c7

Please sign in to comment.