Page MenuHomec4science

gmktimesteps
No OneTemporary

File Metadata

Created
Tue, Nov 26, 07:05

gmktimesteps

#!/usr/bin/env python
'''
Create a liste of cosmological timesteps in
the form of parameter a.
Yves Revaz
ven avr 14 12:35:53 CEST 2006
'''
from optparse import OptionParser
import sys
def parse_options():
usage = "usage: %prog [options]"
parser = OptionParser(usage=usage)
parser.add_option("-p",
action="store",
dest="p",
type='int',
default=5,
metavar=" INT",
help="precision value")
parser.add_option("-v",
action="store_true",
dest="verbose",
default = 0,
help="verbose mode")
(options, args) = parser.parse_args()
files = args
return files,options
##########################################################
#
# MAIN
#
#########################################################
# get options
files,options = parse_options()
p = options.p
verbose = options.verbose
da = 1./(2.**p)
a = 0
while 1:
a = a + da
z = 1./a - 1.0
if z < 0:
break
if verbose:
print "a = %12.10f z = %12.8f"%(a,z)
else:
print "%12.10f"%(a)

Event Timeline