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

Bug in analyticactionangle function #262

Open
sophialilleengen opened this issue Feb 14, 2022 · 0 comments
Open

Bug in analyticactionangle function #262

sophialilleengen opened this issue Feb 14, 2022 · 0 comments

Comments

@sophialilleengen
Copy link
Contributor

The analyticactionangle function does not take a single PhaseSpacePosition point:

pot = gp.IsochronePotential(m=1.24e+11, b=4.02, units = galactic)
ics = gd.PhaseSpacePosition(pos=[7.5,0,0.] * u.kpc, vel=[0,-200,0] * u.km/u.s)
pot.action_angle(ics)

TypeError Traceback (most recent call last)
/var/folders/gx/w54ng9cs5k3bfxcphmqpmc740001vz/T/ipykernel_72625/1131334737.py in
----> 1 pot.action_angle(ics)

gala/potential/potential/builtin/cybuiltin.pyx in gala.potential.potential.builtin.cybuiltin.IsochronePotential.action_angle()

/opt/anaconda3/lib/python3.9/site-packages/gala/dynamics/analyticactionangle.py in isochrone_to_aa(w, potential)
105 # Compute theta_z
106 psi = np.arctan2(np.cos(theta), -np.sin(theta)rvtheta/L)
--> 107 psi[np.abs(vtheta) <= 1e-10] = np.pi/2. # blows up for small vtheta
108
109 omega_th = 0.5 * (1 + L/np.sqrt(LL + 4GM*b))

TypeError: numpy.float64 object does not support item assignment

while this works:
pot = gp.IsochronePotential(m=1.24e+11, b=4.02, units = galactic)
ics = gd.PhaseSpacePosition(pos=[7.5,0,0.] * u.kpc, vel=[0,-200,0] * u.km/u.s)
orbits = gp.Hamiltonian(pot).integrate_orbit(ics, dt=4, n_steps=750)
pot.action_angle(orbits)

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

1 participant