2022-09-05 快速STA/LTA

def recursive_sta_lta_2d(array, nsta, nlta):
    
    nch, npts = array.shape
    
    csta = 1. / nsta
    clta = 1. / nlta
    sta = 0
    lta = 1e-99
    charfct = np.zeros_like(array)
    icsta = 1 - csta
    iclta = 1 - clta
    for i in range(1, npts):
        sq = array[:,i] ** 2
        sta = csta * sq + icsta * sta
        lta = clta * sq + iclta * lta
        charfct[:,i] = sta / lta
        if i < nlta:
            charfct[:,i] = 0
    return charfct

你可能感兴趣的:(2022-09-05 快速STA/LTA)