Page MenuHomec4science

pychem_generate_parameters-31052013
No OneTemporary

File Metadata

Created
Fri, Nov 29, 00:10

pychem_generate_parameters-31052013

#!/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