pysep.io.prems package¶
Submodules¶
pysep.io.prems.load module¶
Author: Thomas M. Boudreaux
Created: October 2021
Last Modified: October 2021
IO functions for pre main sequence models. Currently just functions to read and parse the files, there is no ability to modify them.
Functions¶
- parse_line
parse an individual row from the premain sequence data block
- read_and_parse
given some path to a file parse the entire header and data block
- pysep.io.prems.load.parse_line(line: str) List ¶
Parse a single line from the premain sequence data block and cast the values to floats. Parsing is done based on byte location.
- Parameters
line (str) – string of line to parse. Bytes must be properly lined up in the same format as output from the program newpoly
- Returns
List of logMass, logRadius, logLumi, logPres, logTemp, logDens, X, Z over a number of time steps
- Return type
list
- pysep.io.prems.load.read_and_parse(path: str) Tuple[dict, numpy.ndarray] ¶
Given some path to a premain sequence model generated by the newpoly.f program, parse its contents and return the header as a dict and the data block as a ndarray. In future also return the composition of each convective region as an array.
- Parameters
path (str) – Path to premain sequence file to parse.
- Returns
header (dict) – Dictionary with keys: model, shells, mass, log_Teff, log_L, log_M, age, timeStep. Each of these values is taken from the header. The age is given in Yrs.
data (ndarray) – ndarray with the data from the datablock as well as an additional column. The 0th column of the array is a time array generated from the age and the timeStep read from the header.
- pysep.io.prems.load.read_and_parse_header(path: str) dict ¶
Just open and read the header of a pre main sequence model. This is intended to allow the header information to be read much faster than it would if pysep had to open and read the entire file
- Parameters
path (str) – Path to premain sequence file to parse.
- Returns
header – Dictionary with keys: model, shells, mass, log_Teff, log_L, log_M, age, timeStep. Each of these values is taken from the header. The age is given in Yrs.
- Return type
dict