Skip to content

Complete general maths functionality for absorbers in i19 transmission/attenuation#2119

Merged
CoePaul merged 2 commits into
mainfrom
dodal2105
Jul 17, 2026
Merged

Complete general maths functionality for absorbers in i19 transmission/attenuation#2119
CoePaul merged 2 commits into
mainfrom
dodal2105

Conversation

@CoePaul

@CoePaul CoePaul commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Fixes #2105

General comment ( for reviewers' and others' benefit )

Note the basic maths part of the attenuation has been kept deliberately separated
from "business" logic decisions like
"how much of the wedge can we use?",
"where is a bubble?",
"which side of a bubble do we use - if the exact transmission match would have placed us on the bubble?"

because once those questions start to get wrapped into the simple geometry or absorption models
( and these maths functions, each have one simple, clear to understand, job )
then all the complexity of sytem behaviour gets dragged into this maths functionality
and IMHO that would require unnecessary layers of analysis for every new maintenance developer to
comprehend / or for every old developer to remember.

Instructions to reviewer on how to test:

  1. Confirm unit tests all pass

Checks for reviewer

  • Would the PR title make sense to a scientist on a set of release notes
  • Check the calcution code and comments within make sense to someone unfamiliar with attenuation
  • Have the connection tests for the relevant beamline(s) been run via dodal connect ${BEAMLINE}

@CoePaul
CoePaul requested a review from a team as a code owner July 14, 2026 14:41
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.15%. Comparing base (0e7c63f) to head (b0dda6a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2119   +/-   ##
=======================================
  Coverage   99.15%   99.15%           
=======================================
  Files         352      353    +1     
  Lines       13725    13793   +68     
=======================================
+ Hits        13609    13677   +68     
  Misses        116      116           

☔ 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.

@CoePaul
CoePaul force-pushed the dodal2105 branch 2 times, most recently from 08af369 to 9344549 Compare July 15, 2026 15:54
CoePaul added 2 commits July 16, 2026 13:39
* Add missing elements / minor tweaks in pre-existing conversion tests
  -- including new straight line function ( used in wedge absorber geometry )
     which delegates to numpy polynomial (since straight line is a first order polynomial)

* Add foil geometry which handily converts from a set of supported
  thickness units (likely to be natural in the specifications of a real
  flat foil absorber mm, cm or microns ) to absorption friend cm

* Add wedge geometry which not only model the shape, including tip location offset
  but also handily converts between the natural mm for lateral motor poosition
  to thickness in cm
  -- features conversion functions to get
     wedge thickness in cm in x-ray beam for given motor position in mm
     required motor position in mm to achieve requested thickness

* N.B. these geometry models to not restrict range of motor motion,
  but do veto negative thickness
  motor range restrictions have to be imposed on top of the geometry model
  as it is a beamline scientist "operational policy" type decision about which
  parts of the wedge to accept use of - and which to reject
  ( rejection of certain positions can be for shape limitations or bubbles etc )

* Add unit tests for both geometry types
@CoePaul CoePaul self-assigned this Jul 16, 2026

@noemifrisina noemifrisina left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm
Please change the tile of the PR to something more descriptive before merging

@CoePaul CoePaul changed the title Dodal2105 Complete general maths functionality for absorbers in i19 transmission/attenuation Jul 17, 2026
@CoePaul
CoePaul merged commit db980cb into main Jul 17, 2026
11 checks passed
@CoePaul
CoePaul deleted the dodal2105 branch July 17, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add attenuation calculator

2 participants