# Evaluating Potentials using Galpy

I am trying to model galactic disks. From the past research we have discovered that the halo follows the logarithmic potential, the disk follows the Miyamoto-Nagai potential and the bulge follows the Hernquist potential. I have the $$R$$ and $$z$$ coordinates of a sample of stars divided into halo, bulge and disk stars and I am trying to compute the potentials of these potential using galpy's galpy.potential.evaluatePotentials(Pot, R, z, phi=None, t=0.0, dR=0, dphi=0).

However, it looks like the potentials are defaulted as non axis symmetric during initialization since I am getting the error message as shown in the image.

Is there a way to make this work?

Coding the potentials is one way to get around the problem, however, before resorting to this option, I needed to check whether there are solutions available already.

Cheers!!!

• Never used galpy before and not sure how your doing your import and definition (can you edit the Q to show this please?) but if I do a from galpy.potential import LogarithmicHaloPotential ; halo = LogarithmicHaloPotential() then doing a halo.isNonAxi returns False so it has that attribute. Jun 23, 2022 at 23:05
• Looks like a temporary bug in the code. I uninstalled galpy and reinstalled it. That worked!!! Jun 24, 2022 at 13:25

For future reference, I believe the issue here was that you didn't instantiate the potential. That is, you probably tried to do

from galpy.potential import LogarithmicHaloPotential, evaluatePotentials
evaluatePotentials(LogarithmicHaloPotential,1.,0.)


rather than

from galpy.potential import LogarithmicHaloPotential, evaluatePotentials
lp= LogarithmicHaloPotential() # specific instance with default parameters
evaluatePotentials(lp,1.,0.)


Please don't hesitate to open an Issue or Discussion at the GitHub page or join the slack community there: https://github.com/jobovy/galpy. I don't usually monitor stackexchange.

• Welcome to Astronomy SE!
– uhoh
Jun 28, 2022 at 2:04