Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F110339359
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
Fri, Apr 25, 21:08
Size
1 KB
Mime Type
text/x-python
Expires
Sun, Apr 27, 21:08 (2 d)
Engine
blob
Format
Raw Data
Handle
25793466
Attached To
rGTOOLS Gtools
gmktimesteps
View Options
#!/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
Log In to Comment