Skip to content

Commit

Permalink
Merge branch 'master' into cosmphi
Browse files Browse the repository at this point in the history
  • Loading branch information
jobovy committed Sep 15, 2017
2 parents e370893 + cfc2d7e commit ebae4dd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions galpy/df_src/evolveddiskdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from galpy.orbit import Orbit
from galpy.potential import calcRotcurve
from galpy.df_src.df import df, _APY_LOADED
from galpy.potential_src.Potential import _check_c
from galpy.util.bovy_quadpack import dblquad
from galpy.util import bovy_plot
from galpy.util.bovy_conversion import physical_conversion, \
Expand Down Expand Up @@ -113,6 +114,14 @@ def __call__(self,*args,**kwargs):
"""
integrate_method= kwargs.pop('integrate_method','dopr54_c')
# Must match Python fallback for non-C potentials here, bc odeint needs
# custom t list to avoid numerically instabilities
if '_c' in integrate_method and not _check_c(self._pot):
if ('leapfrog' in integrate_method \
or 'symplec' in integrate_method):
integrate_method= 'leapfrog'
else:
integrate_method= 'odeint'
deriv= kwargs.get('deriv',None)
if isinstance(args[0],Orbit):
if len(args) == 1:
Expand Down
10 changes: 10 additions & 0 deletions tests/test_evolveddiskdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,16 @@ def test_call_special():
codeint= edf(o,0,integrate_method='odeint',log=True)
crk6c= edf(o,0.,integrate_method='rk6_c',log=True)
assert numpy.fabs(codeint-crk6c) < 10.**-4., 'edf.__call__ w/ odeint and tlist does not give the same result as w/ rk6_c'
# Call w/ just one t and fallback to odeint
# turn off C
edf._pot[0].hasC= False
edf._pot[0].hasC_dxdv= False
codeint= edf(o,0,integrate_method='dopr54_c',log=True)
assert numpy.fabs(codeint-crk6c) < 10.**-4., 'edf.__call__ w/ odeint and tlist does not give the same result as w/ rk6_c'
# Call w/ just one t and fallback to leaprog
cleapfrog= edf(o,0,integrate_method='leapfrog_c',log=True)
assert numpy.fabs(cleapfrog-crk6c) < 10.**-4., 'edf.__call__ w/ odeint and tlist does not give the same result as w/ rk6_c'


def test_call_marginalizevperp():
from galpy.orbit import Orbit
Expand Down

0 comments on commit ebae4dd

Please sign in to comment.