# obspy.signal.util._npts2nfft¶

_npts2nfft(npts, smart=True)[source]

Calculates number of points for fft from number of samples in trace. When encountering bad values with prime factors involved (that can take forever to compute) we try a few slightly larger numbers for a good factorization (computation time for factorization is negligible compared to fft/evalsresp/ifft) and if that fails we use the next power of 2 which is not fastest but robust.

>>> _npts2nfft(1800028)  # good nfft with minimum points
3600056
>>> int(_npts2nfft(1800029))  # falls back to next power of 2
4194304
>>> _npts2nfft(1800031)  # finds suitable nfft close to minimum npts
3600082