Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
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
Esempio n. 4
0
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
Esempio n. 5
0
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
Esempio n. 6
0
def test_king_dens_spherically_symmetric():
    dfk= kingdf(W0=3.,M=2.3,rt=1.76)
    numpy.random.seed(10)
    samp= dfk.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
Esempio n. 7
0
def test_king_beta_directint():
    dfk= kingdf(W0=3.,M=2.3,rt=1.76)
    tol= 1e-8
    check_beta_directint(dfk,tol,beta=0.,
                         rmin=dfk._scale/10.,rmax=dfk.rt*0.7,bins=31)
    return None