This commit is contained in:
leon
2026-07-06 17:11:25 +08:00
parent f0693cc3d4
commit 98f47be9ff
2 changed files with 11 additions and 11 deletions
+10 -10
View File
@@ -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}") # 记录错误信息
+1 -1
View File
@@ -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}")