コード例 #1
0
ファイル: plot_multinest.py プロジェクト: sofiasi/darcoda
def plot_analytic(r0, prof, pop=0):
    if gp.investigate == 'gaia':
        if prof=="rho":
            analytic = ga.rhogaiatot_3D(r0)
        elif prof=="nr":
            analytic = ga.nrgaiatot_3D(r0)
        elif prof=="beta":
            analytic = ga.betagaia(r0)
        elif prof=="betastar":
            b = ga.betagaia(r0)
            analytic = b/(2.-b)
        elif prof=="nu":
            analytic_3D = ga.nugaiatot_3D(r0)
            analytic = rho_INT_Rho(r0, analytic_3D)
        elif prof=="sig":
            analytic = 0.*r0 # TODO
    elif gp.investigate == 'walk':
        if prof=='rho':
            analytic = ga.rhowalk_3D(r0)[pop]
        elif prof=='nr':
            analytic = ga.rhowalk_3D(r0)[pop] # TODO
        elif prof=='beta':
            analytic = ga.walker_delta(pop, r0) # TODO
        elif prof=='betastar':                  # TODO
            b = ga.walker_delta(pop, r0)
            analytic = b/(2.-b)
        elif prof=='nu':                # TODO: mass ratio M_tracer/M_DM
            pdb.set_trace()
            analytic_3D = ga.rhowalk_3D(r0)[pop]
            analytic = rho_INT_Rho(r0, analytic_3D)
        elif prof=='sig':
            analytic = 0.*r0            # TODO
    gpl.plot(r0, analytic, 'b')
    return analytic
コード例 #2
0
ファイル: plot_multinest.py プロジェクト: sofiasi/darcoda
def fill_nice(r0, M95lo, M68lo, Mmedi, M68hi, M95hi):
    gpl.fill_between(r0, M95lo, M95hi, color='black', alpha=0.2, lw=0.1)
    gpl.plot(r0, M95lo, color='black', lw=0.4)
    gpl.plot(r0, M95hi, color='black', lw=0.3)
    gpl.fill_between(r0, M68lo, M68hi, color='black', alpha=0.4, lw=0.1)
    gpl.plot(r0, M68lo, color='black', lw=0.4)
    gpl.plot(r0, M68hi, color='black', lw=0.3)
    gpl.plot(r0, Mmedi, 'r', lw=1)
    gpl.axvline(gp.rstarhalf, color='gray', lw=0.5) # [pc]
    gpl.xlim([r0[0], r0[-1]])
    return
コード例 #3
0
ファイル: test_deproject.py プロジェクト: sofiasi/darcoda
# (c) 2013 [email protected]

import numpy as np
import pdb

import gl_params
import gl_plot as gpl
from gl_project import *
from gl_analytic import *

r0 = np.arange(0.1,3.0,0.1)
rho0 = rho_anf(r0,1.,1.e6)
Rho0 = Sigma_anf(r0,1.,1.e6)
gpl.ion()
gpl.start()
# gpl.yscale('linear')

gpl.plot(r0, Rho0, color='blue', lw=2)
# gpl.plot(r0, rho_INTDIRECT_Rho(r0, rho0), color='blue')
try:
    Rhonu = rho_INT_Rho(r0,rho0)
except Exception as detail:
    print('NaN in rho_INT_Rho')
gpl.plot(r0, Rhonu, '.', color='red')
# pdb.set_trace()
print('error fraction determined/true = ',Rhonu/Rho0)
print('gp.ascale = ',gp.ascale)
print('gp.Mscale = ',gp.Mscale)
gpl.ioff(); gpl.show()
コード例 #4
0
ファイル: test_splines.py プロジェクト: sofiasi/darcoda
import pdb
from scipy.interpolate import splrep, splev
import gl_plot as gpl


xnew = np.array([   0.   ,   40.156,   58.552,   74.426,   91.87 ,  110.166,
        130.44 ,  155.967,  192.224,  248.297,  255.215,  262.119,
        269.01 ,  275.887])

ynew = np.array([ 2426.404,  2294.581,  1828.642,  1144.447,   918.291,   681.606,
         321.61 ,   200.627,   116.21 ,    19.241,    17.438,    14.488,
          12.037,    10.   ])

errorinpercent = npr.uniform(0.05, 0.15, len(xnew))

gpl.plot(xnew,ynew,'.',lw=2)
gpl.fill_between(xnew,ynew*(1.-errorinpercent),ynew*(1.+errorinpercent),alpha=0.5,color='blue')

# gives warning
pdb.set_trace()
tcknu  = splrep(xnew, ynew, k=2, s=0.1) # interpolation in real space
gpl.plot(xnew, splev(xnew,splrep(xnew,ynew, k=2, s=0.1)))

# try with third order
tcknu  = splrep(xnew, ynew, k=3, s=0.1) # interpolation in real space

# better, uses weights

w = 1/(errorinpercent*ynew)
tcknu  = splrep(xnew, ynew, w=w, k=2, s=0.1) # interpolation in real space
コード例 #5
0
ファイル: test_siglos.py プロジェクト: sofiasi/darcoda
import gl_params
import gl_plot as gpl
from gl_project import *
from gl_int import *
from gl_analytic import *

gpl.ion()
gpl.start()

r0 = np.arange(0.05, 3.0, 0.11) * 1000
ascale = 1000.0
Mscale = 1.0e6
nuanf = rho_anf(r0, ascale, Mscale)
rhoanf = rho_anf(r0, ascale, Mscale) * (1.0 + npr.uniform(-1.0, 1.0, len(r0)))
gpl.plot(r0, rhoanf, ".", color="cyan", label=r"$\rho$")
gpl.plot(r0, rho_anf(r0, ascale, Mscale), color="cyan", lw=1)
betaanf = np.zeros(len(r0))
intbetaanf = np.zeros(len(r0))

# gpl.yscale('linear')

# surface density
Siganf = Sigma_anf(r0, ascale, Mscale)
gpl.plot(r0, Siganf, color="blue", lw=1)
Rhoself = rho_INT_Rho(r0, rhoanf)
gpl.plot(r0, Rhoself, ".", color="blue", label=r"$\Sigma$")
# gpl.plot(r0, M_anf(r0,1.,1.e6), color='blue')

# sigma_r^2
# gpl.plot(r0, sig_r_2_anf(r0, ascale, Mscale), color='green', lw=1)