我正在努力确定涨跌幅度;信号的下降时间,如下所示:PMT Signal
目标是找到信号的下降和上升时间。我尝试的是在信号的平坦部分指定90%的电平,并指定0-10%作为信号的最小值。以下是我尝试过的:
def下降时间(自身、通道、校准通道数据):
try:
up_limit = np.where(calChannel_data >= np.percentile(calChannel_data, 90, axis = 0) )
low_limit = np.where(calChannel_data == np.min(calChannel_data))
midpoint = np.where( np.logical_and(calChannel_data >= np.percentile(calChannel_data, 45, axis = 0), \
calChannel_data <= np.percentile(calChannel_data, 55, axis = 0)))
before_fall =up_limit[0][ np.where(up_limit[0] <= low_limit[0][0])]
after_fall = up_limit[0][np.where(up_limit[0]>= low_limit[0][0])]
except IndexError:
print("the criteria was not met")
else:
return ch, up_limit[0], low_limit[0][0], midpoint[0], before_fall, after_fall
finally:
print("the end")
但是,它并不能完全工作,因为有部分信号不满足try中的条件:部分代码。有没有办法标记任何不满足条件的实例并阻止其停止
你总是可以嵌套
try
,比如相关问题 更多 >
编程相关推荐