Skip to content

Instantly share code, notes, and snippets.

@jobovy
Created January 4, 2017 19:51
Show Gist options
  • Save jobovy/74be086e2c3a58fcdc541c99b037ed00 to your computer and use it in GitHub Desktop.
Save jobovy/74be086e2c3a58fcdc541c99b037ed00 to your computer and use it in GitHub Desktop.
A very simple bar model for the Milky Way in galpy
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jobovy
Copy link
Author

jobovy commented Jul 16, 2024

Hi, you can add a SpiralArmsPotential, for example

SpiralArmsPotential(N=2,amp=0.75,phi_ref=25.*u.deg,alpha=15.*u.deg,omega=2./3.)

gives a two-armed spiral with a 15 degree pitch angle, a pattern speed of 2/3 Omega_sun (where Omega_sun is the rotational frequency at the Sun, Vc/R0), and it has an amplitude such that the spiral is a ~15% density enhancement at the Solar radius.

Note that the notebook above is quite old and will not work using the current version of galpy. I think the main necessary change is to replace

from galpy.util import bovy_coords, bovy_plot

with

from galpy.util import coords as bovy_coords, plot as bovy_plot

because those modules were renamed, but there might be other necessary changes.

@msolpera
Copy link

Thank you very much !

@msolpera
Copy link

Dear Bovy,
Does the amplitude you recommend take into account the conservation of the mass distribution?
Additionally, what happens if I change the number of spiral arms from 2 to 4?
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment