From 029591327cac8ee6dc029b026d79ba4b4fa591b1 Mon Sep 17 00:00:00 2001 From: Martin Killenberg <martin.killenberg@desy.de> Date: Thu, 17 Aug 2023 09:36:15 +0200 Subject: [PATCH] fix: magnitude window is in dB --- Python_script/prototype.py | 15 +++++++++------ Python_script/test_stand_parameter.json | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Python_script/prototype.py b/Python_script/prototype.py index d7424ba..2095a3a 100755 --- a/Python_script/prototype.py +++ b/Python_script/prototype.py @@ -214,7 +214,7 @@ class Measurements: if len(magnitudes_queue) >= number_of_soaking_reads: magnitudes_queue.pop(0) if self.temperature_stable and self.humidity_stable: - magnitudes_queue.append(self.calculate_mean_magnitude(data.s21)) + magnitudes_queue.append(self.calculate_mean_magnitude_db(data.s21)) else: magnitudes_queue.clear() # check cable stability parameters @@ -261,7 +261,7 @@ class Measurements: data = self.read_data() self.temperature_stable = self.calculate_temperature_stability(target_temp, float(data.temp)) self.humidity_stable = self.calculate_humidity_stability(target_hum, float(data.hum)) - mag = self.calculate_mean_magnitude(data.s21) + mag = self.calculate_mean_magnitude_db(data.s21) phase = self.calculate_mean_phase(data.s21) self.magnitude_stable = (reference_magnitude-self.max_delta_mag <= mag) and\ (mag <= reference_magnitude+self.max_delta_mag) @@ -353,13 +353,13 @@ class Measurements: 'READBACK_TEMP_MEAS_INSTR': float(data.temp_chamber_meas_instr), 'READBACK_HUM_MEAS_INSTR': float(data.hum_chamber_meas_instr), 'S11_PHASE': self.calculate_mean_phase(data.s11), - 'S11_MAGNITUDE': 20*math.log10(self.calculate_mean_magnitude(data.s11)), + 'S11_MAGNITUDE': self.calculate_mean_magnitude_db(data.s11), 'S21_PHASE': self.calculate_mean_phase(data.s21), - 'S21_MAGNITUDE': 20*math.log10(self.calculate_mean_magnitude(data.s21)), + 'S21_MAGNITUDE': self.calculate_mean_magnitude_db(data.s21), 'S12_PHASE': self.calculate_mean_phase(data.s12), - 'S12_MAGNITUDE': 20*math.log10(self.calculate_mean_magnitude(data.s12)), + 'S12_MAGNITUDE': self.calculate_mean_magnitude_db(data.s12), 'S22_PHASE': self.calculate_mean_phase(data.s22), - 'S22_MAGNITUDE': 20*math.log10(self.calculate_mean_magnitude(data.s22)) + 'S22_MAGNITUDE': self.calculate_mean_magnitude_db(data.s22) } self.data_collection.append(measurement) data_frame = pd.DataFrame(self.data_collection) @@ -388,6 +388,9 @@ class Measurements: magnitudes = self.calculate_magnitudes(values_list) return numpy.mean(magnitudes) + def calculate_mean_magnitude_db(self, values_list): + return 20*math.log10(self.calculate_mean_magnitude(values_list)) + def calculate_phases(self, values_list): complex_numbers = self.calculate_complex_numbers(values_list) phases = [math.degrees(cmath.phase(val)) for val in complex_numbers] diff --git a/Python_script/test_stand_parameter.json b/Python_script/test_stand_parameter.json index 2a21622..c32eb2a 100644 --- a/Python_script/test_stand_parameter.json +++ b/Python_script/test_stand_parameter.json @@ -1 +1 @@ -{"delta_temp": 0.1, "delta_hum": 1, "delta_mag": 0.01 , "delta_phase": 1.5, "sleep_time": 10.0, "frequency": 1300000000, "vna_config_file": "CalSetup2.znxml","chamber_ip":"192.168.115.186", "instr_chamber_ip": "192.168.115.187", "vna_ip":"192.168.115.39", "data_folder":"measurements", "logger_ip": "192.168.115.94", "time_unit": "min", "trace_subplot5": "logger_sens", "logger_model": "710"} +{"delta_temp": 0.1, "delta_hum": 1, "delta_mag": 0.13 , "delta_phase": 1.5, "sleep_time": 10.0, "frequency": 1300000000, "vna_config_file": "CalSetup2.znxml","chamber_ip":"192.168.115.186", "instr_chamber_ip": "192.168.115.187", "vna_ip":"192.168.115.39", "data_folder":"measurements", "logger_ip": "192.168.115.94", "time_unit": "min", "trace_subplot5": "logger_sens", "logger_model": "710"} -- GitLab