From 5a010ac7a464a380b8278b49c1cdcc1fb7c47ee3 Mon Sep 17 00:00:00 2001 From: "dboulware@ntia.doc.gov" Date: Tue, 15 Oct 2024 13:59:21 -0600 Subject: [PATCH] Don't update calibration if NAN for gain or noise figure. --- scos_actions/actions/calibrate_y_factor.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scos_actions/actions/calibrate_y_factor.py b/scos_actions/actions/calibrate_y_factor.py index c8ca666b..83871127 100644 --- a/scos_actions/actions/calibrate_y_factor.py +++ b/scos_actions/actions/calibrate_y_factor.py @@ -346,11 +346,13 @@ def calibrate(self, params: dict): pwr_on_watts, pwr_off_watts, enr_linear, enbw_hz, temp_k ) - # Update sensor calibration with results - self.sensor.sensor_calibration.update( - sigan_params, utils.get_datetime_str_now(), gain, noise_figure, temp_c - ) - + if not np.isnan(gain) and not np.isnan(noise_figure): + # Update sensor calibration with results + self.sensor.sensor_calibration.update( + sigan_params, utils.get_datetime_str_now(), gain, noise_figure, temp_c + ) + else: + logger.warn(f"Not updating calibration. NF: {noise_figure}, Gain: {gain}") # Debugging noise_floor_dBm = convert_watts_to_dBm(Boltzmann * temp_k * enbw_hz) logger.debug(f"Noise floor: {noise_floor_dBm:.2f} dBm")