Improving frequency time normalization/hilbert transfer runtimes

Deadly 提交于 2021-02-07 18:42:38

问题


So this is a bit of a nitty gritty question...

I have a time-series signal that has a non-uniform response spectrum that I need to whiten. I do this whitening using a frequency time normalization method, where I incrementally filter my signal between two frequency endpoints, using a constant narrow frequency band (~1/4 the lowest frequency end-member). I then find the envelope that characterizes each one of these narrow bands, and normalize that frequency component. I then rebuild my signal using these normalized signals... all done in python (sorry, has to be a python solution)...

Here is the raw data:

and here is its spectrum:

and here is the spectrum of the whitened data:

The problem is, that I have to do this for maybe ~500,000 signals like this, and it takes a while (~a minute each)... With almost the entirety of the time being spend doing the actual (multiple) Hilbert transforms

I have it running on a small cluster already. I don't want to parallelize the loop the Hilbert is in.

I'm looking for alternative envelope routines/functions (non Hilbert), or alternative ways to calculate the entire narrowband response function without doing a loop.

The other option is to make the frequency bands adaptive to the center frequency over which its filtering, so they get progressively larger as we march through the routines; which would just decrease the number of times I have to go through the loop.

Any and all suggestions welcome!!!

example code/dataset: https://github.com/ashtonflinders/FTN_Example


回答1:


Here is a faster method to calculate the enveloop by local max:

def calc_envelope(x, ind):
    x_abs = np.abs(x)
    loc = np.where(np.diff(np.sign(np.diff(x_abs))) < 0)[0] + 1
    peak = x_abs[loc]
    envelope = np.interp(ind, loc, peak)
    return envelope

Here is an example output:

It's about 6x faster than hilbert. To speedup even more, you can write a cython function that find next local max point and does normalization up to the local max point iteratively.



来源:https://stackoverflow.com/questions/39648038/improving-frequency-time-normalization-hilbert-transfer-runtimes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!