You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because the vertical force at the solar circle in the Milky Way at 1.1
@@ -223,7 +221,7 @@ input to any galpy function that does not take a Quantity as an input
223
221
<https://github.com/jobovy/galpy/issues>`__.
224
222
225
223
.. WARNING::
226
-
If you combine potentials by adding them (``comb_pot= pot1+pot2``), galpy uses the ``ro`` and ``vo`` scales from the first potential in the list for physical <-> internal unit conversion. If you add potentials using the '+' operator, galpy will check that the units are compatible. galpy does **not** always check whether the unit systems of various objects are consistent when they are combined (but does check this for many common cases, e.g., integrating an Orbit in a Potential, setting up an actionAngle object for a given potential, setting up a DF object for a given potential, etc.).
224
+
If you combine potentials by adding them (``comb_pot= pot1+pot2``), galpy uses the ``ro`` and ``vo`` scales from the first potential in the combination for physical <-> internal unit conversion. If you add potentials using the '+' operator, galpy will check that the units are compatible. galpy does **not** always check whether the unit systems of various objects are consistent when they are combined (but does check this for many common cases, e.g., integrating an Orbit in a Potential, setting up an actionAngle object for a given potential, setting up a DF object for a given potential, etc.).
227
225
228
226
galpy can also return values with units as an astropy
229
227
Quantity. Whether or not this is done is specified by the
@@ -269,7 +267,7 @@ Quantity when ``astropy-units = False``. If you setup a Potential, Orbit,
269
267
actionAngle, or DF object with parameters specified as a Quantity, the
270
268
default is to return any output in physical units. This is why
271
269
``mp.vcirc`` returns the velocity in km/s above. Potential and Orbit
272
-
instances (or lists of Potentials) also support the functions
270
+
instances (or combinations of Potentials) also support the functions
273
271
``turn_physical_off`` and ``turn_physical_on`` to turn physical output
Copy file name to clipboardExpand all lines: doc/source/potential.rst
+51-44Lines changed: 51 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,27 +34,34 @@ such instances. Similarly, we can evaluate a Potential instance
34
34
>>> mp(1.,0.)
35
35
# -1.2889062500000001
36
36
37
-
Most member functions of Potential instances have corresponding
38
-
functions in the galpy.potential module that allow them to be
39
-
evaluated for lists of multiple Potential instances (and in versions
40
-
>=1.4 even for nested lists of Potential
41
-
instances). ``galpy.potential.MWPotential2014`` is such a list of
37
+
You can create more potentials by adding up multiple Potential instances using the
38
+
``+`` operator. For example, ``galpy.potential.MWPotential2014`` is such a combination of
42
39
three Potential instances
43
40
44
41
>>> from galpy.potential import MWPotential2014
45
42
>>> print(MWPotential2014)
46
-
# [<galpy.potential.PowerSphericalPotentialwCutoff.PowerSphericalPotentialwCutoff instance at 0x1089b23b0>, <galpy.potential.MiyamotoNagaiPotential.MiyamotoNagaiPotential instance at 0x1089b2320>, <galpy.potential.TwoPowerSphericalPotential.NFWPotential instance at 0x1089b2248>]
43
+
# CompositePotential of 3 potentials:
44
+
# PowerSphericalPotentialwCutoff with internal parameters: amp=0.029994597188218296, alpha=1.8, rc=0.2375
45
+
# MiyamotoNagaiPotential with internal parameters: amp=0.7574802019371595, a=0.375, b=0.035
46
+
# NFWPotential with internal parameters: amp=4.852230533527998, a=2.0
47
+
#and physical outputs off
47
48
48
-
and we can evaluate the potential by using the ``evaluatePotentials``
49
+
Combinations of potentials can be evaluated in the same way as single
50
+
Potential instances, e.g.,
51
+
52
+
>>> from galpy.potential import MWPotential2014
53
+
>>> MWPotential2014(1.,0.)
54
+
# -1.3733506513947897
55
+
56
+
For historical reasons, there is also a functional interface in the
57
+
``galpy.potential`` module that mirrors most member functions of Potential instances.
58
+
For example, we can evaluate the potential also by using the ``evaluatePotentials``
49
59
function
50
60
51
61
>>> from galpy.potential import evaluatePotentials
52
62
>>> evaluatePotentials(MWPotential2014,1.,0.)
53
63
# -1.3733506513947895
54
64
55
-
.. TIP::
56
-
Lists of Potential instances can be nested, allowing you to easily add components to existing gravitational-potential models. For example, to add a ``DehnenBarPotential`` to ``MWPotential2014``, you can do: ``pot= [MWPotential2014,DehnenBarPotential()]`` and then use this ``pot`` everywhere where you can use a list of Potential instances. You can also add potential simply as ``pot= MWPotential2014+DehnenBarPotential()``.
57
-
58
65
.. WARNING::
59
66
``galpy`` potentials do *not* necessarily approach zero at infinity. To compute, for example, the escape velocity or whether or not an orbit is unbound, you need to take into account the value of the potential at infinity. E.g., :math:`v_{\mathrm{esc}}(r) = \sqrt{2[\Phi(\infty)-\Phi(r)]}`. If you want to create a potential that does go to zero at infinity, you can add a :ref:`NullPotential <null_potential>` with value equal to minus the original potential evaluated at infinity.
60
67
@@ -71,15 +78,16 @@ which produces the following plot
71
78
72
79
.. image:: images/mp-potential.png
73
80
74
-
Similarly, we can plot combinations of Potentials using
75
-
``plotPotentials``, e.g.,
81
+
Similarly, we can plot combinations of Potentials using the ``.plot`` member function, or using the
82
+
``plotPotentials`` function, e.g.,
76
83
77
84
>>> from galpy.potential import plotPotentials
78
85
>>> plotPotentials(MWPotential2014,rmin=0.01)
79
86
80
87
.. image:: images/MWPotential-potential.png
81
88
82
-
These functions have arguments that can provide custom ``R`` and ``z``
89
+
this produces the same plot as ``MWPotential2014.plot(rmin=0.01)``. These functions
90
+
have arguments that can provide custom ``R`` and ``z``
83
91
ranges for the plot, the number of grid points, the number of
84
92
contours, and many other parameters determining the appearance of
85
93
these figures.
@@ -114,24 +122,23 @@ assuming a physical circular velocity of 220 km/s at R=8 kpc
0 commit comments