Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F73217272
gsteps
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, Jul 19, 17:05
Size
1 KB
Mime Type
text/x-python
Expires
Sun, Jul 21, 17:05 (2 d)
Engine
blob
Format
Raw Data
Handle
19165303
Attached To
rGTOOLS Gtools
gsteps
View Options
#!/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
Log In to Comment