lnls-fac / apsuite

Accelerator Physics suite
MIT License
1 stars 2 forks source link

Improve switching filtering in OrbitAnalysis #231

Closed murilobalves closed 1 year ago

murilobalves commented 1 year ago

Required for acquisitions in TbT rate that have switching harmonics

Now scipy.fft is used instead of numpy.fft since it is slightly faster (~20% in my PC. I tested in the control rooms PCs and the performance is the same for both packages).

Example considering the typical sizes of orbit data executed in my PC:

import numpy as np
import scipy as sp

Nsamps = 100_000
Nbpms = 160
mat = np.random.rand(Nsamps, Nbpms)

%timeit np_fft = np.fft.rfft(mat)
# result:  56.1 ms ± 107 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
%timeit sp_fft = sp.fft.rfft(mat)
# result: 44.5 ms ± 110 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)