EbysusAtomfile
- class PlasmaCalcs.hookups.ebysus.ebysus_atomfiles.EbysusAtomfile(filename)
Bases:
objectRepresentation of a .atom file used by Ebysus to define fluid properties.
filename: str
path to the atom file. Internally stored as abspath.Atomfiles are parsed as follows (ignoring comments (#), trimming whitespace and blank lines):# — basic info —ELEMENTABUND AWEIGHT # if element=H, might have 1 more value (which is meaningless).N_LEVELS N_SPECTRAL N_CONTINUA N_FIXED_TRANSITIONS# — (N_LEVELS entries) energy levels, each is a line with: —LEVEL_ENERGY G_FACTOR ‘LABEL’ STAGE LEVEL_N# [TODO] currently, everything below this line is not yet implemented in this parser,# because PlasmaCalcs doesn’t have any calculations using those physics yet.# — (N_SPECTRAL entries) bound-bound radiative transitions, each is a line with: —LEVEL_START LEVEL_END F_VALUE TYPE NLAMBDA SYMMETRICQCORE QWING VDAPPROX VDWAALS(4) RADIATIVE_BROADENING STARK_BROADENING# (no actual newline between SYMMETRIC and QCORE; just split for readability here)# — (N_CONTINUA entries) photoionization continua, each is a line (or lines) with: —LEVEL_START LEVEL_END EDGE_CROSS_SECTION NLAMBDA WAVELENGTH_DEPENDENCE WAVE_MIN# if WAVELENGTH_DEPENDENCE == “EXPLICIT”:WAVELENGTH_1 CROSS_SECTION_1WAVELENGTH_2 CROSS_SECTION_2# — (N_FIXED_TRANSITIONS entries) fixed transitions —LEVEL_START LEVEL_END STRENGTH TRAD TRAD_OPTION# — rate coefficients (optional; may be completely absent) —# The remainder of the file describes rate coefficients for various physics,# e.g. ionization, recombination, charge exchange.# [TODO] more details on these lines and how to parse them.Instances of this class have the following attributes:– meta info –filename: abspath to filelines: list of lines in the file, stripping comments, whitespace, and blank lines.line_starts: dict telling which line each section starts on, with keys‘basics’, ‘levels’, ‘spectral’, ‘continua’, ‘fixed_transitions’, and ‘rate_coeffs’.sections: dict of lists of lines in each section, with same keys as ^.– basic info –element: element nameabund: abundance: A(elem) = 12 + log10(n(elem) / n(H)), n = number density.aweight: atomic weight [amu]sizes: dict telling length (n) for ‘levels’, ‘spectral’, ‘continua’, and ‘fixed_transitions’.– data –levels: list of levels defined in the file, each level is a dict containing:energy: (float) energy above ground state [cm^-1].g_factor: (float) “degeneracy of states” factor used in Saha equation.label: (str) label for the level, e.g. ‘FE II 3S2 3P6 3D5 4S2 5DE 12’(trims whitespace at edges of string compared to string in file).stage: (int) ionization stage, e.g. 1 for neutral, 2 for singly ionized, etc.ilevel: (int) level number (“i” is for “index”) within this atom file.(Will assert list(ilevel) = range(1, N_LEVELS+1).)_abbrv_label: (str) abbreviated label for the level, e.g. ‘Fe_II’.(see self.init_abbrv_labels() for more details.)spectral: list of spectral lines defined in the file[not yet implemented]continua: list of photoionization continua entries defined in the file[not yet implemented]fixed_transitions: list of fixed transitions defined in the file[not yet implemented]rate_coeffs: list of rate coefficients defined in the file[not yet implemented]Methods
initializes abbreviated labels for each level, stored in level['_abbrv_label'].
initialize basic info from the file.
initializes levels info from the file.
reads file, saving lines to self.lines.
ensure list of ilevels is range(1, N_LEVELS+1).
- _check_ilevels()
ensure list of ilevels is range(1, N_LEVELS+1).
- init_abbrv_labels()
initializes abbreviated labels for each level, stored in level[‘_abbrv_label’].
These are abbreviated versions of level[‘label’], used to facilitate display,and used for EbysusFluid.name values (the full label is usually too inconvenient).These are guaranteed to be unique within the file.Usually, this returns the element name followed by ionization stage indicator, e.g. ‘Fe_II’.(Internally, this is from f’{label.split()[0].title()}_{label.split()[1]}’.)However, if this leads to any dupliactes, e.g. multiple ‘He_II’ appearances,then also append the level number (within the file, i.e. ilevel), e.g. ‘He_II_lv3’.(But, only append level number for duplicates, not to other labels in file.)
- init_basics()
initialize basic info from the file.
- init_levels()
initializes levels info from the file.
- read_file()
reads file, saving lines to self.lines. Also removes comments, whitespace, etc.