prometheus.thermo_data.parsers
Thermodynamic data parsers.
Each parser returns a dict (NASA-7/9) or list-of-rows (JANAF) ready for the compiler to merge or write directly.
Typical use:
from prometheus_equilibrium.thermo_data.parsers import Burcat7Parser, Burcat9Parser, CEAParser, JANAFParser
db7 = Burcat7Parser().parse("raw/burcat7.thr")
db9 = Burcat9Parser().parse("raw/burcat9.thr")
cea = CEAParser().parse("raw/cea_thermo.inp")
rows = JANAFParser().parse("raw/JANAF.jnf")
- class prometheus_equilibrium.thermo_data.parsers.NASA7Parser
Bases:
ABCBase class for all NASA-7 polynomial parsers.
Subclasses must implement
parse(), which reads a source file and returns anasa7.json-schema dict:{ "<ID>": { "id": "CO2_G", "name": "CO2", "alias": "...", "phase": "G", "elements": {"C": 1.0, "O": 2.0}, "format": "NASA-7", "source": "<label>", "hf298_j_mol": null, "t_low": 200.0, "t_mid": 1000.0, "t_high": 6000.0, "coeffs": {"low": [...7], "high": [...7]} } }
- abstractmethod parse(path: str, source: str = '') Dict[str, dict]
Parse path and return a dict keyed by canonical species ID.
- Parameters:
path – Path to the source file.
source – Human-readable label embedded in every record under
"source".
- class prometheus_equilibrium.thermo_data.parsers.NASA9Parser
Bases:
ABCBase class for all NASA-9 polynomial parsers.
All NASA-9 source formats share the same three-line interval layout (see
parse_nasa9_interval()); only file-level framing differs.Subclasses must implement
parse(), which returns anasa9.json-schema dict:{ "<ID>": { "id": "CO2_G", "name": "CO2", "alias": "...", "phase": "G", "elements": {"C": 1.0, "O": 2.0}, "format": "NASA-9", "source": "<label>", "segments": [ {"t_low": ..., "t_high": ..., "exponents": [...7], "coeffs": [...7], "b1": ..., "b2": ...}, ... ] } }
- abstractmethod parse(path: str, source: str = '') Dict[str, dict]
Parse path and return a dict keyed by canonical species ID.
- Parameters:
path – Path to the source file.
source – Human-readable label embedded in every record under
"source".
- class prometheus_equilibrium.thermo_data.parsers.Burcat7Parser
Bases:
NASA7ParserParse a BURCAT NASA-7 .thr file into nasa7.json schema.
Each 4-line block encodes one species:
Line 1: name, 20-char formula field, phase char, temperature bounds
Line 2: high-T coefficients 1–5
Line 3: high-T coefficients 6–7, then low-T coefficients 1–3
Line 4: low-T coefficients 4–7
- parse(path: str, source: str = '') Dict[str, dict]
Parse path and return a dict keyed by canonical species ID.
- Parameters:
path – Path to the burcat7.thr file.
source – Human-readable label for this data source (e.g.
"Burcat-2024"). Stored in each record under the"source"key so the origin is visible in the compiled JSON and in conflict messages.
Schema:
{ "id": "CO2_G", "name": "CO2", "alias": "<original label>", "phase": "G", "elements": {"C": 1.0, "O": 2.0}, "format": "NASA-7", "source": "<source label>", "hf298_j_mol": null, "t_low": 200.0, "t_mid": 1000.0, "t_high": 6000.0, "coeffs": {"low": [...7], "high": [...7]} }
- class prometheus_equilibrium.thermo_data.parsers.Burcat9Parser
Bases:
NASA9ParserParse a BURCAT NASA-9 .thr file into nasa9.json schema.
The per-species structure mirrors the CEA format (card-2 + n × 3-line intervals). The only file-level differences from CEA are:
No
thermoheader orEND PRODUCTSterminator.Blank lines separate species; non-letter lines are skipped.
The interval parsing delegates entirely to
parse_nasa9_interval()from_common, which is also used bycea.CEAParser.- parse(path: str, source: str = '') Dict[str, dict]
Parse path and return a dict keyed by canonical species ID.
- Parameters:
path – Path to the burcat9.thr file.
source – Human-readable label for this data source (e.g.
"Burcat-2024"). Stored in each record under the"source"key.
Schema identical to
CEAParseroutput:{ "id": "CO2_G", "name": "CO2", "alias": "<card-1 label>", "phase": "G", "elements": {...}, "format": "NASA-9", "source": "<source label>", "segments": [...] }
- class prometheus_equilibrium.thermo_data.parsers.CEAParser
Bases:
NASA9ParserParse a CEA
thermo.inpfile into nasa9.json schema.Per-species structure (identical field layout to Burcat9):
Line 1 — species name (cols 0–17), rest is reference/comment
Line 2 — descriptor: n_intervals, elements, condensed flag (parsed by
_common.parse_nasa9_descriptor())Per interval — 3 lines parsed by
_common.parse_nasa9_interval()
- parse(path: str, source: str = '') Dict[str, dict]
Parse path and return a dict keyed by canonical species ID.
- Parameters:
path – Path to the CEA thermo.inp file.
source – Human-readable label for this data source (e.g.
"CEA-NRL2002"). Stored in each record under the"source"key.
- class prometheus_equilibrium.thermo_data.parsers.JANAFParser
Bases:
objectParse a JANAF.jnf file into janaf.csv rows.
Usage:
rows = JANAFParser().parse("raw/JANAF.jnf") # rows is a list of lists; first row is the header
The first row of the return value is always
JANAF_COLUMNS.- parse(path: str, source: str = '') List[List[str]]
Parse path and return all rows (header + data) as string lists.
Each data row has 11 fields matching
JANAF_COLUMNS. Empty fields are represented as empty strings.- Parameters:
path – Path to the JANAF.jnf file.
source – Human-readable label for this data source (e.g.
"JANAF-4th-Ed"). Logged at INFO level; not embedded in CSV rows (schema is fixed).
- Returns:
List of rows; first row is the column-header list.
- class prometheus_equilibrium.thermo_data.parsers.ShomateParser
Bases:
objectLoad and validate a
shomate.jsonfile.This is a passthrough loader: the JSON is already in the compiled schema and requires no format translation. The parser validates required fields and normalises optional ones.
Usage:
db = ShomateParser().parse("shomate.json") # db is a Dict[str, dict] ready for ThermoCompiler
- parse(path: str) Dict[str, dict]
Load path and return a validated dict keyed by species ID.
Entries whose keys start with
_are skipped (metadata). Species that fail validation are logged and excluded.- Returns:
{sp_id: record}in the shomate.json schema.
- static template(elements: Dict[str, float], phase: str, t_low: float = 298.0, t_high: float = 1000.0, alias: str | None = None, delta_f_H298_kJ_mol: float | None = None) str
Return a JSON stub for a new Shomate species, ready to paste into shomate.json.
- Parameters:
elements – Element dict, e.g.
{"Bi": 2, "O": 3}.phase – Phase character:
"G","L", or"S".t_low – Lower temperature bound (K), default 298.0.
t_high – Upper temperature bound (K), default 1000.0.
alias – Human-readable name (optional).
delta_f_H298_kJ_mol – ΔfH°(298.15 K) in kJ/mol (optional, for the note).
- Returns:
Formatted JSON string suitable for copy-pasting into
shomate.json.
Example:
print(ShomateParser.template({"Al": 2, "O": 3}, "S", alias="Al2O3"))
- class prometheus_equilibrium.thermo_data.parsers.TERRAParser
Bases:
object- parse(bas_path: str, a_bas_path: str) Dict[str, Any]
Modules