Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing a Potential's multipole coefficients in Python #9

Closed
nstarman opened this issue Jan 22, 2021 · 2 comments
Closed

Accessing a Potential's multipole coefficients in Python #9

nstarman opened this issue Jan 22, 2021 · 2 comments

Comments

@nstarman
Copy link

@eugvas Is it possible to access a multipole potential's coefficients in python (or even to save the coefficients to a file)?

@eugvas
Copy link
Contributor

eugvas commented Jan 22, 2021

the coefficients are indeed written to text files by the Potential.export() method, though the detailed specification of this file is not given in the docs. But it does have a rather simple structure: after a few header lines, there comes an array of potential coefficients, followed by radial derivative coefficients: Phi_{lm}(r), dPhi_{lm}/dr. Each line contains the radius and then the values of each potential harmonic at this radius, in the following order: l=0; l=1,m=-1; l=1,m=0; l=1,m=1; l=2,m=-2; l=2,m=-1; etc., where negative m correspond to sine and positive - to cosine terms in the expansion - in total, (lmax+1)^2 terms. The normalization convention is described in the section A.4.1 of reference.pdf
Although there is no way to access these coefs from Python, you may save them to a file and read it off as a numpy array if needed.

@nstarman
Copy link
Author

Thanks @eugvas !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants