From bb92563de2f9132e0223d372f32c4d00197cc9ed Mon Sep 17 00:00:00 2001 From: fengbh <1953356163@qq.com> Date: Mon, 15 Jan 2024 21:59:32 +0800 Subject: [PATCH] add filter --- process.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/process.py b/process.py index f339251..2601502 100644 --- a/process.py +++ b/process.py @@ -7,7 +7,7 @@ from pylab import mpl mpl.rcParams["font.sans-serif"] = ["SimHei"] # 初始化一个起始日期(这里假设是今天凌晨0点) -start_date = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0) +start_date = datetime.now().replace(hour=20, minute=21, second=0, microsecond=0) with open('minicom.cap', 'r') as file: lines = file.readlines() @@ -21,8 +21,9 @@ for line in lines: timedelta(minutes=int(time_str.split(':')[1])) + \ timedelta(hours=int(time_str.split(':')[0])) temperature = float(temp_str) - times.append(time) - temperatures.append(temperature) + if temperature >= 10 and temperature <= 40: + times.append(time) + temperatures.append(temperature) # 确保时间序列是排序的 times.sort()