chemparseplot 1.13.2__tar.gz → 1.14.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/PKG-INFO +1 -1
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/_version.py +2 -2
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/chemgp.py +258 -151
- chemparseplot-1.14.0/chemparseplot/plot/journal.py +1114 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/landscape.py +6 -1
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/neb.py +340 -66
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/optimization.py +178 -33
- chemparseplot-1.14.0/chemparseplot/plot/palette.py +806 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/reaction.py +14 -4
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/theme.py +31 -34
- chemparseplot-1.14.0/tests/plot/data/au_al100.json +19729 -0
- chemparseplot-1.14.0/tests/plot/data/au_al100.py +350 -0
- chemparseplot-1.14.0/tests/plot/data/figures/convergence.png +0 -0
- chemparseplot-1.14.0/tests/plot/data/figures/energy_landscape.png +0 -0
- chemparseplot-1.14.0/tests/plot/data/figures/neb_profile.png +0 -0
- chemparseplot-1.14.0/tests/plot/data/figures/neb_profile_history.png +0 -0
- chemparseplot-1.14.0/tests/plot/data/figures/relative_error.png +0 -0
- chemparseplot-1.14.0/tests/plot/data/figures/versions.json +4 -0
- chemparseplot-1.14.0/tests/plot/test_chemgp_imports.py +49 -0
- chemparseplot-1.14.0/tests/plot/test_figure_images.py +206 -0
- chemparseplot-1.14.0/tests/plot/test_journal.py +561 -0
- chemparseplot-1.14.0/tests/plot/test_journal_plots.py +295 -0
- chemparseplot-1.14.0/tests/plot/test_palette.py +332 -0
- chemparseplot-1.14.0/tests/tutorials/test_journal_figure.py +50 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/.gitignore +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/LICENSE +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/__init__.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/api.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/contracts/__init__.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/contracts/load_outcome.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/__init__.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/benchmark.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/chemgp_hdf5.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/chemgp_jsonl.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/converter.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/eon/__init__.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/eon/_trajectory_common.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/eon/con_io.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/eon/con_trajectory.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/eon/dimer_trajectory.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/eon/frame_series.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/eon/gprd.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/eon/min_trajectory.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/eon/minimization.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/eon/neb.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/eon/saddle_search.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/eon/stitch.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/file_.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/grammar/__init__.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/grammar/_deps.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/grammar/orca_text.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/grammar/xyz.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/mlneb.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/neb_utils.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/orca/__init__.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/orca/_opi.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/orca/geomscan.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/orca/neb/__init__.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/orca/neb/interp.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/orca/neb/opi_parser.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/patterns.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/plumed.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/projection.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/sella/saddle_search.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/surrogate/__init__.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/surrogate/cases.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/surrogate/gpr_optim.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/surrogate/mlneb.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/surrogate/model.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/trajectory/__init__.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/trajectory/hdf5.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/trajectory/neb.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/parse/types.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/__init__.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/benchmark.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/con.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/disconnectivity.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/geomscan.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/mlneb.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/plumed.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/provenance.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/rings.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/structs.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/plot/surrogate.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/units.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/chemparseplot/util.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/pyproject.toml +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/readme.md +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/__init__.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/_optional_imports.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/conftest.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/h2mol.xyz +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/orca_energy_coords_snippet.out +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/restart_exact.con +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/restart_exact_vel.con +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/cases/baselines.csv +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/cases/cases.csv +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/mlneb/evaluated.traj +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/mlneb/ml_summary.txt +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/mlneb/ml_time.txt +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/mlneb/predicted.traj +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/record/baker/25_hcnh2/band/band.h5 +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/record/baker/25_hcnh2/band/obs-archive/kernel.txt +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/record/baker/25_hcnh2/result.json +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/record/baker/25_hcnh2/saddle/pos.con +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/record/birkholz/16_oxirane/result.json +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/record/birkholz/16_oxirane/saddle/mlflow.run.json +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/record/mlruns/606078088088587/7eaf5653201fe6b92f3e3831bead3063/metrics/dimer.curvature +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/record/mlruns/606078088088587/7eaf5653201fe6b92f3e3831bead3063/metrics/dimer.force +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/record/mlruns/606078088088587/7eaf5653201fe6b92f3e3831bead3063/metrics/dimer.measured_curvature +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/record/mlruns/606078088088587/7eaf5653201fe6b92f3e3831bead3063/metrics/dimer.oracle_calls +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/record/mlruns/606078088088587/7eaf5653201fe6b92f3e3831bead3063/metrics/dimer.surrogate_curvature +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/scaling/breakdown.csv +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/scaling/components.csv +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/scaling/counts.csv +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/scaling/pop.csv +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures/surrogate/scaling/wall.csv +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/fixtures_geomscan_snippet.txt +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/__init__.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/_con_fixtures.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/grammar/__init__.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/grammar/test_grammar_deps.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/grammar/test_orca_text_grammar.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/grammar/test_xyz_grammar.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/orca/test_geomscan.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/orca/test_interp.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_chemgp_hdf5.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_chemgp_jsonl_types.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_con_io.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_con_trajectory.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_con_units_and_corpus.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_converter.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_dimer_trajectory.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_eon_neb_types.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_eon_trajectory_common.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_frame_series.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_min_trajectory.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_minimization_result.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_neb_stitch.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_neb_utils.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_orca_public_api.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_parser_types.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_patterns.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_plumed.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_projection.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_readcon_boundary.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_saddle_results.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_sella_saddle.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_surrogate_gpr_optim.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_surrogate_mlneb.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_trajectory_hdf5.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/parse/test_trajectory_neb.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/__init__.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/data/sexithiophene.sdf +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_benchmark.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_chemgp_utils.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_landscape_disconnectivity.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_mlneb.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_neb_helpers.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_neb_renderers.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_optimization.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_orca_neb_payload.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_primitive_rings.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_projection_refactor.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_provenance.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_reaction.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_ring_track.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_ring_updater.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_strip_rendering.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_structs_units.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_surface_auto_thin.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/plot/test_surrogate_plots.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/test_coverage_batch.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/test_full_coverage.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/test_load_outcome.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/test_public_api.py +0 -0
- {chemparseplot-1.13.2 → chemparseplot-1.14.0}/tests/tutorials/test_chemparseplot.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: chemparseplot
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.14.0
|
|
4
4
|
Summary: Parsers and plotting tools for computational chemistry
|
|
5
5
|
Project-URL: Documentation, https://chemparseplot.rgoswami.me
|
|
6
6
|
Project-URL: Issues, https://github.com/HaoZeke/chemparseplot/issues
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '1.
|
|
22
|
-
__version_tuple__ = version_tuple = (1,
|
|
21
|
+
__version__ = version = '1.14.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (1, 14, 0)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -6,40 +6,40 @@ convergence, surfaces, and diagnostics.
|
|
|
6
6
|
|
|
7
7
|
Surface plots use matplotlib contourf with the RUHI colormap,
|
|
8
8
|
matching the Julia CairoMakie originals. Line charts use plotnine
|
|
9
|
-
for ggplot2 grammar
|
|
9
|
+
for ggplot2 grammar; plotnine and pandas are imported when a line
|
|
10
|
+
chart is first drawn, so the surface plots need neither.
|
|
10
11
|
|
|
11
12
|
```{versionadded} 1.4.0
|
|
12
13
|
```
|
|
13
14
|
"""
|
|
14
15
|
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
15
18
|
import logging
|
|
16
19
|
from functools import lru_cache
|
|
20
|
+
from typing import TYPE_CHECKING
|
|
17
21
|
|
|
18
22
|
import matplotlib.patheffects as mpe
|
|
19
23
|
import matplotlib.pyplot as plt
|
|
20
24
|
import numpy as np
|
|
21
|
-
|
|
22
|
-
from
|
|
23
|
-
|
|
24
|
-
element_text,
|
|
25
|
-
facet_wrap,
|
|
26
|
-
geom_hline,
|
|
27
|
-
geom_line,
|
|
28
|
-
geom_point,
|
|
29
|
-
ggplot,
|
|
30
|
-
labs,
|
|
31
|
-
scale_color_manual,
|
|
32
|
-
scale_y_log10,
|
|
33
|
-
theme,
|
|
34
|
-
theme_minimal,
|
|
35
|
-
)
|
|
25
|
+
from matplotlib.cm import ScalarMappable
|
|
26
|
+
from matplotlib.colors import Normalize
|
|
27
|
+
from matplotlib.ticker import AutoLocator
|
|
36
28
|
|
|
29
|
+
from chemparseplot.plot.journal import DEFAULT_JOURNAL, apply_style, fit_height
|
|
30
|
+
from chemparseplot.plot.palette import RUHI_SEQUENTIAL, best_contrast
|
|
37
31
|
from chemparseplot.plot.theme import (
|
|
38
32
|
RUHI_COLORS,
|
|
39
33
|
get_theme,
|
|
40
34
|
setup_publication_theme,
|
|
41
35
|
)
|
|
42
36
|
|
|
37
|
+
if TYPE_CHECKING:
|
|
38
|
+
import pandas as pd
|
|
39
|
+
from plotnine import ggplot
|
|
40
|
+
|
|
41
|
+
from chemparseplot.plot.journal import JournalPreset
|
|
42
|
+
|
|
43
43
|
log = logging.getLogger(__name__)
|
|
44
44
|
|
|
45
45
|
# Ordered palette for method comparisons
|
|
@@ -51,16 +51,27 @@ _METHOD_PALETTE = [
|
|
|
51
51
|
RUHI_COLORS["sunshine"],
|
|
52
52
|
]
|
|
53
53
|
|
|
54
|
-
_JOST_THEME = theme_minimal() + theme(
|
|
55
|
-
text=element_text(family="Jost"),
|
|
56
|
-
plot_title=element_text(family="Jost", size=12),
|
|
57
|
-
axis_title=element_text(family="Jost", size=11),
|
|
58
|
-
strip_text=element_text(family="Jost", size=10),
|
|
59
|
-
)
|
|
60
|
-
|
|
61
54
|
_STROKE = [mpe.withStroke(linewidth=1.5, foreground="black")]
|
|
62
55
|
|
|
63
56
|
|
|
57
|
+
@lru_cache(maxsize=1)
|
|
58
|
+
def _gg():
|
|
59
|
+
import plotnine
|
|
60
|
+
|
|
61
|
+
return plotnine
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@lru_cache(maxsize=1)
|
|
65
|
+
def _jost_theme():
|
|
66
|
+
gg = _gg()
|
|
67
|
+
return gg.theme_minimal() + gg.theme(
|
|
68
|
+
text=gg.element_text(family="Jost"),
|
|
69
|
+
plot_title=gg.element_text(family="Jost", size=12),
|
|
70
|
+
axis_title=gg.element_text(family="Jost", size=11),
|
|
71
|
+
strip_text=gg.element_text(family="Jost", size=10),
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
64
75
|
def _ensure_ruhi_cmap():
|
|
65
76
|
"""Ensure the ruhi_diverging colormap is registered."""
|
|
66
77
|
try:
|
|
@@ -141,6 +152,7 @@ def plot_convergence_curve(
|
|
|
141
152
|
|
|
142
153
|
.. versionadded:: 1.4.0
|
|
143
154
|
"""
|
|
155
|
+
gg = _gg()
|
|
144
156
|
methods = df[color].unique()
|
|
145
157
|
palette = dict(zip(methods, _METHOD_PALETTE, strict=False))
|
|
146
158
|
|
|
@@ -152,25 +164,25 @@ def plot_convergence_curve(
|
|
|
152
164
|
}.get(y, y)
|
|
153
165
|
|
|
154
166
|
p = (
|
|
155
|
-
ggplot(df, aes(x=x, y=y, color=color))
|
|
156
|
-
+ geom_line(size=0.9)
|
|
157
|
-
+ geom_point(size=1.5, alpha=0.7)
|
|
158
|
-
+ scale_color_manual(values=palette)
|
|
159
|
-
+ labs(
|
|
167
|
+
gg.ggplot(df, gg.aes(x=x, y=y, color=color))
|
|
168
|
+
+ gg.geom_line(size=0.9)
|
|
169
|
+
+ gg.geom_point(size=1.5, alpha=0.7)
|
|
170
|
+
+ gg.scale_color_manual(values=palette)
|
|
171
|
+
+ gg.labs(
|
|
160
172
|
x="Oracle calls",
|
|
161
173
|
y=y_label,
|
|
162
174
|
color="Method",
|
|
163
175
|
)
|
|
164
|
-
+
|
|
165
|
-
+ theme(figure_size=(width, height))
|
|
176
|
+
+ _jost_theme()
|
|
177
|
+
+ gg.theme(figure_size=(width, height))
|
|
166
178
|
)
|
|
167
179
|
if log_y:
|
|
168
|
-
p = p + scale_y_log10()
|
|
180
|
+
p = p + gg.scale_y_log10()
|
|
169
181
|
if conv_tol is not None:
|
|
170
182
|
if isinstance(conv_tol, dict):
|
|
171
183
|
for method_name, tol_val in conv_tol.items():
|
|
172
184
|
method_color = palette.get(method_name, "grey")
|
|
173
|
-
p = p + geom_hline(
|
|
185
|
+
p = p + gg.geom_hline(
|
|
174
186
|
yintercept=tol_val,
|
|
175
187
|
linetype="dashed",
|
|
176
188
|
color=method_color,
|
|
@@ -178,7 +190,7 @@ def plot_convergence_curve(
|
|
|
178
190
|
alpha=0.6,
|
|
179
191
|
)
|
|
180
192
|
else:
|
|
181
|
-
p = p + geom_hline(
|
|
193
|
+
p = p + gg.geom_hline(
|
|
182
194
|
yintercept=conv_tol,
|
|
183
195
|
linetype="dashed",
|
|
184
196
|
color="grey",
|
|
@@ -222,6 +234,9 @@ def plot_rff_quality(
|
|
|
222
234
|
|
|
223
235
|
.. versionadded:: 1.4.0
|
|
224
236
|
"""
|
|
237
|
+
import pandas as pd
|
|
238
|
+
|
|
239
|
+
gg = _gg()
|
|
225
240
|
e_df = (
|
|
226
241
|
df[["d_rff", "energy_mae"]]
|
|
227
242
|
.rename(columns={"energy_mae": "mae"})
|
|
@@ -242,20 +257,20 @@ def plot_rff_quality(
|
|
|
242
257
|
)
|
|
243
258
|
|
|
244
259
|
p = (
|
|
245
|
-
ggplot(long, aes(x="d_rff", y="mae"))
|
|
246
|
-
+ geom_line(color=RUHI_COLORS["teal"], size=0.9)
|
|
247
|
-
+ geom_point(color=RUHI_COLORS["teal"], size=1.5)
|
|
248
|
-
+ geom_hline(
|
|
260
|
+
gg.ggplot(long, gg.aes(x="d_rff", y="mae"))
|
|
261
|
+
+ gg.geom_line(color=RUHI_COLORS["teal"], size=0.9)
|
|
262
|
+
+ gg.geom_point(color=RUHI_COLORS["teal"], size=1.5)
|
|
263
|
+
+ gg.geom_hline(
|
|
249
264
|
data=baselines,
|
|
250
|
-
mapping=aes(yintercept="exact"),
|
|
265
|
+
mapping=gg.aes(yintercept="exact"),
|
|
251
266
|
linetype="dashed",
|
|
252
267
|
color=RUHI_COLORS["coral"],
|
|
253
268
|
size=0.5,
|
|
254
269
|
)
|
|
255
|
-
+ facet_wrap("metric", ncol=2, scales="free_y")
|
|
256
|
-
+ labs(x=r"$D_{\mathrm{RFF}}$", y="MAE")
|
|
257
|
-
+
|
|
258
|
-
+ theme(figure_size=(width, height))
|
|
270
|
+
+ gg.facet_wrap("metric", ncol=2, scales="free_y")
|
|
271
|
+
+ gg.labs(x=r"$D_{\mathrm{RFF}}$", y="MAE")
|
|
272
|
+
+ _jost_theme()
|
|
273
|
+
+ gg.theme(figure_size=(width, height))
|
|
259
274
|
)
|
|
260
275
|
return p
|
|
261
276
|
|
|
@@ -538,6 +553,9 @@ def plot_fps_projection(
|
|
|
538
553
|
|
|
539
554
|
.. versionadded:: 1.4.0
|
|
540
555
|
"""
|
|
556
|
+
import pandas as pd
|
|
557
|
+
|
|
558
|
+
gg = _gg()
|
|
541
559
|
sel_df = pd.DataFrame(
|
|
542
560
|
{
|
|
543
561
|
"pc1": np.asarray(selected_pc1),
|
|
@@ -560,12 +578,12 @@ def plot_fps_projection(
|
|
|
560
578
|
}
|
|
561
579
|
|
|
562
580
|
p = (
|
|
563
|
-
ggplot(all_df, aes(x="pc1", y="pc2", color="group"))
|
|
564
|
-
+ geom_point(size=1.5, alpha=0.7)
|
|
565
|
-
+ scale_color_manual(values=palette)
|
|
566
|
-
+ labs(x=r"$\mathrm{PC}_1$", y=r"$\mathrm{PC}_2$", color="")
|
|
567
|
-
+
|
|
568
|
-
+ theme(figure_size=(width, height))
|
|
581
|
+
gg.ggplot(all_df, gg.aes(x="pc1", y="pc2", color="group"))
|
|
582
|
+
+ gg.geom_point(size=1.5, alpha=0.7)
|
|
583
|
+
+ gg.scale_color_manual(values=palette)
|
|
584
|
+
+ gg.labs(x=r"$\mathrm{PC}_1$", y=r"$\mathrm{PC}_2$", color="")
|
|
585
|
+
+ _jost_theme()
|
|
586
|
+
+ gg.theme(figure_size=(width, height))
|
|
569
587
|
)
|
|
570
588
|
return p
|
|
571
589
|
|
|
@@ -607,21 +625,22 @@ def plot_energy_profile(
|
|
|
607
625
|
|
|
608
626
|
.. versionadded:: 1.4.0
|
|
609
627
|
"""
|
|
628
|
+
gg = _gg()
|
|
610
629
|
methods = df[color].unique()
|
|
611
630
|
palette = dict(zip(methods, _METHOD_PALETTE, strict=False))
|
|
612
631
|
|
|
613
632
|
p = (
|
|
614
|
-
ggplot(df, aes(x=x, y=y, color=color))
|
|
615
|
-
+ geom_line(size=0.9)
|
|
616
|
-
+ geom_point(size=2.0)
|
|
617
|
-
+ scale_color_manual(values=palette)
|
|
618
|
-
+ labs(
|
|
633
|
+
gg.ggplot(df, gg.aes(x=x, y=y, color=color))
|
|
634
|
+
+ gg.geom_line(size=0.9)
|
|
635
|
+
+ gg.geom_point(size=2.0)
|
|
636
|
+
+ gg.scale_color_manual(values=palette)
|
|
637
|
+
+ gg.labs(
|
|
619
638
|
x="Image index",
|
|
620
639
|
y=r"$\Delta E$ (eV)",
|
|
621
640
|
color="Method",
|
|
622
641
|
)
|
|
623
|
-
+
|
|
624
|
-
+ theme(figure_size=(width, height))
|
|
642
|
+
+ _jost_theme()
|
|
643
|
+
+ gg.theme(figure_size=(width, height))
|
|
625
644
|
)
|
|
626
645
|
return p
|
|
627
646
|
|
|
@@ -640,14 +659,27 @@ def plot_surface_contour(
|
|
|
640
659
|
levels: int | np.ndarray | None = None,
|
|
641
660
|
contour_step: float | None = None,
|
|
642
661
|
_point_style: str = "star",
|
|
643
|
-
width: float =
|
|
644
|
-
height: float =
|
|
662
|
+
width: float | None = None,
|
|
663
|
+
height: float | None = None,
|
|
664
|
+
*,
|
|
665
|
+
journal: str | JournalPreset | None = None,
|
|
666
|
+
columns: str = "single",
|
|
667
|
+
cmap: str | None = None,
|
|
668
|
+
xlabel: str = r"$x$",
|
|
669
|
+
ylabel: str = r"$y$",
|
|
670
|
+
zlabel: str = r"$E$ (eV)",
|
|
645
671
|
) -> plt.Figure:
|
|
646
672
|
"""2D filled contour with optional path and point overlays.
|
|
647
673
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
674
|
+
Drawn in the style of :mod:`chemparseplot.plot.journal`: one column of
|
|
675
|
+
``journal`` wide and as tall as the equal-aspect map needs, filled with
|
|
676
|
+
the perceptually ordered ``ruhi_seq`` map. Filled bands, contour lines
|
|
677
|
+
and colour-bar ticks share one set of levels, and each contour line is
|
|
678
|
+
black or white, whichever contrasts more with the bands on either side.
|
|
679
|
+
Paths are white lines with a dark outline through numbered sky-blue
|
|
680
|
+
images, a hue the warm sequential map never takes; minima are white
|
|
681
|
+
circles (A, B, ...), saddles white crosses (S1, S2, ...) and other
|
|
682
|
+
points sunshine stars.
|
|
651
683
|
|
|
652
684
|
Parameters
|
|
653
685
|
----------
|
|
@@ -662,13 +694,25 @@ def plot_surface_contour(
|
|
|
662
694
|
clamp_lo, clamp_hi : float or None
|
|
663
695
|
Value clamping for z data.
|
|
664
696
|
levels : int or array or None
|
|
665
|
-
Explicit contour levels. If None,
|
|
697
|
+
Explicit contour levels. If None, the levels are the ticks
|
|
698
|
+
matplotlib's automatic locator puts on the colour bar, which it
|
|
699
|
+
spaces by the tick font size, so every band edge is labelled.
|
|
666
700
|
contour_step : float or None
|
|
667
|
-
Step
|
|
701
|
+
Step between contour lines. If None, lines are drawn at the levels.
|
|
668
702
|
point_style : str
|
|
669
703
|
Default point style: "star" or "labeled".
|
|
670
|
-
width, height : float
|
|
671
|
-
Figure size in inches.
|
|
704
|
+
width, height : float or None
|
|
705
|
+
Figure size in inches. Default: the ``columns`` width of
|
|
706
|
+
``journal`` and the height the map needs at that width.
|
|
707
|
+
journal : str or JournalPreset or None
|
|
708
|
+
Journal whose style goes into the global rcParams, so the figure
|
|
709
|
+
saves in it (default ``"acs"``).
|
|
710
|
+
columns : str
|
|
711
|
+
Column span for the default width.
|
|
712
|
+
cmap : str or None
|
|
713
|
+
Colour map name (default ``"ruhi_seq"``).
|
|
714
|
+
xlabel, ylabel, zlabel : str
|
|
715
|
+
Axis labels and colour-bar label.
|
|
672
716
|
|
|
673
717
|
Returns
|
|
674
718
|
-------
|
|
@@ -684,140 +728,203 @@ def plot_surface_contour(
|
|
|
684
728
|
>>> fig = plot_surface_contour(X, Y, Z, clamp_lo=-1, clamp_hi=1)
|
|
685
729
|
|
|
686
730
|
.. versionadded:: 1.4.0
|
|
731
|
+
|
|
732
|
+
.. versionchanged:: 1.14.0
|
|
733
|
+
Journal style and size by default, the ``ruhi_seq`` map, shared
|
|
734
|
+
levels for bands, lines and colour bar; added *journal*,
|
|
735
|
+
*columns*, *cmap*, *xlabel*, *ylabel* and *zlabel*.
|
|
687
736
|
"""
|
|
688
|
-
|
|
737
|
+
_ensure_ruhi_cmap()
|
|
738
|
+
style = apply_style(journal or DEFAULT_JOURNAL, theme="ruhi")
|
|
739
|
+
cmap = cmap or RUHI_SEQUENTIAL
|
|
689
740
|
|
|
690
|
-
gz = np.asarray(grid_z).copy()
|
|
741
|
+
gz = np.asarray(grid_z, dtype=float).copy()
|
|
691
742
|
if clamp_lo is not None:
|
|
692
743
|
gz = np.clip(gz, clamp_lo, None)
|
|
693
744
|
if clamp_hi is not None:
|
|
694
745
|
gz = np.clip(gz, None, clamp_hi)
|
|
695
746
|
|
|
696
|
-
lo = clamp_lo if clamp_lo is not None else float(
|
|
697
|
-
hi = clamp_hi if clamp_hi is not None else float(
|
|
747
|
+
lo = clamp_lo if clamp_lo is not None else float(np.nanmin(gz))
|
|
748
|
+
hi = clamp_hi if clamp_hi is not None else float(np.nanmax(gz))
|
|
749
|
+
gx = np.asarray(grid_x, dtype=float)
|
|
750
|
+
gy = np.asarray(grid_y, dtype=float)
|
|
751
|
+
|
|
752
|
+
fig_w = style.width(columns) if width is None else width
|
|
753
|
+
fig_h = height
|
|
754
|
+
if fig_h is None:
|
|
755
|
+
fig_h = fig_w * np.ptp(gy) / np.ptp(gx)
|
|
756
|
+
if style.preset.max_height is not None:
|
|
757
|
+
fig_h = min(fig_h, style.preset.max_height)
|
|
758
|
+
fig, ax = plt.subplots(figsize=(fig_w, fig_h), layout="constrained")
|
|
759
|
+
ax.set_xlim(gx.min(), gx.max())
|
|
760
|
+
ax.set_ylim(gy.min(), gy.max())
|
|
761
|
+
ax.set_aspect("equal")
|
|
762
|
+
ax.set_xlabel(xlabel)
|
|
763
|
+
ax.set_ylabel(ylabel)
|
|
698
764
|
|
|
699
765
|
if levels is None:
|
|
700
|
-
levels =
|
|
701
|
-
|
|
766
|
+
levels = _colorbar_levels(ax, lo, hi, cmap, zlabel)
|
|
767
|
+
cf = ax.contourf(gx, gy, gz, levels=levels, cmap=cmap)
|
|
768
|
+
cbar = fig.colorbar(cf, cax=_colorbar_axes(ax), label=zlabel)
|
|
702
769
|
if contour_step is None:
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
770
|
+
line_levels = np.asarray(cf.levels)
|
|
771
|
+
else:
|
|
772
|
+
line_levels = np.arange(lo, hi + contour_step, contour_step)
|
|
773
|
+
inside = line_levels[(line_levels > np.nanmin(gz)) & (line_levels < np.nanmax(gz))]
|
|
774
|
+
if len(inside):
|
|
775
|
+
lines = ax.contour(
|
|
776
|
+
gx,
|
|
777
|
+
gy,
|
|
778
|
+
gz,
|
|
779
|
+
levels=inside,
|
|
780
|
+
colors=_contour_line_colors(cf, inside, style),
|
|
781
|
+
linewidths=style.narrow,
|
|
782
|
+
)
|
|
783
|
+
cbar.add_lines(lines)
|
|
715
784
|
|
|
716
|
-
# NEB paths: white line + coral circles + numbered images
|
|
717
785
|
if paths is not None:
|
|
786
|
+
outline = [
|
|
787
|
+
mpe.Stroke(
|
|
788
|
+
linewidth=style.wide + 2 * style.narrow, foreground=style.textcolor
|
|
789
|
+
),
|
|
790
|
+
mpe.Normal(),
|
|
791
|
+
]
|
|
792
|
+
offset = style.gap + style.marker / 2
|
|
718
793
|
for _label, (xs, ys) in paths.items():
|
|
719
794
|
xs = np.asarray(xs)
|
|
720
795
|
ys = np.asarray(ys)
|
|
721
|
-
ax.plot(
|
|
796
|
+
ax.plot(
|
|
797
|
+
xs,
|
|
798
|
+
ys,
|
|
799
|
+
color=style.facecolor,
|
|
800
|
+
linewidth=style.wide,
|
|
801
|
+
path_effects=outline,
|
|
802
|
+
zorder=30,
|
|
803
|
+
)
|
|
722
804
|
ax.scatter(
|
|
723
805
|
xs,
|
|
724
806
|
ys,
|
|
725
|
-
c=RUHI_COLORS["
|
|
726
|
-
s=
|
|
807
|
+
c=RUHI_COLORS["sky"],
|
|
808
|
+
s=style.marker**2,
|
|
727
809
|
marker="o",
|
|
728
|
-
edgecolors=
|
|
729
|
-
linewidths=
|
|
810
|
+
edgecolors=style.facecolor,
|
|
811
|
+
linewidths=style.narrow,
|
|
730
812
|
zorder=31,
|
|
731
813
|
)
|
|
814
|
+
# Image numbers go below the path, point labels above it, so the
|
|
815
|
+
# two never cover each other where an image is a stationary point.
|
|
732
816
|
for j in range(len(xs)):
|
|
733
817
|
ax.annotate(
|
|
734
818
|
str(j + 1),
|
|
735
819
|
(xs[j], ys[j]),
|
|
736
820
|
textcoords="offset points",
|
|
737
|
-
xytext=(
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
821
|
+
xytext=(offset, -offset),
|
|
822
|
+
va="top",
|
|
823
|
+
fontsize=style.footnote,
|
|
824
|
+
color=style.facecolor,
|
|
825
|
+
path_effects=style.halo(),
|
|
741
826
|
zorder=32,
|
|
742
827
|
)
|
|
743
828
|
|
|
744
|
-
# Points: context-dependent markers
|
|
745
829
|
if points is not None:
|
|
746
830
|
_min_labels = iter(["A", "B", "C", "D", "E"])
|
|
747
831
|
_sad_labels = iter(["S1", "S2", "S3", "S4"])
|
|
832
|
+
big = style.marker_large
|
|
833
|
+
offset = style.gap + big / 2
|
|
834
|
+
label_kw = {
|
|
835
|
+
"textcoords": "offset points",
|
|
836
|
+
"xytext": (offset, offset),
|
|
837
|
+
"va": "bottom",
|
|
838
|
+
"fontsize": style.body,
|
|
839
|
+
"fontweight": "bold",
|
|
840
|
+
"color": style.facecolor,
|
|
841
|
+
"path_effects": style.halo(),
|
|
842
|
+
"zorder": 34,
|
|
843
|
+
}
|
|
844
|
+
marker_kw = {
|
|
845
|
+
"c": style.facecolor,
|
|
846
|
+
"s": big**2,
|
|
847
|
+
"edgecolors": style.textcolor,
|
|
848
|
+
"linewidths": style.narrow,
|
|
849
|
+
"zorder": 33,
|
|
850
|
+
}
|
|
748
851
|
|
|
749
852
|
for pname, (xs, ys) in points.items():
|
|
750
853
|
xs = np.asarray(xs)
|
|
751
854
|
ys = np.asarray(ys)
|
|
752
855
|
|
|
753
856
|
if "minim" in pname.lower():
|
|
754
|
-
|
|
755
|
-
ax.scatter(
|
|
756
|
-
xs,
|
|
757
|
-
ys,
|
|
758
|
-
c="white",
|
|
759
|
-
s=80,
|
|
760
|
-
marker="o",
|
|
761
|
-
edgecolors="black",
|
|
762
|
-
linewidths=1.5,
|
|
763
|
-
zorder=33,
|
|
764
|
-
)
|
|
857
|
+
ax.scatter(xs, ys, marker="o", **marker_kw)
|
|
765
858
|
for k in range(len(xs)):
|
|
766
|
-
|
|
767
|
-
ax.annotate(
|
|
768
|
-
lbl,
|
|
769
|
-
(xs[k], ys[k]),
|
|
770
|
-
textcoords="offset points",
|
|
771
|
-
xytext=(6, 6),
|
|
772
|
-
fontsize=12,
|
|
773
|
-
fontweight="bold",
|
|
774
|
-
color="white",
|
|
775
|
-
path_effects=_STROKE,
|
|
776
|
-
zorder=34,
|
|
777
|
-
)
|
|
859
|
+
ax.annotate(next(_min_labels, f"M{k}"), (xs[k], ys[k]), **label_kw)
|
|
778
860
|
elif "saddle" in pname.lower():
|
|
779
|
-
|
|
780
|
-
ax.scatter(
|
|
781
|
-
xs,
|
|
782
|
-
ys,
|
|
783
|
-
c="white",
|
|
784
|
-
s=100,
|
|
785
|
-
marker="X",
|
|
786
|
-
edgecolors="black",
|
|
787
|
-
linewidths=1.5,
|
|
788
|
-
zorder=33,
|
|
789
|
-
)
|
|
861
|
+
ax.scatter(xs, ys, marker="X", **marker_kw)
|
|
790
862
|
for k in range(len(xs)):
|
|
791
|
-
|
|
792
|
-
ax.annotate(
|
|
793
|
-
lbl,
|
|
794
|
-
(xs[k], ys[k]),
|
|
795
|
-
textcoords="offset points",
|
|
796
|
-
xytext=(6, 6),
|
|
797
|
-
fontsize=12,
|
|
798
|
-
fontweight="bold",
|
|
799
|
-
color="white",
|
|
800
|
-
path_effects=_STROKE,
|
|
801
|
-
zorder=34,
|
|
802
|
-
)
|
|
863
|
+
ax.annotate(next(_sad_labels, f"S{k}"), (xs[k], ys[k]), **label_kw)
|
|
803
864
|
else:
|
|
804
|
-
#
|
|
865
|
+
# A star fills half its box, so it gets twice the area.
|
|
805
866
|
ax.scatter(
|
|
806
867
|
xs,
|
|
807
868
|
ys,
|
|
808
|
-
c=RUHI_COLORS["sunshine"],
|
|
809
|
-
s=120,
|
|
810
869
|
marker="*",
|
|
811
|
-
|
|
812
|
-
linewidths=1.0,
|
|
813
|
-
zorder=33,
|
|
870
|
+
**{**marker_kw, "c": RUHI_COLORS["sunshine"], "s": 2 * big**2},
|
|
814
871
|
)
|
|
815
872
|
|
|
816
|
-
|
|
817
|
-
|
|
873
|
+
if height is None:
|
|
874
|
+
fit_height(fig)
|
|
818
875
|
return fig
|
|
819
876
|
|
|
820
877
|
|
|
878
|
+
# Matplotlib's colour-bar defaults (Figure.colorbar): gap to the parent of 0.05
|
|
879
|
+
# of its width, and length 20 times the thickness.
|
|
880
|
+
_CBAR_PAD = 0.05
|
|
881
|
+
_CBAR_ASPECT = 20.0
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
def _colorbar_axes(ax):
|
|
885
|
+
"""Colour-bar axes exactly as tall as the equal-aspect ``ax``.
|
|
886
|
+
|
|
887
|
+
A colour bar attached with ``ax=`` spans the layout cell, which is taller
|
|
888
|
+
than an equal-aspect map; this one is an inset on the map's own box, with
|
|
889
|
+
matplotlib's default gap and aspect. Its width follows from the data
|
|
890
|
+
aspect, which an equal-aspect box keeps, so no layout pass is needed.
|
|
891
|
+
"""
|
|
892
|
+
x0, x1 = ax.get_xlim()
|
|
893
|
+
y0, y1 = ax.get_ylim()
|
|
894
|
+
box_aspect = abs(y1 - y0) / abs(x1 - x0)
|
|
895
|
+
return ax.inset_axes([1.0 + _CBAR_PAD, 0.0, box_aspect / _CBAR_ASPECT, 1.0])
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
def _colorbar_levels(ax, lo, hi, cmap, label) -> np.ndarray:
|
|
899
|
+
"""Levels at the ticks matplotlib's automatic locator puts on the colour
|
|
900
|
+
bar of ``ax`` for ``[lo, hi]``, extended by one tick to cover the range."""
|
|
901
|
+
fig = ax.figure
|
|
902
|
+
probe = fig.colorbar(
|
|
903
|
+
ScalarMappable(Normalize(lo, hi), cmap=cmap), cax=_colorbar_axes(ax), label=label
|
|
904
|
+
)
|
|
905
|
+
fig.draw_without_rendering()
|
|
906
|
+
locator = AutoLocator()
|
|
907
|
+
locator.set_axis(probe.ax.yaxis)
|
|
908
|
+
levels = locator.tick_values(lo, hi)
|
|
909
|
+
probe.remove()
|
|
910
|
+
return levels
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
def _contour_line_colors(filled, line_levels, style) -> list[str]:
|
|
914
|
+
"""Text or background colour for each line, whichever contrasts more with
|
|
915
|
+
the filled bands on both sides of it."""
|
|
916
|
+
bounds = np.asarray(filled.levels)
|
|
917
|
+
bands = filled.to_rgba(filled.cvalues)[:, :3]
|
|
918
|
+
last = len(bands) - 1
|
|
919
|
+
candidates = (style.textcolor, style.facecolor)
|
|
920
|
+
colors = []
|
|
921
|
+
for value in line_levels:
|
|
922
|
+
below = int(np.clip(np.searchsorted(bounds, value, side="left") - 1, 0, last))
|
|
923
|
+
above = int(np.clip(np.searchsorted(bounds, value, side="right") - 1, 0, last))
|
|
924
|
+
colors.append(best_contrast(bands[[below, above]], candidates))
|
|
925
|
+
return colors
|
|
926
|
+
|
|
927
|
+
|
|
821
928
|
def plot_gp_progression(
|
|
822
929
|
grids: dict[int, dict],
|
|
823
930
|
_true_energy,
|
|
@@ -889,7 +996,7 @@ def plot_gp_progression(
|
|
|
889
996
|
ax = axes[row][col]
|
|
890
997
|
gp_mean = np.clip(np.asarray(data["gp_mean"]), clamp_lo, clamp_hi)
|
|
891
998
|
|
|
892
|
-
cf = ax.contourf(xv, yv, gp_mean, levels=levels, cmap=
|
|
999
|
+
cf = ax.contourf(xv, yv, gp_mean, levels=levels, cmap=RUHI_SEQUENTIAL)
|
|
893
1000
|
ax.contour(xv, yv, gp_mean, levels=contour_levels, colors="black", linewidths=0.3)
|
|
894
1001
|
|
|
895
1002
|
# Training points
|
|
@@ -985,8 +1092,8 @@ def plot_nll_landscape(
|
|
|
985
1092
|
hi = float(np.quantile(log_finite, 0.98))
|
|
986
1093
|
gz_clipped = np.clip(gz_log, 0, hi)
|
|
987
1094
|
|
|
988
|
-
# Reversed
|
|
989
|
-
cf = ax.contourf(gx, gy, gz_clipped, levels=20, cmap="
|
|
1095
|
+
# Reversed sequential map: low NLL is light and warm.
|
|
1096
|
+
cf = ax.contourf(gx, gy, gz_clipped, levels=20, cmap=f"{RUHI_SEQUENTIAL}_r")
|
|
990
1097
|
fig.colorbar(
|
|
991
1098
|
cf,
|
|
992
1099
|
ax=ax,
|
|
@@ -1096,7 +1203,7 @@ def plot_variance_overlay(
|
|
|
1096
1203
|
contour_levels = np.arange(clamp_lo, clamp_hi + contour_step, contour_step)
|
|
1097
1204
|
|
|
1098
1205
|
# Energy surface as filled contour (shows basins clearly)
|
|
1099
|
-
cf = ax.contourf(gx, gy, ge, levels=levels, cmap=
|
|
1206
|
+
cf = ax.contourf(gx, gy, ge, levels=levels, cmap=RUHI_SEQUENTIAL)
|
|
1100
1207
|
ax.contour(gx, gy, ge, levels=contour_levels, colors="black", linewidths=0.3)
|
|
1101
1208
|
fig.colorbar(cf, ax=ax, label="Energy", shrink=0.8)
|
|
1102
1209
|
|