prometheus.thermo_data.compiler
ThermoCompiler — build and merge thermodynamic JSON/CSV databases.
Typical workflow:
from prometheus_equilibrium.thermo_data.compiler import ThermoCompiler
c = ThermoCompiler()
c.compile_nasa7("raw/burcat7.thr", "nasa7.json", source="Burcat-2024")
c.compile_nasa9("nasa9.json",
burcat_src="raw/burcat9.thr", burcat_source="Burcat-2024",
cea_src="raw/cea_thermo.inp", cea_source="CEA-2026",
mode="append")
c.compile_janaf("raw/JANAF.jnf", "janaf.csv", source="JANAF-4th-Ed")
Merge modes
overwriteRebuild the output file from scratch; the existing file is ignored.
appendAdd new species to the existing file. When a species ID already exists, keep the existing record (the incoming one is discarded).
interactiveSame as append, but when a conflict is detected the user is shown a summary of both records and asked which to keep.
Classes
Build and merge thermodynamic databases from raw source files. |
- class prometheus_equilibrium.thermo_data.compiler.ThermoCompiler
Bases:
objectBuild and merge thermodynamic databases from raw source files.
All
compile_*methods accept a mode argument:"overwrite"— rebuild from scratch, discarding any existing file."append"— add new species only; keep existing on conflict."interactive"— prompt the user for each conflicting species.
- compile_nasa7(src: str, out: str, source: str, mode: str = 'overwrite') int
Build (or update) out from a single Burcat7
.thrsource file.- Parameters:
src – Path to the
burcat7.thrfile.out – Path to the output
nasa7.json.source – Label for this data source, embedded in every record.
mode –
"overwrite"/"append"/"interactive".
- Returns:
Total number of species in the written file.
- compile_nasa9(out: str, *, burcat_src: str | None = None, burcat_source: str = '', cea_src: str | None = None, cea_source: str = '', mode: str = 'append') int
Build (or update) out from Burcat9 and/or CEA source files.
When both sources are provided they are merged before touching the existing output file. Within that internal merge, CEA takes priority: CEA species override any conflicting BURCAT9 record so that well-validated CEA ground-state data is not shadowed by BURCAT9 exotic isomers or excited states that share the same canonical ID. BURCAT9 species absent from CEA are kept as supplementary data.
- Parameters:
out – Path to the output
nasa9.json.burcat_src – Path to
burcat9.thr(optional).burcat_source – Label for the Burcat9 source.
cea_src – Path to
cea_thermo.inp(optional).cea_source – Label for the CEA source.
mode – How to handle conflicts with the existing output file.
- Returns:
Total number of species in the written file.
- compile_janaf(src: str, out: str, source: str, mode: str = 'overwrite') int
Build (or update) out from a JANAF
.jnfsource file.- Parameters:
src – Path to
JANAF.jnf.out – Path to the output
janaf.csv.source – Label for this data source.
mode –
"overwrite"/"append"/"interactive".
- Returns:
Number of data rows written (excluding the header).
- compile_shomate(src: str, out: str, mode: str = 'append') int
Load, validate, and merge a
shomate.jsonfile.Because Shomate data is hand-authored there is no separate “raw” source — the JSON is the source. This method validates the file and merges it into out (which may be the same path).
- Parameters:
src – Path to the source
shomate.json.out – Path to the output
shomate.json(may equal src).mode –
"overwrite"/"append"/"interactive".
- Returns:
Total number of species in the written file.
- compile_all(src_dir: str, out_dir: str, *, burcat_source: str = '', cea_source: str = '', janaf_source: str = '', mode: str = 'interactive') None
Build all databases from src_dir into out_dir.
Looks for
burcat7.thr,burcat9.thr,cea_thermo.inp, andJANAF.jnfin src_dir. Missing files are skipped with a warning.- Parameters:
src_dir – Directory containing raw source files.
out_dir – Directory to write compiled databases.
burcat_source – Label for Burcat7 and Burcat9 data.
cea_source – Label for CEA data.
janaf_source – Label for JANAF data.
mode – Merge mode applied to all databases.