from lenstools.utils import MPIWhirlPool from lenstools.pipeline.simulation import SimulationBatch #Get the resource to compress def shear(model, batch): full_path = model.collections[0].getCatalog("Shear").storage_subdir rel_path = os.path.relpath(full_path, batch.environment.storage) return rel_path #MPIPool try: pool = MPIWhirlPool() except: pool = None #Current simulation batch batch = SimulationBatch.current() models = batch.models archive_names = ["archive/{0}.tar.gz".format(m.cosmo_id) for m in models] batch.archive(archive_names, pool=pool, resource=shear, chunk_size=1, batch=batch) pool.comm.Barrier()
catalog = CatalogSettings.read("../catalog.ini") zmax = 3.1 box_size_Mpc_over_h = 240.0 nside = 512 lens_thickness_Mpc = 80.0 #NGenIC ngenic.GlassFile = lenstools.data("dummy_glass_little_endian.dat") #Gadget gadget2.NumFilesPerSnapshot = 16 #Init batch if "--git" in sys.argv: batch = SimulationBatch.current(syshandler=git) else: batch = SimulationBatch.current() if "--tree" in sys.argv: #Add all the models,collections and one realization seed = np.random.randint(10000000) p = np.load("../../data/Om-si8.npy") d = list() for Om,si8 in p: #Lay down directory tree cosmo = LensToolsCosmology(Om0=Om,Ode0=1-Om,w0=-1.,sigma8=si8)
#Get the resource to compress def shear(model,batch,search_string): full_path = model[search_string].storage rel_path = os.path.relpath(full_path,batch.environment.storage) return rel_path #MPIPool try: pool = MPIWhirlPool() except: pool = None #Parse command line arguments parser = argparse.ArgumentParser() parser.add_argument("-e","--environment",dest="env_file",action="store",type=str,default="environment.ini",help="environment option file") parser.add_argument("-a","--archive",dest="archive",action="store",type=str,default="archive/{0}.tar.gz",help="archive name format") parser.add_argument("-s","--search",dest="search",action="store",type=str,default="c0C0",help="search string that when dialed points to the resource") cmd_args = parser.parse_args() #Current simulation batch batch = SimulationBatch.current(cmd_args.env_file) models = batch.models archive_names = [cmd_args.archive.format(m.cosmo_id) for m in models] batch.archive(archive_names,pool=pool,resource=shear,chunk_size=1,batch=batch,search_string=cmd_args.search) pool.comm.Barrier()
zmax = 3.1 box_size_Mpc_over_h = 260.0 nside = 512 lens_thickness_Mpc = 120.0 #NGenIC ngenic.GlassFile = lenstools.data("dummy_glass_little_endian.dat") #Gadget gadget2.NumFilesPerSnapshot = 24 #Init batch if "--git" in sys.argv: batch = SimulationBatch.current(syshandler=git) if batch is None: environment = EnvironmentSettings(home="/Users/andreapetri/Documents/Columbia/Simulations/LSST100parameters/Test/Home",storage="/Users/andreapetri/Documents/Columbia/Simulations/LSST100parameters/Test/Storage") batch = SimulationBatch(environment,syshandler=git) else: batch = SimulationBatch.current() if batch is None: environment = EnvironmentSettings(home="/Users/andreapetri/Documents/Columbia/Simulations/LSST100parameters/Test/Home",storage="/Users/andreapetri/Documents/Columbia/Simulations/LSST100parameters/Test/Storage") batch = SimulationBatch(environment) if "--tree" in sys.argv: #Add all the models,collections and one realization seed = 5616559
#!/usr/bin/env python-mpi import os from lenstools.utils import MPIWhirlPool from lenstools.pipeline.simulation import SimulationBatch #MPIPool try: pool = MPIWhirlPool() except: pool = None #Current simulation batch batch = SimulationBatch.current() batch.unpack(where='/scratch3/scratchdirs/apetri/archive',pool=pool) pool.comm.Barrier()
from operator import add from functools import reduce import numpy as np import astropy.units as u import matplotlib import matplotlib.pyplot as plt import seaborn as sns from lenstools.pipeline.simulation import SimulationBatch from lenstools import ConvergenceMap,GaussianNoiseGenerator,Ensemble from lenstools.statistics.constraints import FisherAnalysis #Simulation batch handler batch = SimulationBatch.current("/Users/andreapetri/Documents/Columbia/Simulations/DEBatch/environment.ini") batchCov = SimulationBatch.current("/Users/andreapetri/Documents/Columbia/Simulations/CovarianceBatch/environment.ini") models = batch.models fiducial = batch.getModel("Om0.260_Ode0.740_w-1.000_wa0.000_si0.800") variations = ( map(lambda m:batch.getModel(m),["Om0.290_Ode0.710_w-1.000_wa0.000_si0.800","Om0.260_Ode0.740_w-0.800_wa0.000_si0.800","Om0.260_Ode0.740_w-1.000_wa0.000_si0.900"]), map(lambda m:batch.getModel(m),["Om0.230_Ode0.770_w-1.000_wa0.000_si0.800","Om0.260_Ode0.740_w-1.200_wa0.000_si0.800","Om0.260_Ode0.740_w-1.000_wa0.000_si0.700"]) ) plab = { "Om":r"$\Omega_m$", "w0":r"$w_0$", "wa":r"$w_a$", "si8":r"$\sigma_8$" }