Skip to content

feat(v0.4.0): GP-guided autonomous DFXM Scout-and-Zoom, ask-tell agent API, operando sync & Red-Team hardening - #19

Merged
jameslehoux merged 3 commits into
mainfrom
feat/v0.4-autonomous-dfxm-and-operando
Nov 18, 2026
Merged

jameslehoux merged 3 commits into
mainfrom
feat/v0.4-autonomous-dfxm-and-operando

Conversation

@jameslehoux

@jameslehoux jameslehoux commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implements BraggTrack v0.4.0, adding GP-guided autonomous Dark-Field X-ray Microscopy ("Scout-and-Zoom") target selection, a Bluesky-Adaptive style tell / ask / report causal streaming agent, operando electrochemistry synchronization, batched DINOv2 ViT inference, darfix / ESRF BLISS auto-calibration, and comprehensive Red-Team crystallographic & live-streaming hardening:

  1. Gaussian Process Trajectory Forecasting, Bayesian Acquisition & tell / ask / report Agent (braggtrack.autonomous, braggtrack-watch)

    • Heteroscedastic Universal Kriging Forecaster (gp.py): Combines inverse-variance-weighted linear trend estimation with a Matérn(nu=1.5) Gaussian Process (scikit-learn, zero extra dependencies) weighted by analytical Poisson centroid variances (alpha = sigma_pos**2) to forecast smooth (mu, chi, d) setpoints across uniform or irregular elapsed_s timestamps and size 1-sigma rocking windows from posterior uncertainty.
    • Bayesian Acquisition (ucb, ei, max_variance): Ranks candidate grains via Upper Confidence Bound, Expected Improvement, or pure Kriging variance exploration, with optional multi-fidelity GP conditioning on measured high-resolution DFXM zoom outcomes (tell_zoom_outcome).
    • Bluesky-Adaptive Agent Protocol (streaming.py): Exposes decoupled tell(), ask(), tell_zoom_outcome(), and report() methods alongside $O(1)$ bounded sliding-window incremental tracking (sliding_window_scans=24) for constant per-scan latency across 1,000+ scan operando campaigns.
    • Beamline Guardrails & Replay Benchmark (trigger.py, replay.py, watch_autonomous.py): Supports --mode {replay, shadow, watch, active}, --acquisition {ucb, ei, max_variance}, diffractometer motor soft-limit clamping, electrochemical voltage windows, per-lineage X-ray dose caps, synchrotron beam-dump suppression, and closed-loop baseline evaluation (mean_setpoint_mae, pre-split recall/precision/lead time vs brightest_intensity, strain_only, random).
  2. Ancestor-Referenced Kinematics & Analytical Strain Uncertainties (segmentation/features.py, tracking/kinematics.py)

    • Propagates Poisson photon-counting (detector_gain-aware) + 1/12 voxel quantization centroid errors into strain_err, ancestor-referenced lineage_strain across 1 -> 2+ splits, wall-clock strain_rate_per_s, and Hungarian runner-up assignment_margin.
  3. Operando Electrochemistry Synchronization (io/operando_log.py, viz/operando.py)

    • Native .csv/.tsv and Biologic .mpt parsing with Savitzky–Golay regularized $\mathrm{d}Q/\mathrm{d}V$, electro-strain susceptibility $\partial\varepsilon/\partial V$, and 3-panel publication plots (plot_operando_strain_and_events).
  4. Batched DINOv2 ViT Inference & Zero-Config darfix / ESRF BLISS Compatibility (semantic/dino.py, io/nexus.py)

    • embed_batch, extract_patch_features_batch, aspect-ratio-preserving square letterbox MIP padding, and automatic NXdata @signal/@axes + BLISS instrument/positioners calibration.
  5. Red-Team Crystallographic, Streaming & Security Hardening (test_redteam_hardening.py)

    • Step-normalized physical-unit invariance across PositionShapeCost, resolve_track_gaps, and resolve_splits_and_merges, plus mechanical_split vs phase_split (H2 -> H3) disambiguation.
    • Outer-perimeter background pedestal subtraction, standardized rocking-curve excess kurtosis (kurtosis_{mu,chi,d}), boundary truncation flags (touches_rocking_border), float32 segmentation, and sub-voxel plateau h_maxima_seeds.
    • HDF5 swmr=True readers, file quiescence checks, partial-write resilience, strict --config key validation, and CSP + HTML escaping in generate_html_report.
  6. Ecosystem Positioning & Literature (docs/positioning.md, paper.md, paper.bib, .github/workflows/release.yml)

    • Positions BraggTrack alongside darfix, ImageD11, HEXRD, BraggNN, TrackMate 7, LapTrack, gpCAM (@Noack2021), Bluesky-Adaptive (@Maffettone2023), ANDiE (@McDannald2022), Kalinin (@Kalinin2021), and the Facility Autonomy Levels (FAL) taxonomy (@LeHouxFAL2026, @Lu2025).

Verification

  • ruff check & ruff format --check across braggtrack/, tests/, scripts/ (0 issues)
  • pytest tests/ (250 passed)
  • python scripts/ci_report.py (overall=PASS across all 9 acceptance gates)
  • python scripts/pre_pr_check.py (pre_pr_check=PASS)
  • jupyter nbconvert --to notebook --execute notebooks/braggtrack_demo.ipynb (clean execution)

@jameslehoux jameslehoux changed the title feat: BraggTrack v0.4.0 — Autonomous DFXM Scout-and-Zoom, Operando Sync, Uncertainty & Batched DINOv2 feat!: BraggTrack v0.4.0 — FAL Level 3 autonomous DFXM scout-and-zoom, operando sync & red-team hardening Nov 18, 2026
@jameslehoux jameslehoux changed the title feat!: BraggTrack v0.4.0 — FAL Level 3 autonomous DFXM scout-and-zoom, operando sync & red-team hardening feat(v0.4.0): GP-guided autonomous DFXM Scout-and-Zoom, ask-tell agent API, operando sync & Red-Team hardening Nov 18, 2026
@jameslehoux
jameslehoux merged commit 86fe55d into main Nov 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant