Welcome to pysep’s documentation!

Module for calling DSEP. Handels setting up the enviroment so that the dsep executable can run as well as the stellarModel class which packages all of the nice stuff up together in one place.

Sub modules

stellarModel -> pysep.dsep.dsepModel.model

Example

Creating a stellar model for a 1 solar mass gs98 composition star.

>>> from pysep.dsep import stellarModel as sm
>>> from pysep.opac.opal.defaults import GS98hz
>>> from pysep.prems.defaults import m100.gs98
>>> from pysep.io.nml.control.defaults import solar
>>> from pysep.io.nml.control.defaults import phys1
>>> model = sm(".", solar, phys1, GS98hz, m100.gs98)

Evolving this model is as simple as

>>> model.evolve()

If you want to access some information about an model after it has been evolved you can access both the track file and the iso file

>>> iso, isoMetadata = model.iso()
>>> trk, trkMetadata = model.track()

You can also access these with getitem

>>> iso. isoMetadata = model['iso']
>>> trk, trkMetadata = model['trk']

The form of the iso, trk, and metadata variables is given in more detail in the io.iso and io.trk modules.

What if you want to read in a different bckur file from disk?

>>> from pysep.dsep import stellarModel as sm
>>> from pysep.opac.opal.defaults import GS98hz
>>> from pysep.prems.defaults import m100.gs98
>>> from pysep.io.nml.control.defaults import solar
>>> from pysep.io.nml.control.defaults import phys1
>>> from pysep.dm.filetypes import bckur_file
>>> bckurPath = "./atmk1990p00.tab"
>>> bckur = bckur_file(bckurPath)
>>> model = sm(".", solar, phys1, GS98hz, m100.gs98, bckur=bckur)
>>> model.evolve()

By default the bckur, bcphx95, bcphx96, bcphx97, bcphx98, and bcphx99 parameters are all set for a model so that you can get up and running a little more quickly. However, the opacity file, premain sequence model, physics, and control namelist files all must be passed every time.

However, you can always load your own versions of any file. Lets say you had a control namelist file called cont.nml in the local directory which you wanted to use

>>> from pysep.io.nml.control import load
>>> customControlNamelist = load('cont.nml')
>>> from pysep.io.nml.control.defaults import phys1
>>> from pysep.opac.opal.defaults import GS98hz
>>> from pysep.prems.defaults import m100.gs98
>>> from pysep.dsep import stellarModel as sm
>>> model = sm(".", customControlNamelist, phys1, GS98hz, m100.gs98)
>>> model.evolve()

The output from dsep runs will save to whatever directory was specified as the first parameter to the stellarModel constructor. If you want to be able to access the model object latter (not nessisairy but may help with convience) you can “stash” the model which will simply pickle it to the same directory as the dsep output was saved. The model will save with the name model.dsep.

>>> model.stash()

If you want to load a model again in you can (assuming you are in the same directory as the model.dsep file) do the following:

>>> from pysep.dsep.utils import load_model
>>> model = load_model("./model.dsep")