compute_coeffs#
- gala.potential.scf.compute_coeffs(density_func, nmax, lmax, M, r_s, args=(), skip_odd=False, skip_even=False, skip_m=False, S_only=False, progress=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.
Warning
GSL is required for this function, see the Installation instructions for more details
- Parameters:
- density_funcfunction,
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, z
are cartesian coordinates,M
is a scale mass,r_s
a scale radius, andargs
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.
- argsiterable (optional)
A list or iterable of any other arguments needed by the density function.
- skip_oddbool (optional)
Skip the odd terms in the angular portion of the expansion. For example, only take \(l=0, 2, 4, ...\)
- skip_evenbool (optional)
Skip the even terms in the angular portion of the expansion. For example, only take \(l=1, 3, 5, ...\)
- skip_mbool (optional)
Ignore terms with \(m > 0\).
- S_onlybool (optional)
Only compute the S coefficients.
- progressbool (optional)
If
tqdm
is installed, display a progress bar.- **nquad_opts
Any additional keyword arguments are passed through to
nquad
as options,opts
.
- density_funcfunction,
- Returns: