pysep.atm package¶
Subpackages¶
Submodules¶
pysep.atm.multi module¶
Author: Thomas M. Boudreaux
Created: March 2022
**Last Modified:* March 2022
Class for mergine multiple atmospheric models together. This is primarly intended so that models that span different temperature ranges can be compined to span the full temperature range DSEP expects.
- class pysep.atm.multi.multiATM(modelMeta)¶
Bases:
object
- MODELLOOKUP = {'kur': ('kur', 'kurucz', 'atl', 'atlas'), 'mrc': ('mrc', 'marcs'), 'phx': ('phx', 'phoenix')}¶
- PARSEFUNCTIONS = {'kur': <function load_as_dsep_style>, 'mrc': <function load_new_style>, 'phx': <function load_new_style>}¶
- add_model(model, new=False)¶
- fmt_dsep_style()¶
- locally_symlink(unit: int)¶
- save(path: Optional[str] = None, force: bool = False)¶
pysep.atm.utils module¶
General Atmospher Utilities
Author: Thomas M. Boudreaux
Created: September 2021
Last Modified: September 2021
Functions¶
- load_new_style(str) -> Tuple[np.ndarray, list[str]]
Load new style (T | (pgas, temp)) boundary condition table into a numpy array and store the comments from the header in a list for use later.
- convert_2_DSEP_style(np.ndarray) -> np.ndarray
Convert a numpy array loaded from a new style surface boundary condition file into an array which just pgas (remove temp from the array)
- write_to_file(str, np.ndarray, list[str])
Save properly formated numpy array to a file which can be read by DSEP. A few notes on this. Comment lines start with a # followed by NO space. This will be automatically formated by the function. Further, only the comment starting with [Z/Z_SOLAR] will be written. Make sure that comment exists in the comment array. Finally, all data lines will start with a space, DSEP needs this.
- convert_pgas_temp_to_pgas(str, str)
Given some new style surface boundary condition input file (T | (pgas, temp)) for a list of logg write out a new file in the form of T | pgas for the same list of logg. Do this by extracting every other data column (starting after the temp column) and writing those, along with the temp column to a new file. Moreover, modify the header so that only the line starting with [Z/Z_SOLAR] remains.
- pysep.atm.utils.convert_2_DSEP_style(arr: numpy.ndarray) numpy.ndarray ¶
Convert a numpy array loaded from a new style surface boundary condition file into an array which just pgas (remove temp from the array)
Note that this function will not do any kind of check to make sure that arr is in fact formated as (T | (pgas, temp)). That check is on the useer. Only arr formatd as (T | (pgas, temp)) should be passed to this function. That is to say that only new style sbc should be passed to this function.
- Parameters
arr (np.ndarray) – array with the data from path in it. 0th axis is temperature 1st axis is pgas and temp. pgas can be accessed with [:, 1::2] while temp can be accessed [:, 2::2].
- Returns
dsepForm – ndarray where the first column temperature and every subsequent column is pgas for a variety of logg (as defined in the header). This is the same as arr but with every other data column removed to only leave the pgas columns.
- Return type
np.ndarray
- pysep.atm.utils.convert_pgas_temp_to_pgas(inputFile: str, outputFile: str)¶
Given some new style surface boundary condition input file (T | (pgas, temp)) for a list of logg write out a new file in the form of T | pgas for the same list of logg. Do this by extracting every other data column (starting after the temp column) and writing those, along with the temp column to a new file. Moreover, modify the header so that only the line starting with [Z/Z_SOLAR] remains.
- Parameters
inputFile (str) – File to read in (new style in the form of T | (pgas, temp) for a set of logg
outputFile (str) – Path to save DSEP formated file to, will have form of T | pgas for the same set of logg which the input file had. Moreover, header will be one line starting with #[Z/Z_SOLAR]. (Note no space between # and [.
Examples
Given some input file Zp0d0.ap0d0_t010.dat
>>> convert_pgas_temp_to_pgas("Zp0d0.ap0d0_t010.dat", "Zp0d0.ap0d0_t010_mod.dat")
Now there will be a new file in the current working directory called Zp0d0.ap0d0_t010_mod.dat which is properly formated so that DSEP can use it.
- pysep.atm.utils.expand_new_style(parray: numpy.ndarray) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray] ¶
Expand a new style surface bounday condition file into T, pgas, and temp.
- Parameters
parray (np.np.ndarray) – numpy array from a new style surface boundary condition file. This is expected to be formated as (T | (pgas, temp)). Note that this will not be validated as the correct form. Rather, it is on the user to make sure that parray is actually a new style sbc array.
- Returns
teff (np.ndarray) – effecttve temperature (from column 1)
pgas (np.ndarray) – pressure (from every other column after and including column 2)
temp (np.ndarray) – temp (from every other column after and including column 3)
- pysep.atm.utils.load_new_style(path: str) Tuple[numpy.ndarray, list] ¶
Load new style (T | (pgas, temp)) boundary condition table into a numpy array and store the comments from the header in a list for use later.
- pathstr
Path to new style surface boundary condition
- parraynp.ndarray
array with the data from path in it. 0th axis is temperature 1st axis is pgas and temp. pgas can be accessed with [:, 1::2] while temp can be accessed [:, 2::2].
- commentslist[str]
List of all comments (without # and
) for use later
- pysep.atm.utils.write_to_file(file: str, dsepForm: numpy.ndarray, comments: list)¶
Save properly formated numpy array to a file which can be read by DSEP. A few notes on this. Comment lines start with a # followed by NO space. This will be automatically formated by the function. Further, only the comment starting with [Z/Z_SOLAR] will be written. Make sure that comment exists in the comment array. Finally, all data lines will start with a space, DSEP needs this.
- Parameters
file (str) – Path to save resultant file too
dsepForm (np.ndarray) – ndarray where the first column temperature and every subsequent column is pgas for a variety of logg (as defined in the header). This is the same as arr but with every other data column removed to only leave the pgas columns.
comments (list[str]) – List of comments. The comment starting with [Z/Z_SOLAR] will be extracted and written as the header to the file with no space between # and [Z/Z_SOLAR].
Module contents¶
Atmospheric boundary conditions routines and datatables.