Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multiple x-ray sources #721

Merged
merged 8 commits into from
Sep 30, 2024
Merged

Add support for multiple x-ray sources #721

merged 8 commits into from
Sep 30, 2024

Conversation

psavery
Copy link
Collaborator

@psavery psavery commented Sep 30, 2024

This adds support for multiple x-ray sources, which may have different beam vectors, energies, and distances.

This also adds support for calibrating to diffraction patterns from multiple x-ray sources, including for powder, Laue, and also structureless.

This adds support for multiple x-ray sources to the instrument
and powder calibration. This will be the base for all multi-xrs
work going forward.

Most instruments will not be using multiple x-ray sources, so a
concept of an "active beam" is present so that software can assume
there is only one beam. Properties like `instr.beam_energy` return
the energy of the active beam.

Another method was also added to easily switch between beam sources
when needed. The `with_xray_source()` context manager can be used to
temporarily switch the active beam to another beam, if some calculations
that assume only one beam need to be performed with a different active
beam. This results in significantly cleaner code than if we had to
make all hexrd source code multi-beam aware.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
This matches what we are using for 2XRS, and we were told by Saransh
that this is more common. So we will make it the default.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
We need to find a good example to test this on.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
This appears to be working well...

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
The panels on the instrument get updated regularly during calibration.
We need to make sure that the panels in the tth_distortion are identical
and also get updated. This adds logic to do so.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
This calibrates two powder overlays from separate x-ray sources
simultaneously.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
@pep8speaks
Copy link

pep8speaks commented Sep 30, 2024

Hello @psavery! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2024-09-30 22:52:01 UTC

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
Copy link

codecov bot commented Sep 30, 2024

Codecov Report

Attention: Patch coverage is 55.83333% with 106 lines in your changes missing coverage. Please review.

Project coverage is 37.93%. Comparing base (6c1f0b3) to head (59dbe5b).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
hexrd/fitting/calibration/structureless.py 8.62% 53 Missing ⚠️
hexrd/instrument/hedm_instrument.py 75.60% 20 Missing ⚠️
hexrd/fitting/calibration/lmfit_param_handling.py 58.53% 17 Missing ⚠️
hexrd/fitting/calibration/laue.py 64.28% 10 Missing ⚠️
hexrd/fitting/calibration/powder.py 80.64% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #721      +/-   ##
==========================================
+ Coverage   37.26%   37.93%   +0.66%     
==========================================
  Files         134      134              
  Lines       21826    21961     +135     
==========================================
+ Hits         8134     8330     +196     
+ Misses      13692    13631      -61     
Flag Coverage Δ
37.93% <55.83%> (+0.66%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Member

@saransh13 saransh13 left a comment

Choose a reason for hiding this comment

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

Amazing job. LGTM!

@psavery psavery merged commit 0052c05 into master Sep 30, 2024
7 checks passed
@psavery psavery deleted the multi-xrs branch September 30, 2024 23:29
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