diff --git a/scos_actions/actions/acquire_sea_data_product.py b/scos_actions/actions/acquire_sea_data_product.py index caeb5688..d7b54c99 100644 --- a/scos_actions/actions/acquire_sea_data_product.py +++ b/scos_actions/actions/acquire_sea_data_product.py @@ -425,7 +425,7 @@ def __init__(self, params: dict, iir_sos: np.ndarray): ] del params - def run(self, iqdata: np.ndarray): + def run(self, iqdata: np.ndarray) -> list: """ Filter the input IQ data and concurrently compute FFT, PVT, PFP, and APD results. diff --git a/scos_actions/actions/acquire_single_freq_fft.py b/scos_actions/actions/acquire_single_freq_fft.py index 5859dc3e..d99ba8dd 100644 --- a/scos_actions/actions/acquire_single_freq_fft.py +++ b/scos_actions/actions/acquire_single_freq_fft.py @@ -179,7 +179,9 @@ def execute(self, schedule_entry: dict, task_id: int) -> dict: # Build capture metadata sigan_settings = self.get_sigan_settings(measurement_result) logger.debug(f"sigan settings:{sigan_settings}") - measurement_result["duration_ms"] = int(self.num_samples / sample_rate_Hz) + measurement_result["duration_ms"] = round( + (self.num_samples / sample_rate_Hz) * 1000 + ) measurement_result["center_frequency_Hz"] = self.frequency_Hz measurement_result["capture_segment"] = self.create_capture_segment( sample_start=0, diff --git a/scos_actions/actions/acquire_single_freq_tdomain_iq.py b/scos_actions/actions/acquire_single_freq_tdomain_iq.py index 50d57e78..faa3ece9 100644 --- a/scos_actions/actions/acquire_single_freq_tdomain_iq.py +++ b/scos_actions/actions/acquire_single_freq_tdomain_iq.py @@ -90,9 +90,6 @@ def execute(self, schedule_entry: dict, task_id: int) -> dict: measurement_result.update(self.parameters) measurement_result["end_time"] = end_time measurement_result["task_id"] = task_id - # measurement_result["calibration_datetime"] = ( - # self.sensor.sensor_calibration_data["datetime"] - # ) measurement_result["classification"] = self.classification sigan_settings = self.get_sigan_settings(measurement_result) logger.debug(f"sigan settings:{sigan_settings}") diff --git a/scos_actions/actions/acquire_stepped_freq_tdomain_iq.py b/scos_actions/actions/acquire_stepped_freq_tdomain_iq.py index 199473d3..6fd4c685 100644 --- a/scos_actions/actions/acquire_stepped_freq_tdomain_iq.py +++ b/scos_actions/actions/acquire_stepped_freq_tdomain_iq.py @@ -110,22 +110,9 @@ def __call__(self, sensor: Sensor, schedule_entry: dict, task_id: int): measurement_result["name"] = self.name measurement_result["classification"] = self.classification sigan_settings = self.get_sigan_settings(measurement_result) - capture_segment = CaptureSegment( - sample_start=0, - frequency=measurement_params[FREQUENCY], - datetime=measurement_result["capture_time"], - duration=duration_ms, - overload=measurement_result["overload"], - sigan_settings=sigan_settings, + capture_segment = self.create_capture_segment( + 0, sigan_settings, measurement_result ) - sensor_cal = self.sensor.sensor_calibration_data - if ( - sensor_cal is not None - and measurement_result["applied_calibration"] is not None - ): - capture_segment.sensor_calibration = self.get_calibration( - measurement_result - ) measurement_result["capture_segment"] = capture_segment self.create_metadata(measurement_result, recording_id) diff --git a/scos_actions/actions/calibrate_y_factor.py b/scos_actions/actions/calibrate_y_factor.py index c16d054f..69fc5d5b 100644 --- a/scos_actions/actions/calibrate_y_factor.py +++ b/scos_actions/actions/calibrate_y_factor.py @@ -261,8 +261,6 @@ def __call__(self, sensor: Sensor, schedule_entry: dict, task_id: int): detail += self.calibrate(p) else: detail += os.linesep + self.calibrate(p) - # Save results to onboard calibration file - # self.sensor.sensor_calibration.to_json() return detail def calibrate(self, params: dict): diff --git a/scos_actions/actions/interfaces/measurement_action.py b/scos_actions/actions/interfaces/measurement_action.py index e3081c7f..c5241f84 100644 --- a/scos_actions/actions/interfaces/measurement_action.py +++ b/scos_actions/actions/interfaces/measurement_action.py @@ -43,15 +43,14 @@ def create_capture_segment( ) -> CaptureSegment: capture_segment = CaptureSegment( sample_start=sample_start, - frequency=self.sensor.signal_analyzer.frequency, + frequency=measurement_result["frequency"], datetime=measurement_result["capture_time"], duration=measurement_result["duration_ms"], overload=measurement_result["overload"], sigan_settings=sigan_settings, ) sensor_cal = self.sensor.sensor_calibration_data - # Rename compression point keys if they exist - # then set calibration metadata if it exists + # Set calibration metadata if it exists if ( sensor_cal is not None and measurement_result["applied_calibration"] is not None diff --git a/scos_actions/hardware/sensor.py b/scos_actions/hardware/sensor.py index 8a72ba08..18adfeaa 100644 --- a/scos_actions/hardware/sensor.py +++ b/scos_actions/hardware/sensor.py @@ -262,9 +262,14 @@ def acquire_time_domain_samples( Gain adjustment can be applied to acquired samples using ``cal_adjust``. If ``True``, the samples acquired from the signal analyzer will be - scaled based on the calibrated ``gain`` value in the ``SensorCalibration``, - if one exists for this sensor, and "calibration terminal" will be the value - of the "reference" key in the returned dict. + scaled based on the calibrated ``gain`` and ``loss`` values in + the ``SensorCalibration`` and ``DifferentialCalibration.`` + If no ``DifferentialCalibration`` exists, "calibration terminal" + will be the value of the "reference" key in the + returned dict. If a ``DifferentialCalibration`` exists, the gain and + noise figure will be adjusted with the loss specified in the + ``DifferentialCalibration`` and the "reference" will be set to the + calibration_reference of the ``DifferentialCalibration``. :param num_samples: Number of samples to acquire :param num_samples_skip: Number of samples to skip