(data)
| 147 | |
| 148 | |
| 149 | def calc_fft(data): |
| 150 | local_data = data[(1, 2, 3, 4), :].copy() |
| 151 | |
| 152 | ### FFT ### |
| 153 | samplerate = 250 |
| 154 | nsamples = local_data.shape[1] |
| 155 | win = {'none': 1, |
| 156 | 'hanning': np.hanning(nsamples), |
| 157 | 'hamming': np.hamming(nsamples)}['hanning'] |
| 158 | win = np.array([win]).T |
| 159 | |
| 160 | fft = np.abs(np.fft.rfft(local_data.T * win, axis=0, norm=None)) * 2 / nsamples |
| 161 | freqs = np.fft.rfftfreq(nsamples, 1. / samplerate) |
| 162 | |
| 163 | return fft, freqs |
no outgoing calls
no test coverage detected