API reference

naif

naif.find_peak_freqs(f_k, t, n_freqs=1, p=1, spec=False, brent_tol=1e-10, eps_spec=1e-07, n_scan_peak=100)[source]

Finds frequencies of peaks in the power spectrum, from highest to lowest amplitudes

Parameters:
  • f_k (float array (size N)) – Time-series associated with a coordinate; e.g.: f = r, or f = r + ivr

  • t (float array (size N)) – Time-steps for the time-series

  • n_freqs (int, optional) – Maximum number of frequencies to extract. 1 if only the leading frequency

  • p (int, optional) – The p parameter of the Window function chi_p; p=0 for no windowing; p=1 for the Hanning window

  • spec (boolean, optional) – Output the spectra before extraction of each frequency?

  • brent_tol (float, optional) – Tolearance error for Brent’s minimum finder method

  • eps_spec (float, optional) – Minimum amplitude for keeping extracting freqss. If below that, it ends before extracting all freqs.

  • n_scan_peak (int, optional) – Number of points where phi(omega) is evaluated. In case Brent’s method fails (rarely used).

Returns:

  • om_k (float array or number) – Extracted frequencies, in descending order of amplitude

  • a_k (complex array or number) – Amplitudes associated to the frequencies om_k

  • spec_k ((optional, depending on spec) complex array;) – Format (n_freqs, N) or size N. Full (windowed) spectrum before extraction of kth freq.

naif.chi_p(t, p=1)[source]

Window function chi_p(t)

Parameters:
  • t (float array (size N)) – Time symmetric, from -T/2 to T/2

  • p (int, optional) – p parameter

Returns:

Window function chi_p

Return type:

float array

naif.mn_phi_om(om, f_chi, t)[source]

Calculates -|(phi(omega)| = -|<f(t), exp(i om t)>|

The continuous projection of the time series onto the frequency space. It calcuates the minimum (instead of the maximum) because Brent’s looks for minima

Parameters:
  • om (float) – Frequency omega (continuous)

  • f_chi (complex array) – f_k * chi_p(t) - the windowed time-series

  • t (float array) – Time symmetric, from -T/2 to T/2

Returns:

-|phi(omega)|

Return type:

float

naif._base_funcs.inner_prod(t, u1_chi, u2)[source]

Inner product <u_1, u_2>

Parameters:
  • t (float array (size N)) – Time symmetric, from -T/2 to T/2

  • u1_chi (complex array) – u_1 * chi_p(t) - 1st arg. of inner prod. times window

  • u_2 (complex array) – Second argument of inner product

Returns:

Innter product <u_1, u_2>

Return type:

complex

naif._base_funcs.gs(t, u, e, chi)[source]

Gram-Schimidt orthonomal basis

For each peak identified at om, build vector u = exp(i* om * t), and obtain e_k’s normal to all previous ones (by Gram-Schimidt orthonomalization).

Parameters:
  • t (float array) – Time symmetric, from -T/2 to T/2

  • u (complex array) – u_k = exp(i om_k t) - non-orthonormal vectors

  • e (complex, array) – e_k: set of orthonormal vectors already calc. (it has only elements up to k)

  • chi (float array) – chi_p(t) - the window function

Returns:

Orthonormal vectors

Return type:

complex array