def test_king_sigmar_directint(): pot= potential.KingPotential(W0=3.,M=2.3,rt=1.76) dfk= kingdf(W0=3.,M=2.3,rt=1.76) tol= 0.05 # Jeans isn't that accurate for this rather difficult case check_sigmar_against_jeans_directint(dfk,pot,tol,beta=0., rmin=dfk._scale/10., rmax=dfk.rt*0.7,bins=31) return None
def test_king_dens_directint(): pot= potential.KingPotential(W0=3.,M=2.3,rt=1.76) dfk= kingdf(W0=3.,M=2.3,rt=1.76) tol= 0.02 check_dens_directint(dfk,pot,tol, lambda r: dfk.dens(r)/2.3, # need to divide by mass rmin=dfk._scale/10., rmax=dfk.rt*0.7,bins=31) return None
def test_king_dens_massprofile(): pot= potential.KingPotential(W0=3.,M=2.3,rt=1.76) dfk= kingdf(W0=3.,M=2.3,rt=1.76) numpy.random.seed(10) samp= dfk.sample(n=100000) tol= 1e-2 check_spherical_massprofile(samp,lambda r: pot.mass(r)\ /pot.mass(numpy.amax(samp.r())), tol,skip=4000) return None
def test_king_beta(): pot= potential.KingPotential(W0=3.,M=2.3,rt=1.76) dfk= kingdf(W0=3.,M=2.3,rt=1.76) numpy.random.seed(10) samp= dfk.sample(n=1000000) tol= 6*1e-2 # lower tolerance closer to rt because fewer stars there tol= 0.12 check_beta(samp,pot,tol,beta=0.,rmin=dfk._scale/10.,rmax=dfk.rt, bins=31) return None
def test_king_sigmar(): W0s= [1.,3.,9.] for W0 in W0s: pot= potential.KingPotential(W0=W0,M=2.3,rt=1.76) dfk= kingdf(W0=W0,M=2.3,rt=1.76) numpy.random.seed(10) samp= dfk.sample(n=1000000) # lower tolerance closer to rt because fewer stars there tol= 0.09 check_sigmar_against_jeans(samp,pot,tol,beta=0., rmin=dfk._scale/10.,rmax=dfk.rt*0.7,bins=31) tol= 0.2 check_sigmar_against_jeans(samp,pot,tol,beta=0., rmin=dfk.rt*0.8,rmax=dfk.rt*0.95,bins=5) return None