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 probe type to the Beam model #647

Merged
merged 23 commits into from
Aug 4, 2023

Conversation

dagewa
Copy link
Member

@dagewa dagewa commented Jul 24, 2023

Fixes #575.

This PR adds a Probe enum to Beam. In future this could be used to alter behaviour of algorithms, such as the QE and parallax corrections. At the moment this just adds the additional datum and allows serialisation etc. Old experiment files where this is not set are interpreted as having Probe.xray. Some electron diffraction format classes are updated here to record Probe.electron.

A DIALS PR will be required following this. Currently the only DIALS tests that fail are those for dials.show.

dagewa added 13 commits July 21, 2023 15:36
So now, can do

from dxtbx.model.beam import Probe
Note the value is uninitialized!
>>> from dxtbx.model.beam import Beam
>>> b=Beam()
>>> b.get_probe()
dxtbx_model_ext.Probe.xray
Now this works:

>>> from dxtbx.model.beam import Beam
>>> b=Beam()
>>> b.get_probe()
dxtbx_model_ext.Probe.xray
>>> from dxtbx.model.beam import Probe
>>> b.set_probe(Probe.neutron)
>>> b.get_probe()
dxtbx_model_ext.Probe.neutron
returned for each of the defined probe values
@dagewa dagewa linked an issue Jul 24, 2023 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Jul 24, 2023

Codecov Report

Merging #647 (fb30aa9) into main (1625cfa) will decrease coverage by 0.30%.
Report is 9 commits behind head on main.
The diff coverage is 29.12%.

❗ Current head fb30aa9 differs from pull request most recent head 827e494. Consider uploading reports for the commit 827e494 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #647      +/-   ##
==========================================
- Coverage   39.39%   39.09%   -0.30%     
==========================================
  Files         178      179       +1     
  Lines       15519    15819     +300     
  Branches     2996     3057      +61     
==========================================
+ Hits         6113     6185      +72     
- Misses       8827     9052     +225     
- Partials      579      582       +3     

Copy link
Contributor

@toastisme toastisme left a comment

Choose a reason for hiding this comment

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

This all looks fine to me, and should be quite useful.

@dagewa dagewa requested a review from toastisme August 2, 2023 16:44
@dagewa
Copy link
Member Author

dagewa commented Aug 2, 2023

@toastisme I've made the changes to hopefully get Probe working with the PolychromaticBeam. Might have missed something, so if you have anything else you can check on your fork that would be good. One thing I wasn't sure of were the type hints for a value like Probe.xray, so I just left that blank.

…anged Probe in .expt files to be human readable.
…ructor at the Python level. Fixed typo in Beam.from_dict.
@toastisme
Copy link
Contributor

@toastisme I've made the changes to hopefully get Probe working with the PolychromaticBeam. Might have missed something, so if you have anything else you can check on your fork that would be good. One thing I wasn't sure of were the type hints for a value like Probe.xray, so I just left that blank.

Had a look and looks good. I realised Probe wasn't part of the phil params so have added it here, along with a suggestion to have the probe be the NeXus name in .expt files, rather than the enum int, to make it human readable.

Add probe to phil params and make probe in .expt human readable
…type

575 beam model should state probe type
src/dxtbx/model/beam.h Outdated Show resolved Hide resolved
src/dxtbx/model/beam.h Outdated Show resolved Hide resolved
dagewa and others added 2 commits August 4, 2023 14:27
Co-authored-by: Nicholas Devenish <[email protected]>
Co-authored-by: Nicholas Devenish <[email protected]>
@ndevenish ndevenish merged commit 4783b2c into cctbx:main Aug 4, 2023
11 checks passed
@ndevenish ndevenish deleted the 575-beam-model-should-state-probe-type branch August 4, 2023 15:48
toastisme added a commit to toastisme/dxtbx that referenced this pull request Jul 18, 2024
At the moment this just adds the additional datum and allows
serialisation etc. Old experiment files where this is not set are
interpreted as having Probe.xray. Some electron diffraction format
classes are updated here to record Probe.electron.

Co-authored-by: davidmcdonagh <[email protected]>
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.

Beam model should state probe type
4 participants