コード例 #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_gaia.py プロジェクト: sofiasi/darcoda
def plotGraph():
    fig = figure()
    xlabel(r'$r\quad[\mathrm{pc}]$')
    if prof == 'M':
        ylabel(r'$M\quad[\mathrm{M}_{\odot}]$') #[10^5 M_{\odot}]')
    elif prof == 'rho':
        ylabel(r'$\rho\quad[\mathrm{M}_{\odot}/\mathrm{pc}^3]$') #[10^5 M_{\odot}]')
    elif prof=='delta1' or prof == 'delta2':
        ylabel(r'$\beta$') #[10^5 M_{\odot}]')
    elif prof == 'nu1':
        ylabel(r'$\nu_1$')
    elif prof == 'sig1':
        ylabel(r'$\sigma_1$')
        
    fill_between(radsc, M95lo*Msc, M95hi*Msc, color='black',alpha=0.2,lw=1)
    fill_between(radsc, M68lo*Msc, M68hi*Msc, color='black',alpha=0.4,lw=1)
    plot(radsc,Mmedi*Msc,'r',lw=1)
    
    r1 = halflightradius(gp.case)
    if prof == 'rho' or prof == 'M' or prof=='beta1' or prof=='nu1' or prof=='sig1':
        axvline(x=r1, visible=True)
    
    # theoretical model
    if prof == 'M':
        plot(radsc,Msc*Mwalkertot(radsc),'--',color='black',lw=1)
    elif prof == 'rho':
        plot(radsc,Msc*rhogaiatot_3D(radsc),'--',color='black',lw=1) # 7 co
        # plot lowest profile as well
        # plot(radsc,Msc*profs[0],'.',color='orange',lw=1)
    elif prof == 'beta1':
        plot(radsc, betagaia(radsc), color='black')
    elif prof == 'sig1':
        rad, dummy, dummy, sig1, sigerr1 = gh.readcol5(gp.files.sigfiles[1])
        rad *= gp.Rscale[1]
        sig1*=gp.maxvlos[1]
        sigerr1*=gp.maxvlos[1]
        # plot(rad, sig1, '--', color='b', lw=2)
        # plot(rad, sig1-sigerr1, '--', color='b', lw=1)
        # plot(rad, sig1+sigerr1, '--', color='b', lw=1)
        fill_between(rad, sig1-sigerr1, sig1+sigerr1, color='blue', alpha=0.3,lw=0)
    elif prof == 'nu1':
        rad, dummy, dummy, nu1, nuerr1 = gh.readcol5(gp.files.nufiles[1])
        rad *= gp.Rscale[1]
        # TODO: missing factor 10 somewhere..
        pdb.set_trace()
        nu1 *= gp.Nu0pc[1];   nuerr1 *= gp.Nu0pc[1]
        fill_between(rad, nu1-nuerr1, nu1+nuerr1, color='blue', alpha=0.3,lw=0)

    if prof!='delta1' and prof!='delta2' and prof != 'sig1' and prof != 'nu1':
        # xscale('log')
        yscale('log')
    if prof == 'nu1':
        yscale('log')
    if prof == "M" or prof == 'rho':
        xscale('log')
        #xlim([100.,1200.]);  ylim([0.005,1.5])
    # if prof == 'delta1':
    #     xlim([100.,1200.]);  ylim([-0.15,0.9])

    return fig