# compute_coeffs_discrete¶

gala.potential.scf.compute_coeffs_discrete(xyz, mass, nmax, lmax, r_s, skip_odd=False, skip_even=False, skip_m=False, compute_var=False)[source]

Compute the expansion coefficients for representing the density distribution of input points as a basis function expansion. The points, xyz, are assumed to be samples from the density distribution.

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: xyz : array_like Samples from the density distribution. Should have shape (n_samples,3). mass : array_like Mass of each sample. Should have shape (n_samples,). nmax : int Maximum value of n for the radial expansion. lmax : int Maximum value of l for the spherical harmonics. r_s : numeric Scale radius. 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$$. compute_var : bool (optional) Also compute the variances of the coefficients. This does not compute the full covariance matrix of the coefficients, just the individual variances. TODO: separate function to compute full covariance matrix? Snlm : float The value of the cosine expansion coefficient. Tnlm : float The value of the sine expansion coefficient.