Agentic-SLS-ASTM / CLAUDE.md
ppak10's picture
Updates figures
8692359
|
Raw
History Blame Contribute Delete
27.1 kB
# CLAUDE.md
Context for continuing work on this dataset. Captures the design decisions and conventions worked out so far.
## What this dataset is
`Agentic-SLS-ASTM` is the **ML-facing mechanical-test dataset**: one row per ASTM specimen (D638 tensile, D790 flex), with the mechanical response (curves + scalars) and the **printer state that produced the part** embedded inline as a snapshot. Domain-aligned with `Agentic-SLS-Database`, which is the canonical *graph* of printer entities.
Default to embedding snapshots over relying on cross-joins — consumers training models should be able to load this one config and have everything they need on each row.
## Open notes (as of 2026-06-24)
The dataset grew faster than the docs. Some of the architectural claims below
are now drifting from reality — flagging here so future-you doesn't trust
this file uncritically.
- **Specimen counts in the README and "Current state" section below are stale.** Real counts as of 2026-06-24: **38 D638 + 32 D790 = 70 specimens**, across 9 scripts. Includes a new PA12GF_FL Formlabs PA12 GF control series (5 tensile + 5 flex, from `2026_06_16/`). The README configs table still claims `22 SLS + 3 PLA + 3 PETG = 28` for D638.
- **`batch_label` no longer cleanly identifies a print run.** Batch D (5 D638, tested 6/08) and Batch E (5 D638, tested 6/10) come from the **same** 2026-06-07 print job — so `batch_label` is now closer to "test cohort" than "print batch identity". This contradicts the architectural decision below. Pick a side: either rename to `test_cohort` and update docs, or split E off and use a different scheme to encode "tested twice from same print".
- **Missing flex script for 2026-06-08.** `source/2026_06_08/TST2.Test/` has 6 TestRun folders + `flex_testing_6.8.xlsx`, but only the TST1.Test tensile side is wired up in `04_2026_06_08_tensile.py`. Needs a paired `04_2026_06_08_flex.py` (or similar).
- **Numbering collision in `scripts/specimens/`.** Two scripts share the `04_` prefix (`04_2026_06_08_tensile.py` and `04_2026_06_10_tensile.py`). Harmless functionally; the ordering convention from earlier in this file no longer holds.
- **Backfilling-Batch-E recipe below is wrong now.** The Batch E in D638 is no longer the orphan-print case (it has FKs from the 2026-06-07 print). Only D790 Batch E is still the "print not in Database" case. The recipe needs to be re-scoped to "D790 Batch E only".
- **`notes` field on rows is new** (see `_lib.py:223`). Currently only the Formlabs tensile session sets it ("Printed vertically."); other rows get empty string. Not documented in the "Row shape" section below.
- **PA12GF_FL material class is new and not documented.** `material_class` enum below mentions only SLS/PLA/PETG; `PA12GF_FL` (Formlabs PA12 GF reference prints) should be added.
The figures in `assets/` were regenerated and **do** reflect the current data — the Formlabs PA12 GF reference in particular reveals that the Inova Mk1 SLS specimens hit only ~10 MPa tensile vs Formlabs PA12 GF's ~25 MPa for the same nominal material, which is the comparison study these controls were added to enable. (Note: the plots section below has since been rewritten — the old overlaid "composite" figures were replaced by the batch-cluster overview + per-batch detail figures; see the `scripts/plots/` decision.)
## Ecosystem
- **Upstream graph dataset**: `ppak10/Agentic-SLS-Database` — canonical print jobs, sessions, profiles, objects (see its CLAUDE.md). This dataset reads `Agentic-SLS-Database/data/jobs.jsonl` and `Agentic-SLS-Database/source/PrintProfiles/*.json` directly via a sibling-folder relative path (both repos live side by side under the recorder repo's `datasets/` as submodules).
- **Sibling domain dataset**: `Agentic-SLS-Telemetry` — 10 Hz build telemetry.
- **Raw mechanical-test source**: TestWorks 4.1 (MTS Insight EM Tension / 3-pt Flex) — per-session folders dropped under `source/{YYYY_MM_DD}/`. LFS-tracked.
## Architectural decisions
- **One row per specimen.** Granularity = a single TestRun. `specimen_id` (= `"{session_folder}/TSR{n}"`, or `"{session_folder}/{test_folder}/TSR{n}"` when a session_folder holds more than one Test project — see Batch H/I tensile) is the path-style unique key; `sample_id` (= `"{batch_label}{seq}"`, e.g. `"C7"`) is the human-friendly handle.
- **One HF config per ASTM standard.** Tensile (D638) and flex (D790) live in `data/D638.jsonl` and `data/D790.jsonl` and load as separate configs (`load_dataset("ppak10/Agentic-SLS-ASTM", "D790")`). The schema is identical across configs; only the `astm.standard` value and the metric coverage differ.
- **Snapshot + reference for SLS rows.** Each SLS row carries both the FK ids (`job_id`, `print_profile_id`, `object_hash`) AND the full `print_profile_snapshot` JSON. The PrintProfile is the load-bearing feature set for ML; the job snapshot is *not* embedded (job_id is enough — consumers can join if they need the full job metadata).
- **Batch labels are a property of the print batch, not the test session.** `batch_label` (A through I so far) identifies the print run the specimen came from, so the same batch can appear in both configs (e.g. Batch C produced both tensile and flex specimens from the same 06/02 print). `sample_id` numbering is **per-config-per-batch**, so `C1` in D638 ≠ `C1` in D790 (different physical specimens, same batch).
- **PLA / PETG / FormLabs control rows live alongside SLS rows in each config.** They carry the same mechanical-result fields with `material_class != "SLS"`, null Database FKs, and **null `sample_id`/`batch_label`** (they didn't come from an SLS print batch). They're benchtop comparison material printed elsewhere and tested on the same Instron.
- **One script per source session folder, plus a shared `_lib.py`.** Each `scripts/specimens/{NN}_*.py` declares one `SESSION` dict (session_folder, xlsx_name, astm, batch_label, test_runs) and calls `_lib.process_session(SESSION)`. Reader/joiner/builder logic lives in `_lib.py`. Auto-inference of "test the day after print" is **not** safe — 2026-06-10 mixes 3 materials in one session and Batch C flex was tested 8 days after print, so the session→print-job mapping has to be declared per script.
- **A session_folder can hold more than one Test project.** Batch H and I tensile were both run under `source/2026_06_30/Tensile/`, as `TST1.Test` and `TST2.Test` respectively (confirmed by matching each project's `persistent.h5` Modulus values against its xlsx export sheet-by-sheet, since neither the TestRun.Traits names nor xlsx sheet names disambiguate them). Two scripts, same `session_folder`, different `test_folder` + `batch_label` + `xlsx_name`.
- **`xlsx_only` sessions for specimens whose raw h5 didn't survive.** Batch H's 5 flex specimens (`2026_06_30/Flex 6-30/`) have no matching TestRuns folder — it looks like TestWorks overwrote it when the Batch I project reused the same default `TST1.Test` name in the same directory. `_lib.build_row_from_xlsx` (used when a `SESSION` dict sets `"xlsx_only": True`) reads the raw load/extension curve straight from xlsx cols A-B and whatever scalar metrics that export happened to include, converting units via `convert_unit()`. Curves/metrics not present in that export (full strain/stress arrays, modulus, yield — they need the support span) stay null/empty rather than being approximated. Prefer fixing the underlying data (re-export from TestWorks) over reusing this path if it happens again; it's a fallback, not the default.
- **`notes` is a free-text per-row field** for exceptions that don't fit elsewhere in the schema (e.g. "printed vertically" for FormLabs, or the xlsx-only sourcing caveat for Batch H flex). Empty string when there's nothing to flag.
- **One JSONL file per specimen.** Outputs land under `data/{standard}/{sample_id}.jsonl` (or `data/D638/{material_class}_TSR{n}.jsonl` for non-SLS controls without a sample_id). HF configs glob these via `path: data/D638/*.jsonl`. This keeps git diffs scoped to a single specimen when a row is regenerated and makes it easy to delete or replace individual rows.
- **Domain dependencies, not stdlib-only.** Unlike `Agentic-SLS-Database` (stdlib only), the ETL here needs `h5py`, `openpyxl`, `matplotlib`, and `numpy` (the latter two for `scripts/plots/`). They're declared in `pyproject.toml`. Python 3.13.
- **`scripts/plots/` follows the same shared-lib pattern as `scripts/specimens/`.** `_lib.py` holds the **house style** (`apply_house_style()`/`style_axes()`/`save_figure()` — DM Sans from `scripts/plots/fonts/`, framed heavy spines, inward ticks, light dashed grid, dual PNG@1200 + PDF export; ported from the [`AdditiveLLM2-OA`](https://huggingface.co/datasets/ppak10/AdditiveLLM2-OA) figures), the **palette** (`BATCH_COLORS` = an ordered orange ramp gold→deep-brown built around `ACCENT`=`#F97415`, sampled per print chronology from `ORDERED_BATCHES`; `FORMLABS_COLOR` = contrasting blue for the PA12GF reference so it reads as the external benchmark; `MATERIAL_COLORS` for the other controls), and the shared `load_specimen`/`load_standard` readers. Four plot scripts:
- `01_controls.py` — the broken-out PLA/PETG, FormLabs Nylon 12 White, and Batch M Type IV figures (materials/geometries that don't belong on the batch comparison; `render_type_iv` lives here).
- `02_batch_averages.py` — per-batch mean ± 1 SD bands (SLS + FormLabs PA12GF). Each specimen is trimmed at its stress peak in `group_average` before interpolation so the fracture branch doesn't spike the band (this superseded the old per-Nylon `truncate_at_peak` special-case — it's now universal). `render_bands()`/`grouped_specs()` also target a single group for the Nylon 12 White `{standard}_nylon12white_average.png`.
- `03_batch_clusters.py` — the **canonical across-batch overview** (replaced the old overlaid composite, which was unreadable at 76–80 curves). One peak point per specimen `(strain@peak, ultimate strength)` — peak = `max(stress)` over the saved curve, robust to TestWorks' null `PeakStress` — with a covariance-based **±1 SD confidence ellipse** per batch (`confidence_ellipse`; groups with n<3 draw a segment/marker instead).
- `04_batch_details.py` — one uncluttered stress-strain figure **per batch** under `assets/batches/{standard}_{batch}.png`, each specimen individually colored (tab10) and `sample_id`-keyed, for reading a single batch's curves without cross-batch clutter.
## Directory layout
```
source/
{YYYY_MM_DD}/ # one folder per test date
[sublabel/] # e.g. "Tensile Testing", "Batch C 3pt test"
*.tsproj # TestWorks project pointer
*.xlsx # human-readable export, one sheet per TSR
TST1.Test/
TestRuns/TSR{n}.TestRun/
Data/DaqTaskActivity1.h5 # raw DAQ scans (10 Hz): ext_m, load_N, time_s
AnalysisRuns/ANR1.AnalysisRun/
persistent.h5 # analyzed scalars + StressArray/StrainArray
TestRun.Traits # small XML — Name, Date, UniqueId
TestRun.1.Traits # ~20k lines, mostly base64 .NET ExecutionState — SKIP
scripts/specimens/
_lib.py # shared readers, Database lookup, build_row(_from_xlsx), process_session
01_2026_05_26.py # Batch A tensile
02_2026_06_01.py # Batch B tensile
03_2026_06_03.py # Batch C tensile
04_2026_06_08_tensile.py # Batch D tensile
04_2026_06_10_tensile.py # Batch E tensile + PLA/PETG controls
05_2026_06_10_batch_c.py # Batch C flex
06_2026_06_10_batch_d.py # Batch D flex
07_2026_06_10_batch_e.py # Batch E flex (no Database FK yet)
08_2026_06_16_tensile_formlabs.py # FormLabs PA12GF tensile control
09_2026_06_16_flex_formlabs.py # FormLabs PA12GF flex control
10_2026_06_25_tensile.py # Batch F tensile
11_2026_06_25_flex.py # Batch F flex
12_2026_06_26_tensile.py # Batch G tensile
13_2026_06_26_flex.py # Batch G flex
14_2026_06_30_tensile_h.py # Batch H tensile (TST1.Test)
15_2026_06_30_tensile_i.py # Batch I tensile (TST2.Test, same session_folder as H)
16_2026_06_30_flex_i.py # Batch I flex
17_2026_06_30_flex_h.py # Batch H flex — xlsx_only, no TestRuns folder
18_2026_07_06_tensile_j.py # Batch J tensile (not media blasted)
19_2026_07_06_flex_j.py # Batch J flex (not media blasted)
20_2026_07_08_tensile_j_mb.py # Batch J_MB tensile (media blasted, same print as J)
21_2026_07_08_flex_j_mb.py # Batch J_MB flex (media blasted, same print as J)
22_2026_07_15_tensile_k.py # Batch K tensile — xlsx_only, no h5 handed off
23_2026_07_15_tensile_l.py # Batch L tensile — xlsx_only
24_2026_07_15_flex_k.py # Batch K flex — xlsx_only
25_2026_07_15_flex_l.py # Batch L flex — xlsx_only
26_2026_07_21_tensile_m.py # Batch M tensile, Type I (M1-M5) — xlsx_only
27_2026_07_21_tensile_m_type4.py # Batch M tensile, Type IV (M6-M17, seq_start=5) — xlsx_only
28_2026_07_21_flex_m.py # Batch M flex — xlsx_only
29_2026_07_23_tensile_n.py # Batch N tensile — xlsx_only
30_2026_07_23_flex_n.py # Batch N flex — xlsx_only
31_2026_07_23_tensile_nylon12white_fl.py # FormLabs Nylon 12 White tensile control — xlsx_only
32_2026_07_23_flex_nylon12white_fl.py # FormLabs Nylon 12 White flex control — xlsx_only
data/
D638/ # one JSONL per specimen (HF glob: data/D638/*.jsonl)
A1.jsonl ... N5.jsonl # SLS specimens, named by sample_id
PLA_TSR6.jsonl ... NYLON12_WHITE_FL_Sheet5.jsonl # non-SLS controls (no sample_id)
D790/
C1.jsonl ... N5.jsonl # SLS specimens, named by sample_id
```
## File format notes — TestWorks 4.1 output
- **`Data/DaqTaskActivity1.h5`**: HDF5 with one `Session{16-digit}` group. `Scans` is `(N, 3) float64` of `[extension_m, load_N, time_s]` per the `Signals` dataset. `Triggers` records DAQ config (sample rate is in there as e.g. `Frequency=10`).
- **`AnalysisRuns/ANR1.AnalysisRun/persistent.h5`**: HDF5 with a single dataset `Values` of shape `(1,)` containing a giant compound record. All scalar metrics (Modulus, PeakStress, StressAtBreak, Yield, Slope, etc.) are `<f8` fields; **stress-strain curves are `object`-dtype fields** (`StressArray`, `StrainArray`, `_TimeArray`, etc.) that decode to variable-length numpy arrays.
- **xlsx export**: cols A-B = curve, row 1 = TestRun name, row 2 = units, cols D-I = `(DisplayName, Value, Unit, Reset Value, Original Value, Description)` per scalar metric. **Specimen `Width` and `Thickness` only live here** — not in any tidy field in the h5 files (the h5 only has the derived `Area` and `AdjGage`).
- **`TestRun.1.Traits`** and `Test.1.Traits` etc. are mostly opaque .NET binary serialization (base64-encoded inside an `<ExecutionState>` element). Don't try to parse — re-derive from the h5 / xlsx instead.
## Row shape
See `README.md` for the full schema. Key envelope fields:
- `sample_id` = `"{batch_label}{seq}"` (e.g. `"A1"`, `"C7"`, `"E10"`); null for non-SLS controls.
- `batch_label``{"A".."I"}`; null for non-SLS controls.
- `specimen_id` = `"{session_folder}/TSR{n}"` (or `"{session_folder}/{test_folder}/TSR{n}"` when disambiguating multiple Test projects in one session_folder) — fully qualified unique key (use this if you need to disambiguate across configs).
- `material_class` ∈ `{"SLS", "PLA", "PETG", …}` — only `"SLS"` rows have populated Database FKs and `print_profile_snapshot`.
- `astm` = `{standard, type, year}` object — structured (not a flat string) so ISO equivalents can be added later without breaking schema.
- `curves` carries **both** analyzed (`stress_pa`, `strain`) and raw DAQ (`time_s`, `extension_m`, `load_n`) — lossless.
### IMPORTANT — TestWorks analysis often fails to detect peak/break for tensile
Many D638 TSRs have `Peak = LongMax (9223372036854775807)` in persistent.h5, which leaves `PeakLoad`, `PeakStress`, `StressAtBreak`, `EnergyToBreak`, `StrnAtBreak` etc. all `NaN` despite a real break occurring. Our extract surfaces these as `null`. **The full stress-strain curve is still saved**, so consumers can re-derive peak/break with their own criteria. D790 flex rows have these populated more consistently. Don't filter rows based on null metrics; they may still be perfectly valid trials.
### IMPORTANT — field-name divergence between tensile and flex persistent.h5
Same TestWorks framework, different schema. Notable renames you have to handle:
- `StrnAtPeak` (tensile) ↔ `StrainAtPeak` (flex)
- `StrnAtBreak` (tensile) ↔ `BreakStrain` (flex)
- `StrnAtYield` (tensile) ↔ `StrainAtYield` (flex)
- `Slope` (tensile, single) ↔ `Slope1`/`Slope2` (flex)
- `AdjGage` (tensile only — flex has no analogous field, gauge_length_mm is always null for D790)
`get_either(d, "tensile_name", "flex_name")` in `_lib.py` handles this. If you add new scalars, check both files and use `get_either` rather than picking one name.
## Current state
- `D638` config — 103 rows: 87 SLS across batches A-N (batch counts: A5 B5 C7 D5 E5 F5 G5 H3 I5 J4 J_MB5 K5 L6 M17 N5) + 3 PLA + 3 PETG + 5 FormLabs PA12GF + 5 FormLabs Nylon 12 White.
- `D790` config — 81 rows: 71 SLS across batches C-N (batch counts: C9 D8 E10 F9 G4 H5 I5 J2 J_MB2 K3 L4 M5 N5) + 5 FormLabs PA12GF + 5 FormLabs Nylon 12 White.
- **Batches K-N have `db_print_date=None`** (print jobs not yet backfilled into Database) — SLS rows through J/J_MB have Database FKs (2026-07-12 backfill: E ← 2026-06-07 (same as D), F ← 2026-06-13, G ← 2026-06-09, H ← 2026-06-24, I ← 2026-06-25, J/J_MB ← 2026-06-27 (`D790 and D638 and other objects`)); K, L, M, N still need the same treatment once their print jobs land.
- **`_lib.py` disambiguates same-date jobs by STL content.** Two 2026-06-27 prints share a date in Database; `resolve_database_fk` picks the one whose object list contains the standard's STL needle (`d638` / `d790`). Same fix will apply to any future same-date collision (e.g. 06-29 already has two jobs, though no ASTM specimens map there yet).
- Total: 184 specimens, produced by 32 per-session scripts (some date folders — 2026_06_10, 2026_06_30, 2026_07_21 — contain more than one Test project/batch/specimen type).
- Batch I flex is missing TSR4 (excluded: `test_end_reason` is "Test Stopped", not a detected break) — sample_ids I1-I5 map to TSR{1,2,3,5,6}.
- Batch H's 5 flex rows are `xlsx_only` (no raw TestRuns folder survived — see architectural decisions above); Batches K, L, M, N are `xlsx_only` too (no TestRuns/h5 handed off for those sessions at all, not just one project overwriting another) — every other row has full h5-derived curves.
- **Batch J / J_MB (2026-07-06 print, tested 07/06 and 07/08) is the first split-batch label.** Both are the same physical print batch; `J` specimens were tested as-printed, `J_MB` specimens were media blasted post-print before testing. This deviates from the single-letter `batch_label` convention (see architectural decisions above) — deliberately, per user instruction, to keep the surface-treatment distinction visible without adding a new schema field. If more media-blast-vs-not comparisons get added, consider promoting this to a real `surface_treatment` field instead of continuing to overload `batch_label`.
- **Batch M tensile (D638) is the first batch mixing two ASTM specimen types.** 5 Type I dogbones (`tensile_m.xlsx`, sample_ids M1-M5) plus 12 Type IV narrow-section specimens from the same print (`tensile_m_t4.xlsx`, M6-M17, `astm.type = "Type IV"`) — see `26_2026_07_21_tensile_m.py` / `27_2026_07_21_tensile_m_type4.py`, which share `batch_label="M"` and continue sample numbering via `process_session`'s `seq_start`. Per user instruction the Type IV specimens get their own figure (`assets/D638_type_iv.png`) rather than sharing the cluster/batch-averages/detail figures with the rest of Batch M — `TYPE_LINESTYLES` in `scripts/plots/_lib.py` flags which ASTM types get this treatment, and `02_batch_averages.py`/`03_batch_clusters.py`/`04_batch_details.py` all exclude them accordingly (different gauge geometry, not comparable to Type I). Within that dedicated figure, each of the 12 specimens gets its own labeled curve (`render_type_iv` in `01_controls.py`) rather than one grouped legend entry — ordered by `specimen_index` (= xlsx sheet order = physical test order) and labeled per `TYPE_IV_LABELS = [1,2,3,4,5,6,8,9,10,11,13,14]`, a user-supplied numbering with intentional gaps at 7 and 12 (specimen numbers that exist in the lab's own record-keeping but aren't part of this xlsx export).
- **`NYLON12_WHITE_FL` is a new `material_class`** (FormLabs Nylon 12 White SLS control, tested 2026-07-23, no `batch_label`/`sample_id`, no Database FK) — a second FormLabs reference material alongside `PA12GF_FL`, unfilled/white nylon rather than glass-filled. Per user instruction it's excluded from the cluster/batch-averages figures and rendered on its own (`{standard}_nylon12white_control.png`, see `scripts/plots/_lib.py`'s `NYLON_CONTROLS`). **D638 (tensile) `tensile_nylon12white_fl.xlsx` is a raw load/extension export with no gauge-length scalar in the file** — unlike D790 there's no chord-formula fallback for tensile, so strain/stress can't be derived from geometry alone. User confirmed the test used a 25mm-starting-length extensometer, so `31_2026_07_23_tensile_nylon12white_fl.py` sets `gauge_length_mm: 25` explicitly and `build_row_from_xlsx` derives strain = extension/gauge_length, stress = load/area from that (see the `gauge_length_mm` session key, added for this case — `geometry.gauge_length_mm` on xlsx_only rows is null unless a session declares it). D790 (flex) rows derive normally since flexural strain/stress only need width/thickness. **The D638 curves are cut at their stress peak for plotting only** (`VERTICAL_BREAK_MATERIALS` in `scripts/plots/_lib.py`) — past peak, the raw trace continues as extension keeps increasing after the specimen separates while load reads ~0, and with few points sampled through the break itself this drew as a misleading diagonal line back to zero rather than the near-vertical drop a real break shows. Per user instruction, each figure applies this differently: `01_controls.py`'s raw-curve Nylon 12 White figure uses `vertical_break_at_peak` (cuts at peak, appends a point at zero stress/same strain so it plots as a vertical drop, matching the other SLS batches' visual convention); `02_batch_averages.py`'s mean ± SD figure now trims **every** specimen at its peak inside `group_average` (via `truncate_at_peak`) so no fracture branch — Nylon's included — reaches the averaging grid (this replaced the old per-Nylon special-case). Both `vertical_break_at_peak` and `truncate_at_peak` are applied by the calling code, not baked into `load_standard`, since the figures need different treatments. Either way this only affects what gets plotted — the underlying JSONL `curves.strain`/`curves.stress_pa` arrays are untouched (full raw trace still there for anyone querying the dataset directly). D790 Nylon 12 White isn't affected — its curves don't show this artifact.
## Running the extract
Each per-session script is independently runnable; output is per-specimen JSONL.
```bash
# All sessions:
for f in scripts/specimens/0*.py; do uv run "$f"; done
# Just one session (e.g. when re-extracting after a fix):
uv run scripts/specimens/01_2026_05_26.py
```
## Adding a new session — recipe
1. Drop the TestWorks session folder under `source/{YYYY_MM_DD}/` (or `source/{YYYY_MM_DD}/{label}/` for multiple sessions per day, as 2026_06_10 already does).
2. `git lfs add` the `.h5`, `.Traits`, `.xlsx` files via the repo's `.gitattributes` (already configured).
3. Add a new `scripts/specimens/{NN}_{slug}.py` (number it after the existing scripts). Use any of the existing scripts as a template — they're ~15 lines each. Declare:
- `session_folder`, `test_folder` (almost always `"TST1.Test"`), `xlsx_name`
- `astm` block (`standard` routes the output to `data/D638/` vs `data/D790/`)
- `batch_label` (single letter)
- `test_runs`: list of `(tsr_index, material_class, db_print_date | None)`. For SLS rows pick the source print job from `Agentic-SLS-Database/data/jobs.jsonl` by `print_date`. For non-SLS and SLS-without-Database-job, pass `None`.
- If the same session_folder holds more than one Test project (e.g. two batches printed the same day sharing a parent folder), give each batch its own script with a different `test_folder` (`TST1.Test`, `TST2.Test`, ...) — don't guess which TSRs belong to which batch from folder structure alone; cross-check a scalar like Modulus or PeakLoad between each project's `persistent.h5` and each candidate xlsx export.
- If a TestRuns folder is missing/overwritten and only an xlsx export survives, set `"xlsx_only": True` instead of `test_folder` — this is a fallback (see architectural decisions above), not something to reach for by default.
4. Run that one script → new files land in `data/{standard}/`.
5. Update the README's "Test sessions covered" table (and the "Current state" section here).
6. Regenerate the figures: `for f in scripts/plots/0*.py; do uv run "$f"; done` (runs `01_controls.py`, `02_batch_averages.py`, `03_batch_clusters.py`, `04_batch_details.py`). If it's a new batch letter, add it to `ORDERED_BATCHES` in `scripts/plots/_lib.py` first — `BATCH_COLORS` is sampled from the orange ramp by that list's order, so no manual color pick is needed.
## Backfilling batches E–I, J, J_MB
Batches E (D790 only), F, G, H, I, J, and J_MB all currently pass `db_print_date=None` because their print jobs aren't in `Agentic-SLS-Database/data/jobs.jsonl` yet. J and J_MB share the same 2026-07-06 print job, so both batches' scripts get the same `db_print_date` once it's backfilled. When one lands:
1. In the matching `scripts/specimens/{NN}_*.py`, change `(i, "SLS", None)` to `(i, "SLS", "<print_date>")` for that batch's `test_runs`.
2. Re-run that one script. Its JSONLs get FKs and `print_profile_snapshot` filled in. No schema change needed.
Note: Batch H's flex script (`17_2026_06_30_flex_h.py`) is `xlsx_only` — backfilling its FK doesn't change the fact that its curves/metrics are xlsx-derived only (see architectural decisions above).
## Scope note
Mirrors the `Agentic-SLS-Database` scope: ASTM-subset only. If the parent Database is later broadened to cover all SLS prints, the `MANIFEST` here doesn't need to change — only the specimens whose source print job is now in Database will get FKs filled in.