Thermo-optics: optical response vs experimental data of any form#
PAOFLOW.agentic.thermo_optics compares PAOFLOW’s temperature-dependent
optical response with experimental data. It is agnostic of the material and of
the form of the data:
tables, free text, vector or scanned PDF figures, slide decks or images. The
same tools served an absorption edge, emissivity spectra, free-carrier
absorption and refractive indices of Si. The model is an electron-phonon
system folder (examples/elphon/<System> layout: system.py, the optics/
workflow of PAOFLOW.elphon.workflows); the adapter paoflow_optics.OpticsModel
reads it. The sibling packages PAOFLOW.agentic.transport,
PAOFLOW.agentic.superconductivity and PAOFLOW.agentic.arpes reuse this
package’s toolkit (datasets, units, ingest, digitize, metrics, plotting) with
their own adapters (see agentic-transport,
agentic-superconductivity,
agentic-arpes); another observable needs another adapter.
The agent playbook, lessons learned, prompts and templates live outside the
package, in agentic/thermo_optics/.
Data model#
Every source becomes a canonical long table (datasets.COLUMNS):
dataset, quantity, x, x_unit, y, y_unit, temperature_k, conditions,
provenance, source, locator, y_rel_uncertainty, note
provenanceis one of five values:measured: raw data;transcribed: typed from a table or text;vector-extracted: exact coordinates from PDF paths;digitised: from a bitmap;calculated: models and published theory.
read_datasetrejects any other value.conditionsholdskey=valuepairs (format_conditions,parse_conditions).Header.
write_dataset(path, frame, header)writes the provenance record as leading#lines: source, method, calibration residuals and assumptions.dataset_header_linesreads it back. Only the leading#lines are comments: a#inside a field is data.
Modules#
module |
role |
|---|---|
|
canonical table, provenance, conditions |
|
photon energy ↔ wavelength ↔ wavenumber ↔ frequency, temperatures |
|
|
|
|
|
|
|
|
|
back-compatibility alias of |
|
|
Design choices#
Digitisation and comparison are separate. A study writes
data/*.csv, then compares, then plots. Each step reads only the previous step’s files, so a figure can be restyled, or the model swapped, without touching the digitisation.Adapters are thin and read-only. An adapter maps an output folder to an observable at given conditions.
OpticsModelprovides:absorption_coefficient: α = 2ωκ/c from ε, or the driver’s constant-n α;refractive_index;emissivity(T, thickness_m, angle_deg): recomputed for the experimental slab withresponse.emissivity.emissivity_from_dielectric.
The adapter opens a system folder with
from_system(folder, output=...)(PAOFLOW.elphon.workflows.load_system) and reports its configuration indescribe(), next to the run metadata the drivers store (grids, gaps, scissor mode and 0 K scissor, position dipoles, adaptive smearing, electrons provenance, screening). A new observable needs a new adapter, not a new pipeline; new runs are driver commands of the system folder (optics/absorption.py --outdir,optics/emissivity.pyfor geometry/scissor variants without a kernel run).Interpolated models are labelled.
OpticsModel.dielectric(T, interpolate=True)takes ε₁ linear in T and ln ε₂ linear in 1/T. Absorption interpolates ln α in 1/T.bracket(T)gives the two model temperatures, used to quote the sensitivity.Tracers for real scans.
trace_pathsteps by arc length with a turn limit, so it follows vertical segments and sharp peaks.link_dasheschains dash blobs along their principal axes, with a lateral penalty. This separates dashed lines packed closer than their gaps, where a straight continuation lands on the neighbour.filled_markersuses a morphological opening that erases strokes thinner than the dots.assign_to_curvesgives each marker to the polyline nearest it, and returns −1 for label glyphs.
Metrics come with baselines. The library computes deviations; the study is expected to quote each one next to a published calculation, a second measurement, or a trivial model (see the playbook).
Tests#
tests/unit/agentic/thermo_optics/:
dataset round trip (header,
#in fields, provenance check);units;
metrics on analytic cases (log ratio, recovered shift, Arrhenius energy, exact 1/T interpolation);
synthetic rasters: skewed frame, ticks, dots on a line with glyphs, JPEG-broken rings, a steep tanh curve, two dashed lines 12 px apart;
a generated vector PDF (exact frame, ticks and curve);
OpticsModelon synthetic outputs and on a synthetic system folder (from_system);the plotting helpers.