pycsa.core.fourier

Classes

f_trans(nhar_i, nhar_j[, ctx, buffer_pool])

Fourier transformer class

class pycsa.core.fourier.f_trans(nhar_i, nhar_j, ctx=None, buffer_pool=None)

Fourier transformer class

__init__(nhar_i, nhar_j, ctx=None, buffer_pool=None)

Initalises a discrete spectral space with the corresponding Fourier coefficients spanning nhar_i and nhar_j.

Parameters:
  • nhar_i (int) – number of spectral modes in the first horizontal direction

  • nhar_j (int) – number of spectral modes in the second horizontal direction

  • ctx (ComputeContext, optional) – Compute context bundling the buffer pool (and other per-task resources). Default-constructed if absent.

  • buffer_pool (BufferPool, optional) – Deprecated. Pass ctx=ComputeContext(buffer_pool=...) instead. Retained as a compatibility alias for one release.

set_kls(k_rng, l_rng, recompute_nhij=True, components='imag')

Method to select a smaller subset of the dense spectral space, e.g., in the Second Approximation step of the algorithm if the First Approximation is computed with a fast-Fourier transform.

Parameters:
  • k_rng (list) – list containing the selected k-wavenumber indices

  • l_rng (list) – list containing the selected l-wavenumber indices

  • recompute_nhij (bool, optional) – resets nhar_i and nhar_j, by default True

  • components (str, optional) – real recomputes the spectral space comprising only real spectral components, by default ‘imag’

do_full(cell, grad=False)

Assembles the sine and cosine terms that make up the Fourier coefficients in the M matrix required in the linear regression computation:

\[M a_m =h\]
Parameters:
  • cell (pycsa.data.cell.topo_cell instance) – cell object instance

  • grad (bool, optional) – if True, assemble the terms over the cell’s gradient coordinates (grad_lon/grad_lat) instead of the plain coordinates, selecting the gradient spectral terms; by default False

do_axial(cell, alpha=0.0)

Computes spectral modes along the (k,l)-axes.

Deprecated since version 0.90.0.

do_cg_spsp(cell)

Computes the coarse-grained sparse spectral space

Deprecated since version 0.90.0.

get_freq_grid(a_m)

Assembles a dense representation of the sparse spectral space given the Fourier amplitudes computed in the linear regression step.

Parameters:

a_m (list) – list of (sparse) Fourier amplitudes

Returns:

complex 2-D array of shape (nhar_j, nhar_i) holding the dense Fourier coefficients. The same array is also cached on the instance as self.ampls.

Return type:

np.ndarray