ibllib.dsp.fourier

Low-level functions to work in frequency domain for n-dim arrays

ibllib.dsp.fourier.bp(ts, si, b, axis=None)

Band-pass filter in frequency domain

Parameters:
  • ts – time serie
  • si – sampling interval in seconds
  • b – cutout frequencies: 4 elements vector or list
  • axis – axis along which to perform reduction (last axis by default)
Returns:

filtered time serie

ibllib.dsp.fourier.fexpand(x, ns=1, axis=None)

Reconstructs full spectrum from positive frequencies Works on the last dimension (contiguous in c-stored array)

Parameters:
  • x – numpy.ndarray
  • axis – axis along which to perform reduction (last axis by default)
Returns:

numpy.ndarray

ibllib.dsp.fourier.freduce(x, axis=None)

Reduces a spectrum to positive frequencies only Works on the last dimension (contiguous in c-stored array)

Parameters:
  • x – numpy.ndarray
  • axis – axis along which to perform reduction (last axis by default)
Returns:

numpy.ndarray

ibllib.dsp.fourier.fscale(ns, si=1, one_sided=False)

numpy.fft.fftfreq returns Nyquist as a negative frequency so we propose this instead

Parameters:
  • ns – number of samples
  • si – sampling interval in seconds
  • one_sided – if True, returns only positive frequencies
Returns:

fscale: numpy vector containing frequencies in Hertz

ibllib.dsp.fourier.hp(ts, si, b, axis=None)

High-pass filter in frequency domain

Parameters:
  • ts – time serie
  • si – sampling interval in seconds
  • b – cutout frequencies: 2 elements vector or list
  • axis – axis along which to perform reduction (last axis by default)
Returns:

filtered time serie

ibllib.dsp.fourier.lp(ts, si, b, axis=None)

Low-pass filter in frequency domain

Parameters:
  • ts – time serie
  • si – sampling interval in seconds
  • b – cutout frequencies: 2 elements vector or list
  • axis – axis along which to perform reduction (last axis by default)
Returns:

filtered time serie