From 322d096d28b593b5a5c0f398397a37d7d57df502 Mon Sep 17 00:00:00 2001 From: Justin Haze Date: Tue, 20 Feb 2024 09:18:44 -0700 Subject: [PATCH] use cal adjust in sea data product action, don't get cal datetime if not cal_adjust, remove debug messages --- scos_actions/actions/acquire_sea_data_product.py | 7 ++++--- scos_actions/actions/acquire_single_freq_fft.py | 2 +- scos_actions/actions/acquire_stepped_freq_tdomain_iq.py | 3 --- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/scos_actions/actions/acquire_sea_data_product.py b/scos_actions/actions/acquire_sea_data_product.py index 7748342c..bb01ffd9 100644 --- a/scos_actions/actions/acquire_sea_data_product.py +++ b/scos_actions/actions/acquire_sea_data_product.py @@ -102,6 +102,7 @@ DURATION_MS = "duration_ms" NUM_SKIP = "nskip" PFP_FRAME_PERIOD_MS = "pfp_frame_period_ms" +CAL_ADJUST = "calibration_adjust" # Constants DATA_TYPE = np.half @@ -161,6 +162,7 @@ def __init__( - 10.0 * np.log10(sample_rate_Hz * fft_size) # PSD scaling + 20.0 * np.log10(window_ecf) # Window energy correction ) + self.cal_adjust = True def run(self, iq: ray.ObjectRef) -> np.ndarray: """ @@ -629,8 +631,7 @@ def capture_iq(self, params: dict) -> dict: cal_adjust = True for key, value in params.items(): logger.debug(f"param {key}={value}") - if "calibration_adjust" in params: - cal_adjust = params["calibration_adjust"] + self.cal_adjust = utils.get_parameter(CAL_ADJUST, params) logger.debug(f"cal_adjust={cal_adjust}") measurement_result = self.sensor.signal_analyzer.acquire_time_domain_samples( num_samples, nskip, cal_adjust=cal_adjust @@ -1134,7 +1135,7 @@ def create_capture_segment( preamp_enable=self.sensor.signal_analyzer.preamp_enable, ), ) - if "sensor_cal" in measurement_result: + if self.cal_adjust: capture_segment.sensor_calibration=ntia_sensor.Calibration( datetime=measurement_result["sensor_cal"]["datetime"], gain=round(measurement_result["sensor_cal"]["gain"], 3), diff --git a/scos_actions/actions/acquire_single_freq_fft.py b/scos_actions/actions/acquire_single_freq_fft.py index 494d6406..7c7d8fd4 100644 --- a/scos_actions/actions/acquire_single_freq_fft.py +++ b/scos_actions/actions/acquire_single_freq_fft.py @@ -177,7 +177,7 @@ def execute(self, schedule_entry: dict, task_id: int) -> dict: # Save measurement results measurement_result["data"] = m4s_result measurement_result.update(self.parameters) - if self.sensor.signal_analyzer.sensor_calibration_data: + if self.cal_adjust: measurement_result[ "calibration_datetime" ] = self.sensor.signal_analyzer.sensor_calibration_data["datetime"] diff --git a/scos_actions/actions/acquire_stepped_freq_tdomain_iq.py b/scos_actions/actions/acquire_stepped_freq_tdomain_iq.py index f115fdf5..495be7e2 100644 --- a/scos_actions/actions/acquire_stepped_freq_tdomain_iq.py +++ b/scos_actions/actions/acquire_stepped_freq_tdomain_iq.py @@ -101,7 +101,6 @@ def __call__(self, sensor: Sensor, schedule_entry: dict, task_id: int): sample_rate = self.sensor.signal_analyzer.sample_rate num_samples = int(sample_rate * duration_ms * 1e-3) measurement_result = super().acquire_data(num_samples, nskip, cal_adjust) - logger.debug("Acquired measurement_result") measurement_result.update(measurement_params) end_time = utils.get_datetime_str_now() measurement_result["end_time"] = end_time @@ -136,9 +135,7 @@ def __call__(self, sensor: Sensor, schedule_entry: dict, task_id: int): ) measurement_result["capture_segment"] = capture_segment - logger.debug("Creating metadata for measurement result") self.create_metadata(measurement_result, recording_id) - logger.debug("sending measurement result to handler") measurement_action_completed.send( sender=self.__class__, task_id=task_id,