From 98f47be9ff0f917e541696808d83944b9220a153 Mon Sep 17 00:00:00 2001 From: leon Date: Mon, 6 Jul 2026 17:11:25 +0800 Subject: [PATCH] .. --- http_server.py | 20 ++++++++++---------- x_ray_data_processor.py | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/http_server.py b/http_server.py index ce467f0..a0ea085 100644 --- a/http_server.py +++ b/http_server.py @@ -378,7 +378,7 @@ class HttpServerEnhanced(QThread): if channelA is None or channelB is None: print("invalid data packet") return - + if len(channelA) > 100: #gause filter channelA_filtered = gaussian_filter1d(channelA, 0.1) @@ -388,20 +388,20 @@ class HttpServerEnhanced(QThread): #save data to csv file chop_num = 300 - + if ip_address == "192.168.100.236" or msg.get("id","") == "1#SCANNER": dev_name = "Scanner1" - chop_num = 200 + chop_num = 1 elif ip_address == "192.168.100.237" or msg.get("id","") == "2#SCANNER": dev_name = "Scanner2" - chop_num = 200 + chop_num = 1 if direction == "UP": - channelA = channelA[chop_num:-200] - channelB = channelB[chop_num:-200] + channelA = channelA[chop_num:-1] + channelB = channelB[chop_num:-1] elif direction == "DOWN": - channelA = channelA[200:-chop_num] - channelB = channelB[200:-chop_num] + channelA = channelA[1:-chop_num] + channelB = channelB[1:-chop_num] save_filename = f'{time.strftime("%Y%m%d_%H%M%S")}_{dev_name}_{direction}.csv' data_path = self.save_data_to_csv(save_filename, channelA, channelB) @@ -409,7 +409,7 @@ class HttpServerEnhanced(QThread): channelA_average = np.mean(channelA) channelB_average = np.mean(channelB) - #COREECTMODE = False + # COREECTMODE = False corrected_name = None if COREECTMODE and channelA_average > 5000 and channelB_average > 5000: try: @@ -453,7 +453,7 @@ class HttpServerEnhanced(QThread): self.collect_object2['channelA_data'] = base64.b64encode(channelA_bytes).decode('utf-8') self.collect_object2['channelB_data'] = base64.b64encode(channelB_bytes).decode('utf-8') self.send_collect_data.emit(self.collect_object2) - + except OSError as e: print(f"Error handle_data_point: {e}") # 记录错误信息 diff --git a/x_ray_data_processor.py b/x_ray_data_processor.py index e4144a6..affa484 100644 --- a/x_ray_data_processor.py +++ b/x_ray_data_processor.py @@ -321,7 +321,7 @@ class XRayDataProcessor: for ch in ['CH1', 'CH2']: p = self.results[ch]['params_opt'] e = np.sqrt(np.diag(self.results[ch]['params_cov'])) - print(f"\n{ch}通道:") + print(f"\n{ch}通道 {self.pipe_diameter}:") print(f"Q0 = {p[0]:.1f} ± {e[0]:.1f}") print(f"μ = {p[1]:.6f} ± {e[1]:.6f} mm⁻¹") print(f"offset = {p[2]:.1f} ± {e[2]:.1f}")