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

Bugs with MN3 potentials #483

Open
adrn opened this issue Oct 17, 2024 · 0 comments
Open

Bugs with MN3 potentials #483

adrn opened this issue Oct 17, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@adrn
Copy link
Collaborator

adrn commented Oct 17, 2024

I just noticed this when testing something unrelated:

pot = gp.MN3ExponentialPotential(
    m_tot=1e11, h_R=3.0, h_z=0.3, units=unitsystem("galactic")
)
w0 = gc.PhaseSpacePosition(
    q=Quantity([8.0, 0.0, 0.0], "kpc"), p=Quantity([0.0, 200, 50.0], "km/s")
)
ts = Quantity(jnp.arange(0.0, 25.0, 1e-3), "Gyr")
orbit = pot.evaluate_orbit(w0, t=ts)
orbit.total_energy()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/var/folders/rt/whnwmp_97v9g6dldf5lr38l80000gr/T/ipykernel_44601/2922822408.py in ?()
      5     q=Quantity([8.0, 0.0, 0.0], "kpc"), p=Quantity([0.0, 200, 50.0], "km/s")
      6 )
      7 ts = Quantity(jnp.arange(0.0, 25.0, 1e-3), "Gyr")
      8 orbit = pot.evaluate_orbit(w0, t=ts)
----> 9 orbit.total_energy()
...
~/projects/scratch/.venv/lib/python3.12/site-packages/galax/potential/_src/builtin/builtin.py in ?(self, t)
    597 
    598         # get b / h_R with fitting functions:
    599         b_hR = self._b_coeffs @ jnp.array([hzR**3, hzR**2, hzR])
    600 
--> 601         x = jnp.vander(b_hR[None], N=5)[0]
    602         param_vec = K @ x
    603 
    604         # use fitting function to get the Miyamoto-Nagai component parameters

~/projects/scratch/.venv/lib/python3.12/site-packages/quax/_core.py in ?(self, *args, **kwargs)
    320                 dynamic,
    321                 is_leaf=_is_value,
    322             )
    323             fn, args, kwargs = eqx.combine(dynamic, static)
--> 324             out = fn(*args, **kwargs)
    325             out = jtu.tree_map(ft.partial(_unwrap_tracer, trace), out)
    326             return out

    [... skipping hidden 11 frame]

~/projects/scratch/.venv/lib/python3.12/site-packages/jax/_src/numpy/lax_numpy.py in ?(x, N, increasing)
   7795 ) -> Array:
   7796   util.check_arraylike("vander", x)
   7797   x = asarray(x)
   7798   if x.ndim != 1:
-> 7799     raise ValueError("x must be a one-dimensional array")
   7800   N = x.shape[0] if N is None else core.concrete_or_error(
   7801     operator.index, N, "'N' argument of jnp.vander()")
   7802   if N < 0:

ValueError: x must be a one-dimensional array

Also the docstring isn't parsing correctly for me "ERROR: Pylance failed to parse docstring at index 239"

@adrn adrn added the bug Something isn't working label Oct 17, 2024
@adrn adrn self-assigned this Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant