Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F67096137
gmktimesteps
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jun 19, 21:38
Size
1 KB
Mime Type
text/x-python
Expires
Fri, Jun 21, 21:38 (2 d)
Engine
blob
Format
Raw Data
Handle
18324511
Attached To
rGTOOLS Gtools
gmktimesteps
View Options
#!/usr/bin/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
Log In to Comment