Network
jaff.core.network.Network
The Network class is the most important class in JAFF. It reads a reaction network file, auto-detects its format, validates mass and charge conservation, and assembles the full species and reaction catalogues along with stoichiometry matrices. It also handles optional radiation transport, photochemistry cross-sections, and auxiliary function files.
Constructor
Network(fname, config=None, errors=False, label=None, funcfile=True, duplicate_policy=None, expand_nuclei=True, radiation_props=None, dust_props=None, use_proxy_photoreaction=True, eos_props=None)
Parameters
- fname : str or Path
- Path to a network file, or the name of a built-in network (a sub-directory of
networks/containing a single.jetfile). A built-in network name wins over a same-named path on disk. Supported formats: KIDA, UDFA, PRIZMO, KROME, UCLCHEM, a combination of the above and the.jafffile (Refer to to_jaff for more details). - config : str, Path, or None, optional
- Path to a TOML configuration file. When
None(default), JAFF looks forjaff.tomlin the network file's directory. - errors : bool, optional
- Exit on validation errors. Default
False. - label : str or None, optional
- Network identifier. Defaults to the file stem.
- funcfile : bool, str, or Path, optional
- Path to .jfunc auxiliary functions file.
True(default) scans the network directory;Falseskips. - duplicate_policy : str or None, optional
- Resolve duplicate rate coefficients (same reaction, mechanism, and temperature range):
preserve-first,preserve-last, orerror. WhenNone(default), the network'sjaff.tomlvalue is used, falling back topreserve-first. - expand_nuclei : bool, optional
- When
True(default), ann_<element>_nucsymbol in rate expressions (e.g.n_H_nuc,n_He_nuc) is expanded to the element-nucleus density sum (weighted by atom count over all species bearing that element). WhenFalse, it is left as a free symboln<element>_nuc(e.g.nh_nuc) instead. Only affectsn_<element>_nuc; plainn_Xalways resolves to speciesX. - radiation_props : RadiationProps or None, optional
- Radiation-field configuration (bands, spectral index, mode, speed of light, background field).
None(default) disables radiation transport. - dust_props : DustProps or None, optional
- Dust-module configuration (Rv, radiation reductions, photoelectric band edges).
None(default) disables the dust module. - use_proxy_photoreaction : bool, optional
- Look up photo-reaction cross-sections under the proxy key from
Reaction.normalized_proxy_reaction_str(), which strips a trailingxfrom species names, soCHx/OHxresolve to theCH/OHentries. A custom.jfuncrate still takes precedence over the cross-sections. DefaultTrue. - eos_props : EosProps or None, optional
- Equation-of-state configuration used by
thermodynamics.eos.None(default) uses an ideal gas,EosProps("ideal")withgamma = 1.6666666666667.
Raises
- FileNotFoundError
- If
fnamedoes not exist.
Attributes
| Attribute | Type | Description |
|---|---|---|
label |
str |
Human-readable network identifier; defaults to the source file stem |
filename |
Path |
Resolved absolute path to the source network file |
spec |
NetworkSpec |
Normalized construction parameters (resolved fname, parsed config dict, funcfile, aux_funcs, ...) |
species |
Species |
Ordered catalogue of the network's core (real) species; special pseudo-species (_PHOTON, _CR, ...) are excluded |
reactions |
Reactions |
Ordered catalogue of all reactions in the network |
elements |
Elements |
Element catalogue derived from all species; used for composition matrices |
reactant_matrix |
ndarray |
Shape (n_reactions, n_species) stoichiometry matrix for reactants |
product_matrix |
ndarray |
Shape (n_reactions, n_species) stoichiometry matrix for products |
mass_dict |
dict |
Mapping from element symbol to mass properties, used for conservation checks |
thermodynamics |
Thermodynamics |
Thermal equations: eos, dEdt_chemical, dEdt_extra, dEdt_tot, dTdt_chemical, dTdt_extra, dTdt_tot; see thermodynamics |
dRad_dt_extra |
sympy.Basic |
Extra radiation moment source terms from @function definitions |
radiation |
Radiation or None |
Radiation field object; None when no radiation bands are specified |
symbols |
NetworkSymbols |
Canonical symbols, densities (ndens, ntot, rho, n_hnuc), introspection sets and standardize; see symbols |