pysep.ext package

Submodules

pysep.ext.args module

pysep.ext.args.build_newpoly_arg_dict(sumass: float, teff1: float, suluml: float, X: float, Z: float, CMIXL: float, BETA: float, FMASS1: float, FMASS2: float, DDAGE: float, PN: float, ELEM: list, LEXCOM: bool) dict

Given python datatypes, return a dictionary of c data types used by the new poly c extension for pysep

Parameters
  • sumass (float) – Total mass of the model

  • teff1 (float) – Effective temperature.

  • suluml (float) – luminosity in solar units.

  • X (float) – Hydrogen mass fraction

  • Z (float) – Metal mass fraction

  • CMIXL (float) – Mixing length

  • BETA (float) – Beta parameter

  • FMASS1 (float) – Fmass 1 parameter

  • FMASS2 (float) – Fmass 2 parameter

  • DDAGE (float) – Model Age

  • PN (float) – Polytropic index

  • ELEM (list of floats) – Elemental Composition

  • LEXCOM (bool) – Logical flag to use EXCOM, inverted

Returns

args – Dictionary of argumesnts to pass to call_newpoly

Return type

dict

pysep.ext.dsepIO module

Fast C++ based memory maped trk file parser

pysep.ext.dsepIO.C_read_trk()

Fast C++ based memory maped trk file parser

pysep.ext.newpoly module

C++ Implimentation of Newpoly.f program

pysep.ext.newpoly.C_build_model()

C++ Implimentation of Newpoly.f program

pysep.ext.newpolyIO module

This module ‘newpolyIO’ is auto-generated with f2py (version:1.21.1). Functions:

writeout(filename,time,csecyr,modnum,nshell,sumass,teffl,suluml,hstot,ddage,lexcom,lrot,lexcp,ldpree,ldiaz,jcore,jenv,cmixl,tlumx,trit,tril,ps,ts,rs,cfenv,x,z,sml,srl,sl,spl,stl,sdl,mlast,mlast1,smllast,srllast,sllast,spllast,stllast,sdllast,lc,elem,extelem,cgsl,teffl1,pn)

.

pysep.ext.numfrac module

Fast C++ based number fraction generation

pysep.ext.numfrac.C_run()

Fast C++ based number fraction generation

pysep.ext.utils module

Author: Thomas M. Boudreaux

Created: September 2021

Last Modified: September 2021

Utilities for calling C and Fortran extensions to pysep

Functions

call_num_frac

Call the number fraction program on either a single set of [Fe/H], [alpha/Fe], and a(He) or a linspace of each.

parse_abundance_file

generate a python usable version of the abundance file saved by the numfrac c extension to pysep.

get_base_composition

Return the raw composition for a given abundance file using the numfrac c extension for pysep

pysep.ext.utils.call_newpoly(path, da)

Call both the lane emden integrator in libnewpoly.so as well as the fortran code in libnewpolyio.so which writes out the results to a premain sequence model file. Model results will be returned but are also written to disk.

Parameters
  • path (str) – Path to save model to on disk.

  • da (dict, default=pysep.prems.interface.defaultArgs) – Argument list for lane emden integrator.

Returns

mr – Model Results in a model_results class. Note that these will also have been written to disk.

Return type

pysep.prems.interface.model_results

pysep.ext.utils.call_num_frac(abunTable: str, feh: Union[float, Tuple[float, float, int]], alpha: Union[float, Tuple[float, float, int]], Y: Union[float, Tuple[float, float, int]], Xc: float, Yc: float) BinaryIO

Given some grid of [Fe/H], [Alpha/Fe], and a(He) generate the number fractions files for every point on that grid. This is done using the libnumfrac shared library in ext/lib.

Parameters
  • abunTable (string) – Table to parse abundances from.

  • feh (float or tuple of floats) – [Fe/H] value to pass to program. If this is a float the numFrac program will only be evaluate at that point, if a tuple it will be evaluated at every point within linspace(feh[0], feh[1], feh[2]).

  • alpha (float of tuple of floats) – [alpha/H] value to pass to program. If this is a float the numFrac program will only be evaluate at that point, if a tuple it will be evaluated at every point within linspace(alpha[0], alpha[1], alpha[2]).

  • Y (float or tuple of floats) – a(He) value to pass to program. If this is a float the numFrac program will only be evaluate at that point, if a tuple it will be evaluated at every point within linspace(Y[0], Y[1], Y[2]).

  • Xc (float) – Current X to use as a reference

  • Yc (float) – Current Y to use as a referece (only used if Xc == 0)

Returns

fp – Temporary file object storing results

Return type

BinaryIO

pysep.ext.utils.get_base_composition(aTablePath: str) Tuple[list, float, float, float]

For some abundance path return the “base” composition, this is mainly to be used for headers.

Parameters

aTablePath (str) – Path to the abundance table in the form as described in the parseChemFile module documentation

Returns

  • list – list of the composition in the form [(‘Element’,massFrac,numberFrac),…]

  • float – Hydrogen mass fraction

  • float – Helium mass fraction

  • float – Metal mass fraction

pysep.ext.utils.parse_abundance_file(file: BinaryIO, big: bool = False, pbar: bool = True) Tuple[numpy.ndarray, float, float, float]

Given a file generated by the executable used in call_num_frac parse that file into a usable form. This includes the hydrogen, helium, and metall mass fractions. And a list in the form of [(‘Element’, massFrac, numberFrac),…]

Parameters
  • file (BinaryIO) – file like object to abundance file

  • big (bool) – single composition file or one file with many composition

  • pbad (bool) – display progress bar

Returns

  • list – list of the composition in the form [(‘Element’,massFrac,numberFrac),…]

  • float – Hydrogen mass fraction

  • float – Helium mass fraction

  • float – Metal mass fraction

Module contents

External Library Extensions for pysep. Anything in C, C++, or Fortran which pysep is reliant on (except for dsep which must be stored in its own library) will be stored here.