示例#1
0
# @param gp global parameters

if __name__ == '__main__':
    parser = OptionParser()
    parser.add_option("-i", "--investigation", dest="investigate", default="", help="investigation to plot")
    parser.add_option("-c", "--case",          dest="case",        default=-1, help="case to plot")
    parser.add_option("-l", "--latest", help='plot latest one', dest = 'latest', default = False, action = 'store_true')
    parser.add_option("-t", "--timestamps", help='take all models from following timestamps', dest='timestamps', default=[], action='append')
    # parser.add_option("-t", "--timestamp", dest="timestamp", default=-1, help="timestamp of run to plot. Overrides -l")
    # parser.add_option("-a", "--action", dest="action", default="p", help="action to take: p: print, k: kill")
    (options, args) = parser.parse_args()

    # gh.LOG(1, 'plot_profiles '+str(options.investigate)+' '+str(options.case)+' '+str(options.latest))
    if len(options.timestamps) == 0:
        import select_run as sr
        timestamp, basename = sr.run(options.investigate, options.case, options.latest)
        options.timestamps=[timestamp]
    else:
        import gi_base as gb
        basepath = gb.get_basepath()
        basename = os.path.abspath(basepath+'DT'+options.investigate+'/'+str(options.case))+'/'

    # use last timestamp for sample gp
    import import_path as ip
    tt = options.timestamps[-1]
    ip.insert_sys_path(basename+tt+'/programs/')
    ip.insert_sys_path(basename+tt+'/programs/sphere')
    import gi_params as gip
    gp = gip.Params(tt)
    gp.pops = sr.get_pops(basename+tt+'/')
示例#2
0
    if prof=='rho' or prof=='nu':
        gpl.startlog(); gpl.xscale('log')
    else:
        gpl.start()
    plot_labels(prof, pop)
            
    if prof=='nr':
        gpl.xscale('log')
        # gpl.xlim([0.,2.*gp.xipol[-1]])
        gp.xipol = np.hstack([gp.xipol[0]/2., gp.xipol, gp.rinfty*gp.xipol[-1]])
    if prof=='nu' or prof=='sig':
        plot_data(gp.xipol, prof, pop)
    plot_analytic(gp.xepol, prof, pop)

    radfill = gp.xepol
    if prof == 'sig':
        radfill = gp.xipol
    fill_nice(radfill, M95lo, M68lo, Mmedi, M68hi, M95hi)

    gpl.savefig(basename+'/prof_'+prof+'_'+str(pop)+'.png')
    gpl.ion(); gpl.show(); gpl.ioff()
    return
## \fn run()
# main functionality

if __name__=="__main__":
    import select_run
    basename, prof, pop = select_run.run()
    run(basename, prof)
    gpl.show()
示例#3
0
#!/usr/bin/python
# (c) 2013 Pascal Steger, [email protected]

import numpy as np
from pylab import *
import pdb
from scipy.interpolate import Rbf, InterpolatedUnivariateSpline
from gl_analytic import Mwalkertot, rhowalkertot_3D
from matplotlib.backends.backend_pdf import PdfPages

# Walker data sets
import select_run
basename, prof = select_run.run()

def M_anf(r):
    return r**2/(r+1.)**2

def ipol(xin,yin,xout,smooth=1.e-9):
    rbf = Rbf(xin, yin, smooth=smooth)
    return rbf(xout)

def ipollog(xin,yin,xout,smooth=1.e-9):
    rbf = Rbf(xin, np.log10(yin), smooth=smooth)
    return 10**(rbf(xout))

def setlabels(ax,xtext,ytext):
    ax.set_xlabel(r'$'+xtext+'$')
    ax.set_ylabel(r'$'+ytext+'$')

def setlims(ax,xlim,ylim):
    ax.set_xlim(xlim)