Giter Site home page Giter Site logo

Comments (2)

eugvas avatar eugvas commented on September 22, 2024

I think it's a confusion with units.
If you plot the circular-velocity curve of the original potential, plt.plot(r, (-r*galapot.Rforce(r, r*0))**0.5), it has a peak around 6, same as the red curve in your plot. Since the NFW potential has a peak circular velocity at ~2.2 times its scale length, this corresponds to 55 kpc, or ~6.2 in the "native" Galpy length units of 8 kpc. But if you call galapot.Rforce(r * u.kpc, r*0), it apparently perform the conversion from astropy dimensional units to its internal units.
Now it seems to me that even when you call galapot.plotRotcurve with a plain numpy array, it still assumes that the radii are provided in kpc, not in units of 8kpc, that's why the blue curve reaches the peak well beyond the right margin of the plot.
And if you create a pure Agama NFW potential with a scale length of 25 (presumably, kpc, though it is never specificed), its circular velocity will peak at 2.2 times that value, as expected - that's the green dashed line in your plot (mislabelled as "from Galpy", whereas it comes from a pure Agama potential).
I don't understand how Galpy deals with units when mixing astropy.units with its native ones, so it seems that the most straightforward (if awkward) approach is to stick to the length unit of 8kpc and velocity unit of 220 km/s (and not to forget to call agama.setUnits(length=8, velocity=220, mass=1) at the beginning of the script to instruct Agama to use the same units). Then if you interpret the x axis in terms of units of 8kpc, not 1 kpc, everything should match and peak at x=6.2

from agama.

brugalada avatar brugalada commented on September 22, 2024

First of all, yep, you are right: I put the labels in the wrong order.

Having said that, I think it is not worth losing any sleep over this since it is indeed a problem with units, and Galpy is too opaque for me to try and figure it out.

Thank you for the clarification! And sorry for the silly question jeje

from agama.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.