def test_isotropic_plummer_beta_directint(): pot= potential.PlummerPotential(amp=2.3,b=1.3) dfp= isotropicPlummerdf(pot=pot) tol= 1e-8 check_beta_directint(dfp,tol,rmin=pot._scale/10.,rmax=pot._scale*10., bins=31) return None
def test_isotropic_plummer_beta(): pot= potential.PlummerPotential(amp=2.3,b=1.3) dfp= isotropicPlummerdf(pot=pot) numpy.random.seed(10) samp= dfp.sample(n=1000000) tol= 6*1e-2 check_beta(samp,pot,tol,rmin=pot._scale/10.,rmax=pot._scale*10.,bins=31) return None
def test_isotropic_plummer_sigmar_directint(): pot= potential.PlummerPotential(amp=2.3,b=1.3) dfp= isotropicPlummerdf(pot=pot) tol= 1e-5 check_sigmar_against_jeans_directint(dfp,pot,tol, rmin=pot._scale/10., rmax=pot._scale*10., bins=31) return None
def test_isotropic_plummer_dens_directint(): pot= potential.PlummerPotential(amp=2.3,b=1.3) dfp= isotropicPlummerdf(pot=pot) tol= 1e-7 check_dens_directint(dfp,pot,tol, lambda r: pot.dens(r,0)/2.3, # need to divide by mass rmin=pot._scale/10., rmax=pot._scale*10.,bins=31) return None
def test_isotropic_plummer_sigmar(): pot= potential.PlummerPotential(amp=2.3,b=1.3) dfp= isotropicPlummerdf(pot=pot) numpy.random.seed(10) samp= dfp.sample(n=1000000) tol= 0.05 check_sigmar_against_jeans(samp,pot,tol, rmin=pot._scale/10.,rmax=pot._scale*10., bins=31) return None
def test_isotropic_plummer_dens_massprofile(): pot= potential.PlummerPotential(amp=2.3,b=1.3) dfp= isotropicPlummerdf(pot=pot) numpy.random.seed(10) samp= dfp.sample(n=100000) tol= 5*1e-3 check_spherical_massprofile(samp,lambda r: pot.mass(r)\ /pot.mass(numpy.amax(samp.r())), tol,skip=1000) return None
def test_isotropic_plummer_dens_spherically_symmetric(): pot= potential.PlummerPotential(amp=2.3,b=1.3) dfp= isotropicPlummerdf(pot=pot) numpy.random.seed(10) samp= dfp.sample(n=100000) # Check spherical symmetry for different harmonics l,m tol= 1e-2 check_spherical_symmetry(samp,0,0,tol) check_spherical_symmetry(samp,1,0,tol) check_spherical_symmetry(samp,1,-1,tol) check_spherical_symmetry(samp,1,1,tol) check_spherical_symmetry(samp,2,0,tol) check_spherical_symmetry(samp,2,-1,tol) check_spherical_symmetry(samp,2,-2,tol) check_spherical_symmetry(samp,2,1,tol) check_spherical_symmetry(samp,2,2,tol) # and some higher order ones check_spherical_symmetry(samp,3,1,tol) check_spherical_symmetry(samp,9,-6,tol) return None
def test_isotropic_plummer_energyoutofbounds(): pot= potential.PlummerPotential(amp=2.3,b=1.3) dfp= isotropicPlummerdf(pot=pot) assert numpy.all(numpy.fabs(dfp((numpy.arange(0.1,10.,0.1),1.1))) < 1e-8), 'Evaluating the isotropic Plummer DF at E > 0 does not give zero' assert numpy.all(numpy.fabs(dfp((pot(0,0)-1e-4,1.1))) < 1e-8), 'Evaluating the isotropic Plummer DF at E < -GM/a does not give zero' return None