def oortA(self,R,t=0.,nsigma=None,deg=False,phi=0.,
              epsrel=1.e-02,epsabs=1.e-05,
              grid=None,gridpoints=101,returnGrids=False,
              derivRGrid=None,derivphiGrid=None,derivGridpoints=101,
              derivHierarchgrid=False,
              hierarchgrid=False,nlevels=2,integrate_method='dopr54_c'):
        """
        NAME:

           oortA

        PURPOSE:

           calculate the Oort function A at (R,phi,t)

        INPUT:

           R - radius at which to calculate A (can be Quantity)

           phi= azimuth (rad unless deg=True; can be Quantity

           t= time at which to evaluate the DF (can be a list or ndarray; if this is the case, list needs to be in descending order and equally spaced) (can be Quantity)

           nsigma - number of sigma to integrate the velocities over (based on an estimate, so be generous)

           deg= azimuth is in degree (default=False); do not set this when giving phi as a Quantity

           epsrel, epsabs - scipy.integrate keywords

           grid= if set to True, build a grid and use that to evaluate integrals; if set to a grid-objects (such as returned by this procedure), use this grid

           derivRGrid, derivphiGrid= if set to True, build a grid and use that to evaluate integrals of the derivatives of the DF;if set to a grid-objects (such as returned by this procedure), use this grid
           
           gridpoints= number of points to use for the grid in 1D (default=101)

           derivGridpoints= number of points to use for the grid in 1D (default=101)

           returnGrid= if True, return the grid objects (default=False)

           hierarchgrid= if True, use a hierarchical grid (default=False)

           derivHierarchgrid= if True, use a hierarchical grid (default=False)

           nlevels= number of hierarchical levels for the hierarchical grid

           integrate_method= orbit.integrate method argument

        OUTPUT:

           Oort A at R,phi,t

        HISTORY:

           2011-10-16 - Written - Bovy (NYU)

        """
        #First calculate the grids if they are not given
        if isinstance(grid,bool) and grid:
            (surfacemass,grid)= self.vmomentsurfacemass(R,0,0,deg=deg,t=t,phi=phi,
                                                        nsigma=nsigma,epsrel=epsrel,
                                                        epsabs=epsabs,grid=True,
                                                        gridpoints=gridpoints,
                                                        returnGrid=True,
                                                        hierarchgrid=hierarchgrid,
                                                        nlevels=nlevels,
                                                        integrate_method=integrate_method)
        elif isinstance(grid,evolveddiskdfGrid) or \
                isinstance(grid,evolveddiskdfHierarchicalGrid):
            surfacemass= self.vmomentsurfacemass(R,0,0,deg=deg,t=t,phi=phi,
                                                 nsigma=nsigma,epsrel=epsrel,
                                                 epsabs=epsabs,grid=grid,
                                                 gridpoints=gridpoints,
                                                 returnGrid=False,
                                                 hierarchgrid=hierarchgrid,
                                                 nlevels=nlevels,
                                                 integrate_method=integrate_method)
        if isinstance(derivRGrid,bool) and derivRGrid:
            (dsurfacemassdR,derivRGrid)= self.vmomentsurfacemass(R,0,0,deg=deg,t=t,phi=phi,
                                                                 nsigma=nsigma,epsrel=epsrel,
                                                                 epsabs=epsabs,grid=True,
                                                                 gridpoints=derivGridpoints,
                                                                 returnGrid=True,
                                                                 hierarchgrid=derivHierarchgrid,
                                                                 nlevels=nlevels,
                                                                 integrate_method=integrate_method,deriv='R')
        elif isinstance(derivRGrid,evolveddiskdfGrid) or \
                isinstance(derivRGrid,evolveddiskdfHierarchicalGrid):
            dsurfacemassdR= self.vmomentsurfacemass(R,0,0,deg=deg,t=t,phi=phi,
                                                    nsigma=nsigma,epsrel=epsrel,
                                                    epsabs=epsabs,grid=derivRGrid,
                                                    gridpoints=derivGridpoints,
                                                    returnGrid=False,
                                                    hierarchgrid=derivHierarchgrid,
                                                    nlevels=nlevels,
                                                    integrate_method=integrate_method,deriv='R')
        if isinstance(derivphiGrid,bool) and derivphiGrid:
            (dsurfacemassdphi,derivphiGrid)= self.vmomentsurfacemass(R,0,0,deg=deg,t=t,phi=phi,
                                                                     nsigma=nsigma,epsrel=epsrel,
                                                                     epsabs=epsabs,grid=True,
                                                                     gridpoints=derivGridpoints,
                                                                     returnGrid=True,
                                                                     hierarchgrid=derivHierarchgrid,
                                                                     nlevels=nlevels,
                                                                     integrate_method=integrate_method,deriv='phi')
        elif isinstance(derivphiGrid,evolveddiskdfGrid) or \
                isinstance(derivphiGrid,evolveddiskdfHierarchicalGrid):
            dsurfacemassdphi= self.vmomentsurfacemass(R,0,0,deg=deg,t=t,phi=phi,
                                                      nsigma=nsigma,epsrel=epsrel,
                                                      epsabs=epsabs,grid=derivphiGrid,
                                                      gridpoints=derivGridpoints,
                                                      returnGrid=False,
                                                      hierarchgrid=derivHierarchgrid,
                                                      nlevels=nlevels,
                                                      integrate_method=integrate_method,deriv='phi')
        #2A= meanvT/R-dmeanvR/R/dphi-dmeanvphi/dR
        #meanvT
        meanvT= self.meanvT(R,t=t,nsigma=nsigma,deg=deg,phi=phi,
                            epsrel=epsrel,epsabs=epsabs,
                            grid=grid,gridpoints=gridpoints,returnGrid=False,
                            surfacemass=surfacemass,
                            hierarchgrid=hierarchgrid,
                            nlevels=nlevels,integrate_method=integrate_method,
                            use_physical=False)
        dmeanvRdphi= (self.vmomentsurfacemass(R,1,0,deg=deg,t=t,phi=phi,
                                              nsigma=nsigma,epsrel=epsrel,
                                              epsabs=epsabs,grid=derivphiGrid,
                                              gridpoints=derivGridpoints,
                                              returnGrid=False,
                                              hierarchgrid=derivHierarchgrid,
                                              nlevels=nlevels,
                                              integrate_method=integrate_method,deriv='phi')
                      /surfacemass
                      -self.vmomentsurfacemass(R,1,0,deg=deg,t=t,phi=phi,
                                               nsigma=nsigma,epsrel=epsrel,
                                               epsabs=epsabs,grid=grid,
                                               gridpoints=gridpoints,
                                               returnGrid=False,
                                               hierarchgrid=hierarchgrid,
                                               nlevels=nlevels,
                                               integrate_method=integrate_method)
                      /surfacemass**2.*dsurfacemassdphi)
        dmeanvTdR= (self.vmomentsurfacemass(R,0,1,deg=deg,t=t,phi=phi,
                                            nsigma=nsigma,epsrel=epsrel,
                                            epsabs=epsabs,grid=derivRGrid,
                                            gridpoints=derivGridpoints,
                                            returnGrid=False,
                                            hierarchgrid=derivHierarchgrid,
                                            nlevels=nlevels,
                                            integrate_method=integrate_method,deriv='R')
                    /surfacemass
                    -self.vmomentsurfacemass(R,0,1,deg=deg,t=t,phi=phi,
                                               nsigma=nsigma,epsrel=epsrel,
                                               epsabs=epsabs,grid=grid,
                                               gridpoints=gridpoints,
                                               returnGrid=False,
                                               hierarchgrid=hierarchgrid,
                                               nlevels=nlevels,
                                               integrate_method=integrate_method)
                      /surfacemass**2.*dsurfacemassdR)
        if returnGrids:
            return (0.5*(meanvT/R-dmeanvRdphi/R-dmeanvTdR),grid,
                    derivRGrid,derivphiGrid)
        else:
            return 0.5*(meanvT/R-dmeanvRdphi/R-dmeanvTdR)
def oortA ( self , R , t = 0. , nsigma = None , deg = False , phi = 0. , epsrel = 1.e-02 , epsabs = 1.e-05 , grid = None , gridpoints = 101 , returnGrids = False , derivRGrid = None , derivphiGrid = None , derivGridpoints = 101 , derivHierarchgrid = False , hierarchgrid = False , nlevels = 2 , integrate_method = 'dopr54_c' ) : if isinstance ( grid , bool ) and grid : ( surfacemass , grid ) = self . vmomentsurfacemass ( R , 0 , 0 , deg = deg , t = t , phi = phi , nsigma = nsigma , epsrel = epsrel , epsabs = epsabs , grid = True , gridpoints = gridpoints , returnGrid = True , hierarchgrid = hierarchgrid , nlevels = nlevels , integrate_method = integrate_method ) elif isinstance ( grid , evolveddiskdfGrid ) or isinstance ( grid , evolveddiskdfHierarchicalGrid ) : surfacemass = self . vmomentsurfacemass ( R , 0 , 0 , deg = deg , t = t , phi = phi , nsigma = nsigma , epsrel = epsrel , epsabs = epsabs , grid = grid , gridpoints = gridpoints , returnGrid = False , hierarchgrid = hierarchgrid , nlevels = nlevels , integrate_method = integrate_method ) if isinstance ( derivRGrid , bool ) and derivRGrid : ( dsurfacemassdR , derivRGrid ) = self . vmomentsurfacemass ( R , 0 , 0 , deg = deg , t = t , phi = phi , nsigma = nsigma , epsrel = epsrel , epsabs = epsabs , grid = True , gridpoints = derivGridpoints , returnGrid = True , hierarchgrid = derivHierarchgrid , nlevels = nlevels , integrate_method = integrate_method , deriv = 'R' ) elif isinstance ( derivRGrid , evolveddiskdfGrid ) or isinstance ( derivRGrid , evolveddiskdfHierarchicalGrid ) : dsurfacemassdR = self . vmomentsurfacemass ( R , 0 , 0 , deg = deg , t = t , phi = phi , nsigma = nsigma , epsrel = epsrel , epsabs = epsabs , grid = derivRGrid , gridpoints = derivGridpoints , returnGrid = False , hierarchgrid = derivHierarchgrid , nlevels = nlevels , integrate_method = integrate_method , deriv = 'R' ) if isinstance ( derivphiGrid , bool ) and derivphiGrid : ( dsurfacemassdphi , derivphiGrid ) = self . vmomentsurfacemass ( R , 0 , 0 , deg = deg , t = t , phi = phi , nsigma = nsigma , epsrel = epsrel , epsabs = epsabs , grid = True , gridpoints = derivGridpoints , returnGrid = True , hierarchgrid = derivHierarchgrid , nlevels = nlevels , integrate_method = integrate_method , deriv = 'phi' ) elif isinstance ( derivphiGrid , evolveddiskdfGrid ) or isinstance ( derivphiGrid , evolveddiskdfHierarchicalGrid ) : dsurfacemassdphi = self . vmomentsurfacemass ( R , 0 , 0 , deg = deg , t = t , phi = phi , nsigma = nsigma , epsrel = epsrel , epsabs = epsabs , grid = derivphiGrid , gridpoints = derivGridpoints , returnGrid = False , hierarchgrid = derivHierarchgrid , nlevels = nlevels , integrate_method = integrate_method , deriv = 'phi' ) meanvT = self . meanvT ( R , t = t , nsigma = nsigma , deg = deg , phi = phi , epsrel = epsrel , epsabs = epsabs , grid = grid , gridpoints = gridpoints , returnGrid = False , surfacemass = surfacemass , hierarchgrid = hierarchgrid , nlevels = nlevels , integrate_method = integrate_method , use_physical = False ) dmeanvRdphi = ( self . vmomentsurfacemass ( R , 1 , 0 , deg = deg , t = t , phi = phi , nsigma = nsigma , epsrel = epsrel , epsabs = epsabs , grid = derivphiGrid , gridpoints = derivGridpoints , returnGrid = False , hierarchgrid = derivHierarchgrid , nlevels = nlevels , integrate_method = integrate_method , deriv = 'phi' ) / surfacemass - self . vmomentsurfacemass ( R , 1 , 0 , deg = deg , t = t , phi = phi , nsigma = nsigma , epsrel = epsrel , epsabs = epsabs , grid = grid , gridpoints = gridpoints , returnGrid = False , hierarchgrid = hierarchgrid , nlevels = nlevels , integrate_method = integrate_method ) / surfacemass ** 2. * dsurfacemassdphi ) dmeanvTdR = ( self . vmomentsurfacemass ( R , 0 , 1 , deg = deg , t = t , phi = phi , nsigma = nsigma , epsrel = epsrel , epsabs = epsabs , grid = derivRGrid , gridpoints = derivGridpoints , returnGrid = False , hierarchgrid = derivHierarchgrid , nlevels = nlevels , integrate_method = integrate_method , deriv = 'R' ) / surfacemass - self . vmomentsurfacemass ( R , 0 , 1 , deg = deg , t = t , phi = phi , nsigma = nsigma , epsrel = epsrel , epsabs = epsabs , grid = grid , gridpoints = gridpoints , returnGrid = False , hierarchgrid = hierarchgrid , nlevels = nlevels , integrate_method = integrate_method ) / surfacemass ** 2. * dsurfacemassdR ) if returnGrids : return ( 0.5 * ( meanvT / R - dmeanvRdphi / R - dmeanvTdR ) , grid , derivRGrid , derivphiGrid ) else : return 0.5 * ( meanvT / R - dmeanvRdphi / R - dmeanvTdR )
NAME:

           oortA

        PURPOSE:

           calculate the Oort function A at (R,phi,t)

        INPUT:

           R - radius at which to calculate A (can be Quantity)

           phi= azimuth (rad unless deg=True; can be Quantity

           t= time at which to evaluate the DF (can be a list or ndarray; if this is the case, list needs to be in descending order and equally spaced) (can be Quantity)

           nsigma - number of sigma to integrate the velocities over (based on an estimate, so be generous)

           deg= azimuth is in degree (default=False); do not set this when giving phi as a Quantity

           epsrel, epsabs - scipy.integrate keywords

           grid= if set to True, build a grid and use that to evaluate integrals; if set to a grid-objects (such as returned by this procedure), use this grid

           derivRGrid, derivphiGrid= if set to True, build a grid and use that to evaluate integrals of the derivatives of the DF;if set to a grid-objects (such as returned by this procedure), use this grid
           
           gridpoints= number of points to use for the grid in 1D (default=101)

           derivGridpoints= number of points to use for the grid in 1D (default=101)

           returnGrid= if True, return the grid objects (default=False)

           hierarchgrid= if True, use a hierarchical grid (default=False)

           derivHierarchgrid= if True, use a hierarchical grid (default=False)

           nlevels= number of hierarchical levels for the hierarchical grid

           integrate_method= orbit.integrate method argument

        OUTPUT:

           Oort A at R,phi,t

        HISTORY:

           2011-10-16 - Written - Bovy (NYU)