Skip to content

Add XRD count, dark and scan plans - #10

Merged
Anthony Sligar (sligara7) merged 1 commit into
NSLS2:pdf-profile-conversionfrom
sligara7:pdf-conv-05a-xrd-plans
Oct 23, 2026
Merged

Anthony Sligar (sligara7) merged 1 commit into
NSLS2:pdf-profile-conversionfrom
sligara7:pdf-conv-05a-xrd-plans

Conversation

@sligara7

Copy link
Copy Markdown

Ports hextools#110 (986fd54, still open there) as pdftools.xrd: xrd_count, xrd_dark, xrd_scan, ensure_cont_acq_exposure. Loaded into the profile session.

PDF changes from the hextools version:

  • Detectors are passed explicitly (xrd_count([pe1c], 0.2, ...)); PDF has four.
  • Shutter is the fast shutter fs (session's if not given): opened for count/scan, closed after (also on failure); darks close it first and never open it. No front-end/photon shutter check.
  • Internal trigger only (no PandA).
  • pdftools.utils.ensure_available ported from hextools.

Test mock: the Perkin Elmer mock moves to conftest.py (pe) and passes PostCount // NumFilter frames per circular-buffer trigger, as the IOC does; the old one-frame mock could not model more than one image per event.

Verified: mock tests (count/dark/scan documents and shapes, frame averaging, shutter commands, motor reset and shutter close on failure). Not run on the beamline.

pdftools.xrd ports hextools#110 (986fd54): xrd_count, xrd_dark and xrd_scan, with PDF's fast shutter fs instead of HEX's front-end/photon shutters, internal triggering only, and the detectors passed explicitly. pdftools.utils gains ensure_available. The Perkin Elmer test mock moves to conftest and now passes PostCount/NumFilter frames per circular-buffer trigger, as the IOC does; the one-frame-per-trigger mock could not model more than one image per event.

Assisted-by: copilot:claude-opus-5-5
Copilot AI balanced review requested due to automatic review settings October 23, 2026 22:43
@sligara7
Anthony Sligar (sligara7) merged commit bb4b79b into NSLS2:pdf-profile-conversion Oct 23, 2026
4 checks passed
@sligara7
Anthony Sligar (sligara7) deleted the pdf-conv-05a-xrd-plans branch October 23, 2026 22:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Continuous-acquisition startup handling and averaging timeouts can abort otherwise valid acquisitions.

2 open issues
What changed in this PR

Adds XRD count, dark, and motor-scan plans to PDF’s collection session, adapting the hextools plans for explicit detector selection and PDF’s fast shutter.

Changes:

  • Adds acquisition plans with frame averaging, repeated runs, and shutter cleanup.
  • Adds session-object lookup for the default shutter.
  • Introduces a shared Perkin Elmer mock and tests acquisition documents, shapes, and failure cleanup.
File Description
tests/​test_xrd.py Tests XRD acquisition and cleanup behavior.
tests/​conftest.py Adds a shared mock supporting multiple frames per trigger.
src/​pdftools/​xrd.py Implements XRD plans and continuous-acquisition exposure setup.
src/​pdftools/​utils/​__init__.py Adds typed session-object lookup helpers.
src/​pdftools/​profiles/​collection.py Exposes XRD plans in the collection session.

Review effort: Balanced

Comment thread src/pdftools/xrd.py
Comment on lines +53 to +54
# A busy record: waiting on it would block until acquisition stops.
yield from bps.abs_set(detector.driver.acquire, True, wait=False)
Comment thread src/pdftools/xrd.py
trigger_info = TriggerInfo(
trigger=DetectorTrigger.INTERNAL,
livetime=exposure_time,
exposures_per_collection=images_to_average,
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.

2 participants