接着上一篇文章进行分享
多项式基线校正
多项式基线校正函数代码
信号提取波段
#提取信号
def get_portion_interest(x,y,bir):
"""Extracts the signals indicated in the bir.
Parameters
----------
x : ndarray
the x axis
y : ndarray
the y values
bir : n x 2 array
the x values of regions where the signal needs to be extracted,
must be a n x 2 dimension array, where n is the number of regions to extract
and column 0 contains the low bounds, column 1 the high ones.
Returns
-------
yafit : ndarray
a 2 columns x-y array containing the signals in the bir.
"""
birlen = np.array(bir.shape[0])
sp = np.transpose(np.vstack((x.reshape(-1),y.reshape(-1))))
### selection of bir data
for i in range(birlen):
if i == 0:
yafit = sp[np.where((sp[