diff --git a/Python_script/climate-lab-gui.py b/Python_script/climate-lab-gui.py index b9f302b250bad77a6d08f50171268d1c439a59c5..73a0d9a9c2e9422cba40ce386eab1ad2d0ef07e8 100755 --- a/Python_script/climate-lab-gui.py +++ b/Python_script/climate-lab-gui.py @@ -115,7 +115,7 @@ class TestStandMainWindow(QMainWindow): self.stepParameter.value(), self.fixedParameter.value(), self.soakingTime.value(), self.stableReads.value(), self.get_analysis_config(time_string), os.path.join(self.start_dir, self.measurementFile.text()), error_queue, config_data, - ext_sensor_channels)) + ext_sensor_channels, process_sync.stop_measurement)) p.start() while p.is_alive(): @@ -135,7 +135,8 @@ class TestStandMainWindow(QMainWindow): @staticmethod def do_measurement_impl(measurement_type, output_basename, start_parameter, stop_parameter, step_parameter, fixed_parameter, soaking_time, stable_reads, analysis_config, measurement_file, error_queue, - config_data, ext_sensor_channels): + config_data, ext_sensor_channels, stop_measurement_event): + process_sync.stop_measurement = stop_measurement_event meas = None try: diff --git a/Python_script/prototype.py b/Python_script/prototype.py index 675cf36b4dc5014b27cfe6922ec0cf92367ee468..f5fddd0b1a254101b4298526d8e985e72a1acc20 100755 --- a/Python_script/prototype.py +++ b/Python_script/prototype.py @@ -178,14 +178,18 @@ class Measurements: process_sync.stop_measurement.clear() ctx = mp.get_context('spawn') measurement_process = ctx.Process(target=self.perform_single_measurement_impl, - args=(output, target_temp, target_hum, soaking_time, n_stable_reads)) + args=(output, target_temp, target_hum, soaking_time, n_stable_reads, + process_sync.stop_measurement)) measurement_process.start() # turn interactive plotting (back) on (is deactivated by starting the process) plt.ion() self.measurement_plot.drawing_loop() measurement_process.join() - def perform_single_measurement_impl(self, output, target_temp, target_hum, soaking_time, n_stable_reads): + def perform_single_measurement_impl(self, output, target_temp, target_hum, soaking_time, n_stable_reads, + stop_measurement): + + with open(output, mode='w', newline='') as csv_file: fieldnames = ['TIMESTAMP', 'TARGET_TEMPERATURE', 'READBACK_TEMPERATURE', 'TARGET_HUMIDITY', 'READBACK_HUMIDITY', 'DUT_IDENTIFIER', 'RUN_ID', 'EQUILIBRIUM_INDICATOR', 'TEMP_HEATER', @@ -215,7 +219,7 @@ class Measurements: dut_signal_queues = [[], []] while True: - if process_sync.stop_measurement.is_set(): + if stop_measurement.is_set(): do_another_measurement = False break @@ -278,7 +282,7 @@ class Measurements: all_measurements_stable = True for i in range(0, n_stable_reads): - if process_sync.stop_measurement.is_set(): + if stop_measurement.is_set(): all_measurements_stable = False #not enough stable reads yet do_another_measurement = False break