Skip to content

Commit

Permalink
Clarify use of IAS15 where symplectic integrators can't be used (IAS1…
Browse files Browse the repository at this point in the history
…5 can't be used either in galpy)
  • Loading branch information
jobovy committed Jan 10, 2025
1 parent 6e82fc0 commit c224f90
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion doc/source/orbit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ which are speedy and reliable. For example, compare
# 4.65 ms ± 86.8 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

The ``ias15_c`` method uses adaptive timestepping under the hood, and
can be used in cases where very high precision is required.
can be used in cases where very high precision is required during orbit integration.

If the C extensions are unavailable for some reason, I recommend using
the ``odeint`` pure-Python integrator, as it is the fastest. Using the
Expand Down
10 changes: 4 additions & 6 deletions galpy/orbit/Orbits.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,7 @@ def check_integrator(method, no_symplec=False):
"leapfrog_c",
"symplec4_c",
"symplec6_c",
"ias15_c", # practically speaking, ias15 has the same limitations as symplectic integrators in galpy
]
[valid_methods.remove(symplec_method) for symplec_method in symplec_methods]
if method.lower() not in valid_methods:
Expand Down Expand Up @@ -1577,7 +1578,7 @@ def integrate_SOS(
Surface to punch through (this has no effect in 3D, where the surface is always z=0, but in 2D it can be 'x' or 'y' for x=0 or y=0).
t0 : float or Quantity, optional
Initial time.
method : {'odeint', 'dop853_c', 'dop853', 'rk4_c', 'rk6_c', 'dop54_c', 'ias15_c'}, optional
method : {'odeint', 'dop853_c', 'dop853', 'rk4_c', 'rk6_c', 'dop54_c'}, optional
Integration method to use. Default is 'dop853_c'. See Notes for more information.
progressbar : bool, optional
If True, display a tqdm progress bar when integrating multiple orbits (requires tqdm to be installed!).
Expand All @@ -1601,7 +1602,6 @@ def integrate_SOS(
- 'dopr54_c' for a 5-4 Dormand-Prince integrator in C
- 'dop853' for a 8-5-3 Dormand-Prince integrator in Python
- 'dop853_c' for a 8-5-3 Dormand-Prince integrator in C
- 'ias15_c' for an adaptive 15th order integrator using Gauß-Radau quadrature (see IAS15 paper) in C
- 2023-03-16 - Written - Bovy (UofT)
Expand Down Expand Up @@ -1754,7 +1754,6 @@ def integrate_dxdv(
- 'dopr54_c' for a 5-4 Dormand-Prince integrator in C
- 'dop853' for a 8-5-3 Dormand-Prince integrator in Python
- 'dop853_c' for a 8-5-3 Dormand-Prince integrator in C
- 'ias15_c' for an adaptive 15th order integrator using Gauß-Radau quadrature (see IAS15 paper) in C
- 2011-10-17 - Written - Bovy (IAS)
- 2014-06-29 - Added rectIn and rectOut - Bovy (IAS)
Expand Down Expand Up @@ -4968,7 +4967,7 @@ def SOS(
----------------
t0 : float or Quantity, optional
Time of the initial condition. Default is 0.
method : {'odeint', 'dop853_c', 'dop853', 'rk4_c', 'rk6_c', 'dop54_c', 'ias15_c'}, optional
method : {'odeint', 'dop853_c', 'dop853', 'rk4_c', 'rk6_c', 'dop54_c'}, optional
Integration method. Default is 'dop853_c'. See Notes for more information.
skip : int, optional
For non-adaptive integrators, the number of basic steps to take between crossings (these are further refined in the code, but only up to a maximum refinement, so you can use skip to get finer integration in cases where more accuracy is needed). Default is 100.
Expand All @@ -4994,7 +4993,6 @@ def SOS(
- 'dopr54_c' for a 5-4 Dormand-Prince integrator in C
- 'dop853' for a 8-5-3 Dormand-Prince integrator in Python
- 'dop853_c' for a 8-5-3 Dormand-Prince integrator in C
- 'ias15_c' for an adaptive 15th order integrator using Gauß-Radau quadrature (see IAS15 paper) in C
- 2023-03-16 - Written - Bovy (UofT)
Expand Down Expand Up @@ -5773,7 +5771,7 @@ def plotSOS(
Surface to punch through (this has no effect in 3D, where the surface is always z=0, but in 2D it can be 'x' or 'y' for x=0 or y=0). The default is None.
t0 : float or Quantity, optional
Time of the initial condition. The default is 0.0.
method : {'odeint', 'dop853_c', 'dop853', 'dop54_c', 'rk4_c', 'rk6_c', 'ias15_c'}, optional
method : {'odeint', 'dop853_c', 'dop853', 'dop54_c', 'rk4_c', 'rk6_c'}, optional
Method to integrate the orbit. The default is 'dop853_c'.
skip : int, optional
For non-adaptive integrators, the number of basic steps to take between crossings (these are further refined in the code, but only up to a maximum refinement, so you can use skip to get finer integration in cases where more accuracy is needed). The default is 100.
Expand Down
8 changes: 1 addition & 7 deletions tests/test_orbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -7283,13 +7283,7 @@ def test_orbit_c_sigint_planar():

# Test that orbit integration in C gets interrupted by SIGINT (CTRL-C)
def test_orbit_c_sigint_planardxdv():
integrators = [
"dopr54_c",
"rk4_c",
"rk6_c",
"dop853_c",
"ias15_c",
]
integrators = ["dopr54_c", "rk4_c", "rk6_c", "dop853_c"]
scriptpath = "orbitint4sigint.py"
if not "tests" in os.getcwd():
scriptpath = os.path.join("tests", scriptpath)
Expand Down

0 comments on commit c224f90

Please sign in to comment.