pysep.dm package¶
Submodules¶
pysep.dm.filetypes module¶
filetypes.py
Author: Thomas Boudreaux Created: June 2021 Last Modified: July 2021
Defines the an file type object for each of the unit files which DSEP needs to run. These all inherit from the generic_file objects in pysep.dm.generic_file.
Classes¶
prems_file fermi_file bckur_file opacf_file bcphx95_file bcphx96_file bcphx97_file bcphx98_file bcphx99_file
Misc variables¶
UNITMAP
- class pysep.dm.filetypes.bckur_file(*args)¶
Bases:
pysep.dm.generic.generic_file
File type container for kruz model atmosphere boundary conditions. Given unit number 38.
- copy()¶
- class pysep.dm.filetypes.bcphx95_file(*args)¶
Bases:
pysep.dm.generic.generic_file
File type container for phoenix model atmosphere boundary condition 95. Unit set to 95.
- copy()¶
- class pysep.dm.filetypes.bcphx96_file(*args)¶
Bases:
pysep.dm.generic.generic_file
File type container for phoenix model atmosphere boundary condition 96. Unit set to 96.
- copy()¶
- class pysep.dm.filetypes.bcphx97_file(*args)¶
Bases:
pysep.dm.generic.generic_file
File type container for phoenix model atmosphere boundary condition 97. Unit set to 97.
- copy()¶
- class pysep.dm.filetypes.bcphx98_file(*args)¶
Bases:
pysep.dm.generic.generic_file
File type container for phoenix model atmosphere boundary condition 98. Unit set to 98.
- copy()¶
- class pysep.dm.filetypes.bcphx99_file(*args)¶
Bases:
pysep.dm.generic.generic_file
File type container for phoenix model atmosphere boundary condition 99. Unit set to 99.
- copy()¶
- class pysep.dm.filetypes.fermi_file(*args)¶
Bases:
pysep.dm.generic.generic_file
File type container for fermi models. Given unit number 15.
Examples
>>> import os >>> from pysep.dm.filetypes import fermif_file >>> path = os.path.join(os.environ('DSEPRoot'), 'DSEPmisc/opac/FERMI.TAB') >>> fermi = fermif_file(path} >>> print(fermi.unit) 15
- copy()¶
- class pysep.dm.filetypes.opacf_file(*args)¶
Bases:
pysep.dm.generic.generic_file
File type container for high temperature radiative opacity tables. Given unit number 48. High temperature conductive opacities can be read by DSEP so this class also includes the ability to load the file into memory
- opacdat¶
opacity data in the form returned by pysep.opac.opal.utils.load_opac
- Type
(numpy.ndarray, numpy.ndarray, numpy.ndarray)
- copy()¶
- load()¶
- unload()¶
- class pysep.dm.filetypes.premsf_file(*args)¶
Bases:
pysep.dm.generic.generic_file
File type container for pre main sequence models. Given unit number 12.
Examples
>>> import os >>> from pysep.dm.filetypes import premsf_file >>> path = os.path.join(os.environ('DSEPRoot'), 'DSEPmisc/prems/m100.gs98') >>> premsf = premsf_file(path) >>> print(premsf.unit) 12
You can also read the data within the prems file. There are two fields of data which can be read. The header, which is taken from the first row in the file and the data which is the polytropic model.
>>> prems = premsf_file(path) >>> header = prems['header'] >>> print(header['log_Teff']) 3.63997
>>> prems = premsf_file(path) >>> print(prems['data']) array([[ 2.83000000e-01, 2.83610928e+01, 9.92563370e+00, ..., -2.08271460e+00, 7.11000000e+05, 1.91000000e+04], [ 1.00028300e+03, 2.86147286e+01, 1.00127839e+01, ..., -2.08282280e+00, 7.11000000e+05, 1.91000000e+04], [ 2.00028300e+03, 2.88268143e+01, 1.00853345e+01, ..., -2.08295180e+00, 7.11000000e+05, 1.91000000e+04], ..., [ 3.48000283e+05, 3.32982416e+01, 1.18195803e+01, ..., -4.11831250e+00, 7.11000000e+05, 1.91000000e+04], [ 3.49000283e+05, 3.32984147e+01, 1.18208106e+01, ..., -4.15221130e+00, 7.11000000e+05, 1.91000000e+04], [ 3.50000283e+05, 3.32985758e+01, 1.18220374e+01, ..., -4.18777810e+00, 7.11000000e+05, 1.91000000e+04]])
- copy()¶
- load()¶
Load the file into memory under the attributes header and premsdat
- unload()¶
Unload the data from memory by calling del on header and premsdat. Moreover, unset the _loaded flag so that the premsf object know the data is not loaded.
pysep.dm.generic module¶
generic filetype module¶
Author: Thomas Boudreaux Created: June 2021 Last Modified: July 2021
Defines a generic file container for holding DSEP unit files. This can handel basic tasks such as pointing to the file location on disk and system linking that file to a given unit number in some other (such as the cw) directory. Note that this will not take care of reading any files into memory or putting them into some form python can interface with. This is purley a way of storing the location of a file and system linking to that location easily.
Classes:
generic_file
- class pysep.dm.generic.generic_file(path: str, unit: Optional[int] = None)¶
Bases:
object
Generic file container for DSEP unit files
- path¶
absolute path to file
- Type
str
- unit¶
unit number of file when symlinked (form of fort.<unit>)
- Type
int
- as_dict(generalizePaths=False) dict ¶
Return dictionary representation
- Returns
dictRepr (dict) – Dictionary representation.
generalizePaths (bool, default=False) – This does not do anything here, but is included so for code consistency with pysep.io.nml.control.cnml and pysep.io.nml.physics.pnml
- clean_symlinks()¶
Deletes the symlink at fort.<unit> if it was created by this class i.e if _symlinked had been set to true.
- copy()¶
- locally_symlink(alert: bool = False)¶
Symbolically links file at path to fort.<unit> in the current working directory.
- Parameters
alert (bool, default = False) – If true then a message to stdout will be printed saying the file name and the unit number. Used for debugging
- Returns
- Return type
None
- reset_symlinks()¶
Resets the symlink tracker to fasle
Module contents¶
Data models for pysep. This includes handeling all of the input files for DSEP except the control and physics namelist files.
Examples
Filetypes are used by pysep to provide “default” versions of many datafiles/tables. You can also use them to load up any files. For example, if you want to use a pre main squence model called m090.GS98 which is in your current working directory you can load that as follows
>>> from pysep.dm.filetypes import premsf_file
>>> prems = premsf_file('m090.GS98')
This could then use used in a stellar model just like any of the default provided prems models could.