chemparseplot.parse.chemgp_jsonl#
Parsers for ChemGP JSONL output formats.
ChemGP Rust examples produce JSONL files with method comparison data, GP quality grids, and RFF approximation benchmarks. This module provides structured parsing into typed containers for downstream plotting.
.. versionadded:: 1.5.0
Module Contents#
Classes#
One optimizer-step record from a comparison JSONL. |
|
Single optimizer trace from a comparison JSONL. |
|
Parsed optimizer comparison from a single JSONL file. |
|
Exact-GP benchmark reference record. |
|
One random-feature approximation benchmark record. |
|
Parsed RFF approximation quality data. |
|
GP quality grid data for a single training set size. |
|
One grid-sample record from the GP-quality JSONL. |
|
Accumulated training points for a single |
|
A stationary point (minimum or saddle) on the PES. |
|
Complete GP quality data from mb_gp_quality.jsonl. |
Functions#
Parse a ChemGP optimizer comparison JSONL file. |
|
Parse a ChemGP RFF quality JSONL file. |
|
Parse a ChemGP GP quality JSONL file. |
API#
- class chemparseplot.parse.chemgp_jsonl.ComparisonRecord[source]#
One optimizer-step record from a comparison JSONL.
- classmethod from_mapping(rec: chemparseplot.parse.types.ParserAttrs) chemparseplot.parse.chemgp_jsonl.ComparisonRecord[source]#
- class chemparseplot.parse.chemgp_jsonl.OptimizerTrace[source]#
Single optimizer trace from a comparison JSONL.
Attributes
method : str Optimizer name (e.g.
"gp_minimize","neb","otgpd"). steps : list[int] Step indices. oracle_calls : list[int] Cumulative oracle call counts. energies : list[float] | None Energy at each step (minimize, dimer). forces : list[float] | None Force norm at each step (dimer:force, NEB:max_force).- add_record(rec: chemparseplot.parse.chemgp_jsonl.ComparisonRecord) None[source]#
Accumulate one typed optimizer record into the trace.
- class chemparseplot.parse.chemgp_jsonl.ComparisonData[source]#
Parsed optimizer comparison from a single JSONL file.
Attributes
traces : dict[str, OptimizerTrace] Keyed by method name. summary : ParserAttrs | None Summary record if present.
- traces: dict[str, chemparseplot.parse.chemgp_jsonl.OptimizerTrace]#
‘field(…)’
- summary: chemparseplot.parse.types.ParserAttrs | None#
None
- ensure_trace(method: str) chemparseplot.parse.chemgp_jsonl.OptimizerTrace[source]#
Return the named optimizer trace, creating it if needed.
- chemparseplot.parse.chemgp_jsonl.parse_comparison_jsonl(path: str | pathlib.Path) chemparseplot.parse.chemgp_jsonl.ComparisonData[source]#
Parse a ChemGP optimizer comparison JSONL file.
Handles minimize, dimer, and NEB comparison formats. Each line is a JSON object with a
methodfield (orsummary: true).Parameters
path Path to the JSONL file.
Returns
ComparisonData Parsed traces keyed by method name.
- class chemparseplot.parse.chemgp_jsonl.RFFExactRecord[source]#
Exact-GP benchmark reference record.
- classmethod from_mapping(rec: chemparseplot.parse.types.ParserAttrs) chemparseplot.parse.chemgp_jsonl.RFFExactRecord[source]#
- class chemparseplot.parse.chemgp_jsonl.RFFApproxRecord[source]#
One random-feature approximation benchmark record.
- classmethod from_mapping(rec: chemparseplot.parse.types.ParserAttrs) chemparseplot.parse.chemgp_jsonl.RFFApproxRecord[source]#
- class chemparseplot.parse.chemgp_jsonl.RFFQualityData[source]#
Parsed RFF approximation quality data.
Attributes
exact_energy_mae : float Exact GP energy MAE vs true surface. exact_gradient_mae : float Exact GP gradient MAE vs true surface. d_rff_values : list[int] RFF feature counts tested. energy_mae_vs_true : list[float] RFF energy MAE vs true surface. gradient_mae_vs_true : list[float] RFF gradient MAE vs true surface. energy_mae_vs_gp : list[float] RFF energy MAE vs exact GP. gradient_mae_vs_gp : list[float] RFF gradient MAE vs exact GP.
- add_exact_gp(rec: chemparseplot.parse.chemgp_jsonl.RFFExactRecord) None[source]#
Store the exact-GP reference metrics.
- add_rff(rec: chemparseplot.parse.chemgp_jsonl.RFFApproxRecord) None[source]#
Store one RFF approximation record.
- chemparseplot.parse.chemgp_jsonl.parse_rff_quality_jsonl(path: str | pathlib.Path) chemparseplot.parse.chemgp_jsonl.RFFQualityData[source]#
Parse a ChemGP RFF quality JSONL file.
Parameters
path Path to the JSONL file.
Returns
RFFQualityData Parsed exact GP and RFF metrics.
- class chemparseplot.parse.chemgp_jsonl.GPQualityGrid[source]#
GP quality grid data for a single training set size.
Attributes
n_train : int Number of training points. nx : int Grid x resolution. ny : int Grid y resolution. x : list[list[float]] Grid x coordinates (ny x nx). y : list[list[float]] Grid y coordinates (ny x nx). true_e : list[list[float]] True energy on grid. gp_e : list[list[float]] GP predicted energy on grid. gp_var : list[list[float]] GP variance on grid. train_x : list[float] Training point x coordinates. train_y : list[float] Training point y coordinates. train_e : list[float] Training point energies.
- classmethod from_records(*, n_train: int, meta: chemparseplot.parse.types.ParserAttrs, records: list[chemparseplot.parse.chemgp_jsonl.GPGridRecord], train_points: chemparseplot.parse.chemgp_jsonl.TrainingPointSet | None = None) chemparseplot.parse.chemgp_jsonl.GPQualityGrid[source]#
Build a typed grid from JSONL records and parsed metadata.
- class chemparseplot.parse.chemgp_jsonl.GPGridRecord[source]#
One grid-sample record from the GP-quality JSONL.
- classmethod from_mapping(rec: chemparseplot.parse.types.ParserAttrs) chemparseplot.parse.chemgp_jsonl.GPGridRecord[source]#
- class chemparseplot.parse.chemgp_jsonl.TrainingPointSet[source]#
Accumulated training points for a single
n_trainvalue.
- class chemparseplot.parse.chemgp_jsonl.StationaryPoint[source]#
A stationary point (minimum or saddle) on the PES.
- class chemparseplot.parse.chemgp_jsonl.GPQualityData[source]#
Complete GP quality data from mb_gp_quality.jsonl.
Attributes
meta : ParserAttrs Grid metadata (nx, ny, x_min, x_max, y_min, y_max). stationary : list[StationaryPoint] Minima and saddle points. grids : dict[int, GPQualityGrid] Grid data keyed by n_train.
- meta: chemparseplot.parse.types.ParserAttrs#
‘field(…)’
- stationary: list[chemparseplot.parse.chemgp_jsonl.StationaryPoint]#
‘field(…)’
- grids: dict[int, chemparseplot.parse.chemgp_jsonl.GPQualityGrid]#
‘field(…)’
- chemparseplot.parse.chemgp_jsonl.parse_gp_quality_jsonl(path: str | pathlib.Path) chemparseplot.parse.chemgp_jsonl.GPQualityData[source]#
Parse a ChemGP GP quality JSONL file.
Parameters
path Path to the JSONL file (e.g.
mb_gp_quality.jsonl).Returns
GPQualityData Structured grid data with metadata and stationary points.