import numpy as np import numpy.random as npr from scipy.optimize import curve_fit import matplotlib matplotlib.use('pdf') import matplotlib.pyplot as plt import pdb import gi_params gp = gi_params.Params() import gravimage gravimage.prepare_data(gp) import gi_file as gf gf.get_binned_data(gp) import import_path as ip ip.insert_sys_path('/home/psteger/sci/darcoda/gravimage/programs/sphere/') import gi_analytic as ga import gi_physics as phys import gi_class_cube as gcc def traf(x): return np.arctan(x)/np.pi+0.5 # \fn traf(x) # transform [-10,10] interval into [0,1] def invtraf(y): return 2000*(y-0.5) def analytic_rho(x): nn = ga.rho_gaia(x, gp)[0] # 0 for DM, 1 for stars return nn
# import os # os.nice(1) # optionally start with -i and -c switches, to batch start gaia and walk runs from optparse import OptionParser parser = OptionParser() parser.add_option("-i", "--investigation", dest="investigation", default="", help="investigation to run: gaia, walk, hern, triax, discmock") parser.add_option("-c", "--case", dest="case", default='-1', help="case: 1, 2, ..") parser.add_option("-t", "--timestamp", dest="timestamp", default='-1', help="timestamp: 201501221224") (options, args) = parser.parse_args() print('gravimage.py '+options.investigation+' '+str(options.case)+' '+str(options.timestamp)) if options.timestamp != '-1': import gi_base as gb basepath = gb.get_basepath() import import_path as ip ip.insert_sys_path(basepath+"DT"+options.investigation+"/"+options.case+"/"+options.timestamp+"/programs/") import gi_params warnings.simplefilter('ignore') # set to 'error' when debugging gp = gi_params.Params(options.timestamp, options.investigation, int(options.case)) if options.timestamp != '-1': ip.remove_third() #import os #os.system('cd '+basepath+'DT'+options.investigation+'/'+options.case+'/'+options.timestamp) gp.restart = True gp.chi2_Sig_converged = 0 import gi_file as gf def show(filepath): subprocess.call(('xdg-open', filepath)) return ## \fn show(filepath) open the output (pdf) file for the user @param
#!/usr/bin/env ipython3 ## # @file # check deprojection and projection of nu # (c) 2015 Pascal Steger, [email protected] import pdb import numpy as np from pylab import * ion() import import_path as ip ip.insert_sys_path('/home/psteger/sci/darcoda/gravimage/programs/reducedata/') import gi_params as gp import gi_project as gip def run(gp): Rscale = []; Dens0Rscale = []; Dens0pc = []; Totmass_Tracers = [] rscale = []; dens0Rscale = []; dens0pc = []; totmass_tracers = [] for pop in range(3): A = np.loadtxt(gp.files.get_scale_file(pop), unpack=False, skiprows=1) Rscale.append(A[0]) Dens0Rscale.append(A[1]) Dens0pc.append(A[2]) Totmass_Tracers.append(A[3])
#!/usr/bin/env ipython3 import numpy as np import numpy.random as npr from scipy.optimize import curve_fit import matplotlib matplotlib.use('pdf') import matplotlib.pyplot as plt import pdb import gi_params gp = gi_params.Params() import gi_file as gf gf.get_binned_data(gp) import import_path as ip ip.insert_sys_path('/home/psteger/sci/darcoda/gravimage/programs/sphere/') import gravimage gravimage.prepare_data(gp) import gi_analytic as ga import gi_physics as phys import gi_class_cube as gcc gp.debug = True def traf(x): return np.arctan(x)/np.pi+0.5 # \fn traf(x) # transform [-10,10] interval into [0,1]
gh.progressbar((1.0 * current) / numofmodels) MODEL = pickle.load(fi) pc.add(MODEL) except EOFError: pass print("") return pc ## \fn pcload_single_entries(bn, gp) # load all data into [chi^2, profiles] pairs, and add to a profile collection # @param bn string # @param gp global parameters import import_path as ip ip.insert_sys_path(basedir + 'programs/') ip.insert_sys_path(basedir + 'programs/sphere') import gi_params as ngip ngp = ngip.Params(tt) print(ngp) print('ngp.rinfty = ', ngp.rinfty) import select_run as sr ngp.pops = sr.get_pops(basedir) print('working with ', ngp.pops, ' populations') prepare_output_folder(basedir) # check whether we need to read in ngp.dat, or whether we are plotting from inside gravimage main program if len(ngp.dat.Sig) == 0: import gi_file as glf ngp.dat = glf.get_binned_data(ngp) read_scale(ngp) # store half-light radii in gp.Xscale
(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+'/') # find minimum number of iterations for all runs minlinelen = 1e99 #import gi_collection as gc for tt in options.timestamps: linelen = 0 with open(basename+tt+'/pc2.save', 'rb') as fi: dum = pickle.load(fi) # dummy variable try: while True: linelen += 1
#!/usr/bin/env ipython3 ## # @file # check deprojection and projection of nu # (c) 2015 Pascal Steger, [email protected] import pdb import numpy as np from pylab import * ion() import import_path as ip ip.insert_sys_path('/home/psteger/sci/darcoda/gravimage/programs/reducedata/') import gi_params as gp import gi_project as gip def run(gp): Rscale = [] Dens0Rscale = [] Dens0pc = [] Totmass_Tracers = [] rscale = [] dens0Rscale = [] dens0pc = [] totmass_tracers = [] for pop in range(3):
current += 1 if current%100 == 0: gh.progressbar((1.0*current)/numofmodels) MODEL = pickle.load(fi) pc.add(MODEL) except EOFError: pass print("") return pc ## \fn pcload_single_entries(bn, gp) # load all data into [chi^2, profiles] pairs, and add to a profile collection # @param bn string # @param gp global parameters import import_path as ip ip.insert_sys_path(basedir+'programs/') ip.insert_sys_path(basedir+'programs/sphere') import gi_params as ngip ngp = ngip.Params(tt) print(ngp) print('ngp.rinfty = ',ngp.rinfty) import select_run as sr ngp.pops = sr.get_pops(basedir) print('working with ', ngp.pops, ' populations') prepare_output_folder(basedir) # check whether we need to read in ngp.dat, or whether we are plotting from inside gravimage main program if len(ngp.dat.Sig) == 0: import gi_file as glf ngp.dat = glf.get_binned_data(ngp) read_scale(ngp) # store half-light radii in gp.Xscale