add filter

This commit is contained in:
fengbh 2024-01-15 21:59:32 +08:00
parent 3334d7896c
commit bb92563de2

View File

@ -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()