ashdisperse.spectral package

Submodules

ashdisperse.spectral.cheb module

ashdisperse.spectral.cheb.ChebMat(N, x)

Evaluation at +1 of a function defined by Chebyshev coefficients.

Args:

coeffs: the Chebyshev coefficients as an array of complex numbers.

Returns:

The function evaluated at +1.

ashdisperse.spectral.cheb.cheb(N)
ashdisperse.spectral.cheb.cheb_dif_m1(coeffs)
Evaluation at -1 of the first derivative of a function

defined by Chebyshev coefficients.

Args:

coeffs: the Chebyshev coefficients as an array of complex numbers.

Returns:

The derivative of the function evaluated at -1.

ashdisperse.spectral.cheb.cheb_dif_p1(coeffs)
Evaluates at +1 of the first derivative of a function

defined by Chebyshev coefficients.

Args:

coeffs: the Chebyshev coefficients as an array of complex numbers.

Returns:

The derivative of the function evaluated at +1.

ashdisperse.spectral.cheb.cheb_tail_test(a_abs, tol_tail=1e-08, M=8)

Numba-friendly tail test. Input:

a_abs : float64[:] – absolute values of Chebyshev coeffs (non-negative) tol_tail : float64 – normalized tail tolerance M : int – number of last coefficients to use in simple tail check

Returns:

converged : boolean tail_ratio : float64 est_error : float64 (normalized estimate of remainder)

ashdisperse.spectral.cheb.cheb_val_m1(coeffs)

Evaluates at -1 of a function defined by Chebyshev coefficients.

Args:

coeffs: the Chebyshev coefficients as an array of complex numbers.

Returns:

The function evaluated at -1.

ashdisperse.spectral.cheb.cheb_val_p1(coeffs)

Evaluates at +1 of a function defined by Chebyshev coefficients.

Args:

coeffs: the Chebyshev coefficients as an array of complex numbers.

Returns:

The function evaluated at +1.

ashdisperse.spectral.cheb.linear_fit_coeffs(idx, coeff)

Compute slope and intercept for coeff ~ slope*idx + intercept using least squares. idx is int64 array, coeff is float64 array.

ashdisperse.spectral.cheb.truncateCoeffs(coeffs, eps, plateau_factor)

Truncate coefficients to those above plateau. Numba-friendly.

Inputs:

coeffs : complex128[:] – full coefficient array eps : float64 – relative tolerance used by cheb_tail_test plateau_factor : float64 – factor above noise floor to treat as meaningful (e.g. 10.0)

Returns:

truncated coeffs (1-d complex128 array)

ashdisperse.spectral.fourier module

ashdisperse.spectral.fourier.grid_freq(num_points)

Constructs the coordinates and wavenumbers for a fourier grid on [-pi,pi]

Args:

num_points: the number of points (should be a power of 2)

Returns:

x: the coordinates as a 1d numpy array k: the wavenumbers as a 1d numpy array

Module contents