def calcRapRperi(self,**kwargs):
        """
        NAME:
           calcRapRperi
        PURPOSE:
           calculate the apocenter and pericenter radii
        INPUT:
        OUTPUT:
           (rperi,rap)
        HISTORY:
           2010-12-01 - Written - Bovy (NYU)
        """
        if hasattr(self,'_rperirap'): #pragma: no cover
            return self._rperirap
        EL= self.calcEL(**kwargs)
        E, L= EL
        if self._vR == 0. and m.fabs(self._vT - vcirc(self._pot,self._R,use_physical=False)) < _EPS: #We are on a circular orbit
            rperi= self._R
            rap = self._R
        elif self._vR == 0. and self._vT > vcirc(self._pot,self._R,use_physical=False): #We are exactly at pericenter
            rperi= self._R
            if self._gamma != 0.:
                startsign= _rapRperiAxiEq(self._R+10.**-8.,E,L,self._pot)
                startsign/= m.fabs(startsign)
            else: startsign= 1.
            rend= _rapRperiAxiFindStart(self._R,E,L,self._pot,rap=True,
                                        startsign=startsign)
            rap= optimize.brentq(_rapRperiAxiEq,rperi+0.00001,rend,
                                 args=(E,L,self._pot))
#                                   fprime=_rapRperiAxiDeriv)
        elif self._vR == 0. and self._vT < vcirc(self._pot,self._R,use_physical=False): #We are exactly at apocenter
            rap= self._R
            if self._gamma != 0.:
                startsign= _rapRperiAxiEq(self._R-10.**-8.,E,L,self._pot)
                startsign/= m.fabs(startsign)
            else: startsign= 1.
            rstart= _rapRperiAxiFindStart(self._R,E,L,self._pot,
                                          startsign=startsign)
            if rstart == 0.: rperi= 0.
            else:
                rperi= optimize.brentq(_rapRperiAxiEq,rstart,rap-0.000001,
                                       args=(E,L,self._pot))
#                                   fprime=_rapRperiAxiDeriv)
        else:
            if self._gamma != 0.:
                startsign= _rapRperiAxiEq(self._R,E,L,self._pot)
                startsign/= m.fabs(startsign)
            else:
                startsign= 1.
            rstart= _rapRperiAxiFindStart(self._R,E,L,self._pot,
                                          startsign=startsign)
            if rstart == 0.: rperi= 0.
            else: 
                try:
                    rperi= optimize.brentq(_rapRperiAxiEq,rstart,self._R,
                                           (E,L,self._pot),
                                           maxiter=200)
                except RuntimeError: #pragma: no cover
                    raise UnboundError("Orbit seems to be unbound")
            rend= _rapRperiAxiFindStart(self._R,E,L,self._pot,rap=True,
                                        startsign=startsign)
            rap= optimize.brentq(_rapRperiAxiEq,self._R,rend,
                                 (E,L,self._pot))
        self._rperirap= (rperi,rap)
        return self._rperirap
def calcRapRperi ( self , ** kwargs ) : if hasattr ( self , '_rperirap' ) : return self . _rperirap EL = self . calcEL ( ** kwargs ) E , L = EL if self . _vR == 0. and m . fabs ( self . _vT - vcirc ( self . _pot , self . _R , use_physical = False ) ) < _EPS : rperi = self . _R rap = self . _R elif self . _vR == 0. and self . _vT > vcirc ( self . _pot , self . _R , use_physical = False ) : rperi = self . _R if self . _gamma != 0. : startsign = _rapRperiAxiEq ( self . _R + 10. ** - 8. , E , L , self . _pot ) startsign /= m . fabs ( startsign ) else : startsign = 1. rend = _rapRperiAxiFindStart ( self . _R , E , L , self . _pot , rap = True , startsign = startsign ) rap = optimize . brentq ( _rapRperiAxiEq , rperi + 0.00001 , rend , args = ( E , L , self . _pot ) ) elif self . _vR == 0. and self . _vT < vcirc ( self . _pot , self . _R , use_physical = False ) : rap = self . _R if self . _gamma != 0. : startsign = _rapRperiAxiEq ( self . _R - 10. ** - 8. , E , L , self . _pot ) startsign /= m . fabs ( startsign ) else : startsign = 1. rstart = _rapRperiAxiFindStart ( self . _R , E , L , self . _pot , startsign = startsign ) if rstart == 0. : rperi = 0. else : rperi = optimize . brentq ( _rapRperiAxiEq , rstart , rap - 0.000001 , args = ( E , L , self . _pot ) ) else : if self . _gamma != 0. : startsign = _rapRperiAxiEq ( self . _R , E , L , self . _pot ) startsign /= m . fabs ( startsign ) else : startsign = 1. rstart = _rapRperiAxiFindStart ( self . _R , E , L , self . _pot , startsign = startsign ) if rstart == 0. : rperi = 0. else : try : rperi = optimize . brentq ( _rapRperiAxiEq , rstart , self . _R , ( E , L , self . _pot ) , maxiter = 200 ) except RuntimeError : raise UnboundError ( "Orbit seems to be unbound" ) rend = _rapRperiAxiFindStart ( self . _R , E , L , self . _pot , rap = True , startsign = startsign ) rap = optimize . brentq ( _rapRperiAxiEq , self . _R , rend , ( E , L , self . _pot ) ) self . _rperirap = ( rperi , rap ) return self . _rperirap
NAME:
           calcRapRperi
        PURPOSE:
           calculate the apocenter and pericenter radii
        INPUT:
        OUTPUT:
           (rperi,rap)
        HISTORY:
           2010-12-01 - Written - Bovy (NYU)