Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93466756
pychem_generate_parameters-31052013
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, Nov 29, 00:10
Size
2 KB
Mime Type
text/x-python
Expires
Sun, Dec 1, 00:10 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22646446
Attached To
rGEAR Gear
pychem_generate_parameters-31052013
View Options
#!/usr/bin/env python
from
optparse
import
OptionParser
from
PyChem
import
liblifetime
from
PyChem
import
libimf
from
PyChem
import
libSNIa
from
PyChem
import
libSNII
from
PyChem
import
libmetalsSNII
from
PyChem
import
libmetalsSNIa
from
PyChem
import
libmetalsDYIN
from
PyChem
import
libSolarAbundances
import
sys
def
parse_options
():
usage
=
"usage: %prog [options] file"
parser
=
OptionParser
(
usage
=
usage
)
parser
.
add_option
(
"-o"
,
"--outputfile"
,
action
=
"store"
,
dest
=
"outputfile"
,
type
=
"string"
,
default
=
'mychimie.dat'
,
help
=
"Output file"
,
metavar
=
" NAME"
)
parser
.
add_option
(
"-p"
,
"--parameterfile"
,
action
=
"store"
,
dest
=
"parameterfile"
,
type
=
"string"
,
default
=
'chimieparam.py'
,
help
=
"Parameter file"
,
metavar
=
" NAME"
)
(
options
,
args
)
=
parser
.
parse_args
()
files
=
args
return
files
,
options
###########################################################
# Main
###########################################################
files
,
opt
=
parse_options
()
f
=
open
(
opt
.
outputfile
,
'w'
)
execfile
(
opt
.
parameterfile
)
# Lifetime
liblifetime
.
WriteParams
(
f
)
# IMF
libimf
.
WriteParams
(
f
,
Mmin
,
Mmax
,
m_s
,
a_s
)
# SNII
print
"SNII"
libSNII
.
WriteParams
(
f
,
SNII_Mmin
)
# SNIa
print
"SNIa"
libSNIa
.
WriteParams
(
f
,
SNIa_Mpl
,
SNIa_Mpu
,
SNIa_a
,
SNIa_Mdl1
,
SNIa_Mdu1
,
SNIa_bb1
,
SNIa_Mdl2
,
SNIa_Mdu2
,
SNIa_bb2
)
# Metal
print
"SNII Metal"
SNIIelts
=
libmetalsSNII
.
WriteParams
(
f
,
Mmin
,
Mmax
,
m_s
,
a_s
,
MetalFile
,
HeliumCoreFile
,
elts
,
nelts
,
Mmin1
,
Mmax1
,
Mmin2
,
Mmax2
,
dM
,
n
)
# Metal
print
"SNIa Metal"
SNIaelts
=
libmetalsSNIa
.
WriteParams
(
f
,
SNIaFile
,
MeanWDMass
,
elts
,
nelts
)
if
(
SNIIelts
!=
SNIaelts
):
raise
"SNIIelts !=SNIaelts"
elts
=
SNIaelts
# Metal
print
"DYIN Metal"
SNIIelts
=
libmetalsDYIN
.
WriteParams
(
f
,
Mmin
,
Mmax
,
m_s
,
a_s
,
DyingStarsFile
,
DyingStarsHeliumCoreFile
,
elts
,
nelts
,
Mmin1
,
Mmax1
,
Mmin2
,
Mmax2
,
dM
,
n
)
# SolarAbundances
print
"Solar Abundances"
libSolarAbundances
.
WriteParams
(
f
,
SolarAbundancesFile
,
elts
)
f
.
close
()
Event Timeline
Log In to Comment