Skip to content

Commit

Permalink
Special case Keplerian angles for b=0, to get rid of NaN angles
Browse files Browse the repository at this point in the history
  • Loading branch information
jobovy committed Nov 13, 2017
1 parent 443b82e commit e5c2d8b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions galpy/actionAngle_src/actionAngleIsochrone.py
Expand Up @@ -247,8 +247,11 @@ def _actionsFreqsAngles(self,*args,**kwargs):
c= -self.amp/2./E-self.b
e2= 1.-L2/self.amp/c*(1.+self.b/c)
e= nu.sqrt(e2)
s= 1.+nu.sqrt(1.+(R**2.+z**2.)/self.b**2.)
coseta= 1/e*(1.-self.b/c*(s-2.))
if self.b == 0.:
coseta= 1/e*(1.-nu.sqrt(R**2.+z**2.)/c)
else:
s= 1.+nu.sqrt(1.+(R**2.+z**2.)/self.b**2.)
coseta= 1/e*(1.-self.b/c*(s-2.))
pindx= (coseta > 1.)*(coseta < (1.+10.**-7.))
coseta[pindx]= 1.
pindx= (coseta < -1.)*(coseta > (-1.-10.**-7.))
Expand Down

0 comments on commit e5c2d8b

Please sign in to comment.