erTabInputManager
- class PlasmaCalcs.mhd.mhd_er_tables.erTabInputManager(filename, *, u=None, ionize_ev='physical', **kw_super)
Bases:
DictlikeFromKeysAndGetitem,UnitsHavermanages tables, based on tab input file.
All tables and table coords here are in ‘raw’ units.self is dict-like, with keys quantity names, values erTable objects.(alternatively, use self.tables for dict like self.)self.elements is an ElementList based on the elements info in tab input file.- filename: str
- path to tab input file, e.g. tab_param.in. Internally stored as abspath.This should be an idl-like file which includes params for tables:EOSTableFile: str, path to eos table fileRhoEiRadTableFile: str, path to radiation table filenRhoBin: int, number of bins for r (mass density)RhoMin, RhoMax: numbers, r [cgs units] for smallest and largest binsnEiBin: int, number of bins for eperm (internal energy per unit mass)EiMin, EiMax: numbers, eperm [cgs units] for smallest and largest binsnRadBins: int, number of radiation bins in the radiation tables.It should also include params for elements (each as a string separated by spaces):cel: elements names. Internally stored in title case (e.g. ‘H’, ‘He’).abund: abundances of elements: A(elem) = 12 + log10(n(elem) / n(H)).aweight: masses of elements [amu].
- u: None or UnitsManager
- used to calculate scale_quants to convert to ‘raw’ units.None –> all scale quants will be 1.example: if this TabInputManager is associated with a BifrostCalculator,probably will have u = the BifrostUnitsManager from that BifrostCalculator.
- ionize_ev: str or dict
- first ionization potentials of elements [eV]. E.g., {‘H’: 13.6}.affects self.elements; irrelevant to tables.str –> use ElementList.DEFAULTS[‘ionize_ev’][ionize_ev]
Methods
__iter__()raises TypeError; use .keys(), .values(), or .items() instead.
get(key[, default])return self[key].
get_behavior([keys])return value of self.behavior.
get_coords(*[, for_kw])return dict of eperm coords and r coords, in 'raw' units.
return eperm coords in 'raw' units.
return r coords in 'raw' units.
initialize self.tables and return result
items()return tuple of (key, value) pairs corresponding to self.keys() and self.values().
keys()return tuple of keys in self.
make_element_list(*[, ionize_ev, set])set & return self.elements = ElementList based on params in self.
record_units(array)return array.assign_attrs(self.units_meta()).
return dict(units=self.units).
values()return tuple of values corresponding to self.keys().
Attributes
dict of {attr: self.attr} for attr in self.behavior_attrs.
list of attrs in self which control behavior of self.
cls_behavior_attrsdirectory containing tabinputfile.
filepath to eos table file.
return number of radbins in self.
list of attrs in self which control behavior of self, but which are NOT in self.dimensions.
filepath to radiation table file.
the current units manager for self.
the current unit system for self.
- __iter__()
raises TypeError; use .keys(), .values(), or .items() instead.
- property behavior
dict of {attr: self.attr} for attr in self.behavior_attrs. Note dims are separate;
dims go in behavior.dims. E.g. Behavior({‘units’:’si’,…}, dims={‘snap’:0,…}).
- property behavior_attrs
list of attrs in self which control behavior of self.
Here, returns self.cls_behavior_attrs.Subclasses could override if any behavior attrs are not known at the class-level,e.g. if MySubclass’s list of behavior attrs varies between instances of MySubclass.
- property dirname
directory containing tabinputfile. Equivalent: os.path.dirname(self.filename)
- element_list_cls
alias of
ElementList
- property eosfile
filepath to eos table file.
- er_table_manager_cls
alias of
erTableManager
- get(key, default=UNSET)
return self[key]. if default is provided and self[key] doesn’t exist, return default.
- get_behavior(keys=None)
return value of self.behavior.
- keys: None or iterable
- if provided, only include these attrs.from nondim_behavior_attrs, or dims.
- get_coords(*, for_kw=False)
return dict of eperm coords and r coords, in ‘raw’ units.
Assumes params from paramfile are in cgs units.- for_kw: bool
- False –> result keys are ‘eperm’, ‘r’.True –> result keys are ‘epermcoords’, ‘rcoords’.
- get_eperm_coords()
return eperm coords in ‘raw’ units. Assumes params from paramfile are in cgs units.
- get_r_coords()
return r coords in ‘raw’ units. Assumes params from paramfile are in cgs units.
- init_tables()
initialize self.tables and return result
- items()
return tuple of (key, value) pairs corresponding to self.keys() and self.values().
- keys()
return tuple of keys in self.
- make_element_list(*, ionize_ev=None, set=True)
set & return self.elements = ElementList based on params in self.
- ionize_ev: None, str, or dict
- first ionization potentials of elements [eV]. E.g., {‘H’: 13.6}.str –> use ElementList.DEFAULTS[‘ionize_ev’][ionize_ev]None –> use self.tabin.ionize_ev (default: ‘physical’)
- set: bool
- whether to set self.elements to the result. Default True.
- property n_radbins
return number of radbins in self.
- property nondim_behavior_attrs
list of attrs in self which control behavior of self, but which are NOT in self.dimensions.
- property radfile
filepath to radiation table file.
- record_units(array)
return array.assign_attrs(self.units_meta()).
if array is not an xarray.DataArray, convert it first.
- property u
the current units manager for self.
if not yet initialized, getting self.u will create (and store) a new UnitsManager().
- property units
the current unit system for self. E.g., ‘si’. (this is an alias to self.u.units)
- units_meta()
return dict(units=self.units).
- values()
return tuple of values corresponding to self.keys().