Skip to content

Tomography testing - #55

Draft
tomkane-dls wants to merge 28 commits into
mainfrom
tomography-testing
Draft

tomkane-dls wants to merge 28 commits into
mainfrom
tomography-testing

Conversation

@tomkane-dls

@tomkane-dls tomkane-dls commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Frontend changes to form -> atlas

General

Spectroscopy renames (spectroscopy_plans.py, plans.py)

  • Arguments shortened: spectroscopy_detector → detector, sample_stage → stage, spectroscopy_diodes → diodes.
  • Unsupported scan types now raise ValueError.
  • sample_stage_baseline.yaml is renamed to spectroscopy_stage_baseline.yaml.

Tomography plan

  • tomography() now takes darks, then flats, then projections in a single plan. The old separate darks_flats() plan is gone.
  • before each set of images, the plan moves the sample on stage.x (H) and the two flip mirrors. The spectroscopy mirror is always flipped out. The tomography mirror is off for darks and on for flats and projections.
  • New metadata: image_key (dark, flat or projection), a shared tomography_group uuid, and darks_uid/flats_uid on the projections run.
  • Stage: now an XThetaStage instead of a plain Motor, so the scan runs over stage.theta. Keys in tomography_stage_baseline.yaml gain a theta. prefix to match the new stage.
  • LightSource: deprecated and ignored. demo_tomography still accepts it so its signature doesn't change for now.
  • Tidy-ups: the plan is split into helpers (_move_for, _collect_calibration, collect_projections, wind_back). MAKO* constants are renamed to ALVIUM*. Unsupported scan types now raise ValueError.

Tests

  • Updated for the renamed arguments.
  • New mock fixtures for the tomography detector, stage and both mirrors.
  • New test checking the darks → flats → projections order, the metadata links, and the moves before each run.
  • Detector mock now resets num_captured when a new file starts.

@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.25000% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.57%. Comparing base (eace3a3) to head (fcb148f).

Files with missing lines Patch % Lines
src/test_rig_bluesky/plans.py 28.57% 10 Missing ⚠️
src/test_rig_bluesky/tomography_plans.py 91.11% 4 Missing ⚠️
src/test_rig_bluesky/spectroscopy_plans.py 95.23% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main      #55       +/-   ##
===========================================
+ Coverage   50.70%   78.57%   +27.86%     
===========================================
  Files           5        5               
  Lines         213      252       +39     
===========================================
+ Hits          108      198       +90     
+ Misses        105       54       -51     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tomkane-dls
tomkane-dls changed the base branch from main to diodes November 4, 2026 14:35
@tomkane-dls
tomkane-dls changed the base branch from diodes to main November 9, 2026 13:47
@tomkane-dls
tomkane-dls changed the base branch from main to diodes November 10, 2026 15:09
@tomkane-dls
tomkane-dls changed the base branch from diodes to main November 19, 2026 13:39
Comment on lines +38 to +41
detector = inject("spectroscopy_detector")
diodes = inject("spectroscopy_diodes")
pandabox = inject("pandabox")
sample_stage = inject("spectroscopy_stage")
stage = inject("spectroscopy_stage")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure I agree with the re-name here. From my point of view, if the stage is called spectroscopy_stage everywhere else (i.e. Dodal and other plans files within this repo), it makes more sense for it to always be called spectroscopy_stage, rather than shortening it here. Same for the detector.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay yes I agree with you, I think they should all mirror the dodal names at this point. Do you agree with shortening them as the actual plan arguments?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think for the specific scans (i.e. spectroscopy or tomography), there's not really a reason to shorten them? As it's a very specific scan rather than a generic one (i.e. fly_scan), and it only works with that specific detector/device, I'm not sure it makes sense to shorten the arguments if the only think you can use is the spectroscopy_detector. I think really what I want to avoid is something like this:

def my_specifc_plan(
    detector: specific_detector,
    device: specific_stage,
): ...

Comment on lines +29 to +32
detector = inject("tomography_detector")
stage = inject("tomography_stage")
tomography_flip_mirror = inject("tomography_flip_mirror")
spectroscopy_flip_mirror = inject("spectroscopy_flip_mirror")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same for this one, I think it's just more confusing if we're truncating device names within each plan. Personally, I'd rather have the same name for the device all the time.

Comment on lines +58 to +59
ImageType.DARK: (SAMPLE_OUT_X, False),
ImageType.FLAT: (SAMPLE_OUT_X, True),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm a bit confused on the difference between true/false sample out. I would have though you need two positions - out and in - and then to specify between one of those two positions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah sorry if it is confusing, I will try and make it less so

ImageType is an enum which in that dictionary gives: a float value for the H position of tomography + boolean of whether the light is on. SAMPLE_OUT_X is a constant defined at the top.

So
ImageType.DARK = (sample out, light off)
ImageType.FLAT = (sample out, light on)
ImageType.PROJECTION = (sample in, light on)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah, this is just me not reading well enough! Thanks for the explanation, that makes much more sense now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think just to set an example we could use different numbers for SAMPLE_IN_X and SAMPLE_OUT_X or make SAMPLE_OUT_X a plan parameter even if it is not exposed on the UI.

@hyperrealist hyperrealist left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a couple of minor comments.

Comment on lines +58 to +59
ImageType.DARK: (SAMPLE_OUT_X, False),
ImageType.FLAT: (SAMPLE_OUT_X, True),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think just to set an example we could use different numbers for SAMPLE_IN_X and SAMPLE_OUT_X or make SAMPLE_OUT_X a plan parameter even if it is not exposed on the UI.

Comment on lines 285 to 297
@@ -201,35 +297,32 @@ def demo_tomography(
scan_type: ScanType,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

demo_tomography no longer accepts LightSource. Update PR description.

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.

3 participants