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)wherex,y,zare cartesian coordinates,Mis a scale mass,r_sa scale radius, andargsis an iterable containing any other arguments needed by the density function.nmax : int
Maximum value of
nfor the radial expansion.lmax : int
Maximum value of
lfor 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
nquadas options,opts.Returns: Snlm : float,
ndarrayThe value of the cosine expansion coefficient.
Snlm_err : ,
ndarrayAn estimate of the uncertainty in the coefficient value (from
nquad).Tnlm : ,
ndarrayThe value of the sine expansion coefficient.
Tnlm_err : ,
ndarrayAn estimate of the uncertainty in the coefficient value. (from
nquad).