Skip to content

Adds conversion between material depth and attenuation#2049

Merged
Matt-Carre merged 58 commits into
mainfrom
2041_interconversion_depth_attenuation
May 21, 2026
Merged

Adds conversion between material depth and attenuation#2049
Matt-Carre merged 58 commits into
mainfrom
2041_interconversion_depth_attenuation

Conversation

@Matt-Carre
Copy link
Copy Markdown
Contributor

Fixes #2041
Adds tests and functions to convert between depth (measured in cm) and attenuation

@Matt-Carre Matt-Carre requested a review from a team as a code owner May 5, 2026 13:17
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.12%. Comparing base (edfa7d6) to head (25c243b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2049   +/-   ##
=======================================
  Coverage   99.12%   99.12%           
=======================================
  Files         336      336           
  Lines       13073    13082    +9     
=======================================
+ Hits        12959    12968    +9     
  Misses        114      114           

☔ View full report in Codecov by Sentry.
📢 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.

Comment thread src/dodal/common/general_maths/material_absorption_maths.py Outdated
Comment thread src/dodal/common/general_maths/material_absorption_maths.py Outdated
Comment thread src/dodal/common/general_maths/material_absorption_maths.py Outdated
Comment thread src/dodal/common/general_maths/material_absorption_maths.py Outdated
Comment thread tests/common/general_maths/test_material_absorption_maths.py
Comment thread tests/common/general_maths/test_material_absorption_maths.py
Comment thread tests/common/general_maths/test_material_absorption_maths.py Outdated
Comment thread tests/common/general_maths/test_material_absorption_maths.py Outdated
Comment thread tests/common/general_maths/test_material_absorption_maths.py
Copy link
Copy Markdown
Contributor

@oliwenmandiamond oliwenmandiamond left a comment

Choose a reason for hiding this comment

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

The standard for dodal for tests is "mirror the file structure of the src folder with the corresponding code files. Use the test_*.py naming convention for test files."

You have created many test files that don't mirror the src structure e.g test_photon_mass_attenutation.py, test_thickness_required_to_attenuate.py etc.

Can you please update your tests accordingly?

https://diamondlightsource.github.io/dodal/main/how-to/write-tests.html

@Matt-Carre
Copy link
Copy Markdown
Contributor Author

Currently, what I have works, but I could create a second model to check if the absorption coefficient is greater than 1.0e-14 with pydantic as well. Worth doing? Or do we want it to raise that specific value error?

Comment thread src/dodal/common/general_maths/material_absorption_maths.py
Comment thread src/dodal/common/general_maths/material_absorption_maths.py Outdated
Comment thread src/dodal/common/general_maths/material_absorption_maths.py Outdated
Comment thread tests/common/general_maths/test_material_absorption_maths.py Outdated
Comment thread tests/common/general_maths/test_material_absorption_maths.py Outdated
Comment thread tests/common/general_maths/test_material_absorption_maths.py Outdated
Copy link
Copy Markdown
Collaborator

@noemifrisina noemifrisina left a comment

Choose a reason for hiding this comment

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

lgtm, comment have been addressed, thanks

@noemifrisina noemifrisina dismissed stale reviews from CoePaul and oliwenmandiamond May 21, 2026 15:54

Comments addressed

@Matt-Carre Matt-Carre merged commit edd85a5 into main May 21, 2026
11 checks passed
@Matt-Carre Matt-Carre deleted the 2041_interconversion_depth_attenuation branch May 21, 2026 15:55
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.

Extend beamline-relevant arithmetic to provide interconversion between attenuation and material depth

4 participants