Page MenuHomec4science

gsteps
No OneTemporary

File Metadata

Created
Fri, Jul 19, 17:05
#!/usr/bin/env python
'''
Extract timesteps (scale factor, reshift and cosmic time) from info.txt files
Yves Revaz
lun oct 23 09:34:20 CEST 2006
'''
import os, sys, string
from optparse import OptionParser
from Gtools import *
from Gtools import io
from Gtools import cosmo
from optparse import OptionParser
def parse_options():
usage = "usage: %prog [options] file"
parser = OptionParser(usage=usage)
parser.add_option("--OmegaLambda",
action="store",
dest="OmegaLambda",
type="float",
default = 0.7,
help="OmegaLambda",
metavar=" FLOAT")
parser.add_option("--Omega0",
action="store",
dest="Omega0",
type="float",
default = 0.3,
help="Omega0",
metavar=" FLOAT")
parser.add_option("--Hubble",
action="store",
dest="Hubble",
type="float",
default = 0.1,
help="Hubble",
metavar=" FLOAT")
(options, args) = parser.parse_args()
if len(args) == 0:
print "you must specify a filename"
sys.exit(0)
files = args
return files,options
#############################
# graph
#############################
# get options
files,options = parse_options()
OmegaLambda = options.OmegaLambda
Omega0 = options.Omega0
Hubble = options.Hubble
#######################################
# main
#######################################
# read files
for file in files:
Step,a,da=io.read_info(file)
z = cosmo.Z_a(a)
adot = cosmo.Adot_a(a)
for i in range(len(Step)):
print "a = %f, z = %f, fac_cool = %f, fac_sfr = %f"%(a[i],z[i],1/adot[i]*0.7,1/adot[i])

Event Timeline