compute_coeffs

biff.scf.compute_coeffs(density_func, nmax, lmax, M, r_s, args=(), skip_odd=False, skip_even=False, skip_m=False, S_only=False, **nquad_opts)[source]

Compute the expansion coefficients for representing the input density function using a basis function expansion.

Computing the coefficients involves computing triple integrals which are computationally expensive. For an example of how to parallelize the computation of the coefficients, see examples/parallel_compute_Anlm.py.

Parameters:

density_func : function, callable

A function or callable object that evaluates the density at a given position. The call format must be of the form: density_func(x, y, z, M, r_s, args) where x,y,z are cartesian coordinates, M is a scale mass, r_s a scale radius, and args is an iterable containing any other arguments needed by the density function.

nmax : int

Maximum value of n for the radial expansion.

lmax : int

Maximum value of l for the spherical harmonics.

M : numeric

Scale mass.

r_s : numeric

Scale radius.

args : iterable (optional)

A list or iterable of any other arguments needed by the density function.

skip_odd : bool (optional)

Skip the odd terms in the angular portion of the expansion. For example, only take \(l=0,2,4,...\)

skip_even : bool (optional)

Skip the even terms in the angular portion of the expansion. For example, only take \(l=1,3,5,...\)

skip_m : bool (optional)

Ignore terms with \(m > 0\).

S_only : bool (optional)

Only compute the S coefficients.

**nquad_opts

Any additional keyword arguments are passed through to nquad as options, opts.

Returns:

Snlm : float, ndarray

The value of the cosine expansion coefficient.

Snlm_err : , ndarray

An estimate of the uncertainty in the coefficient value (from nquad).

Tnlm : , ndarray

The value of the sine expansion coefficient.

Tnlm_err : , ndarray

An estimate of the uncertainty in the coefficient value. (from nquad).