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 sample to source distance to Beam #622

Merged
merged 33 commits into from
Aug 16, 2023

Conversation

toastisme
Copy link
Contributor

This adds sample_to_source_distance_in_m to Beam. This is required for time-of-flight experiments (to actually calculate the time-of-flight), but I thought it could potentially be useful in other experiments (e.g. an alternative beam divergence model), so have added it to Beam rather than a derived class.

This also adds some additional Beam similarity checks that were missing.

This branches off of #621.

@codecov
Copy link

codecov bot commented Apr 19, 2023

Codecov Report

Merging #622 (194746b) into main (3bc6e67) will decrease coverage by 0.99%.
Report is 6 commits behind head on main.
The diff coverage is 0.73%.

❗ Current head 194746b differs from pull request most recent head febaa0c. Consider uploading reports for the commit febaa0c to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #622      +/-   ##
==========================================
- Coverage   39.10%   38.12%   -0.99%     
==========================================
  Files         181      182       +1     
  Lines       15864    16270     +406     
  Branches     3066     3161      +95     
==========================================
- Hits         6204     6203       -1     
- Misses       9074     9481     +407     
  Partials      586      586              

@graeme-winter
Copy link
Collaborator

@toastisme not a criticism, but sample_to_source_distance_in_m feels awkward and does not "fit" i.e. I don't think we usually include the unit unless there is an alternative API (e.g. pixel / mm) and we also (again, I think) use mm everywhere not m

I make the comment without an implication of what is or is not correct

@rjgildea
Copy link

Would it make sense to start returning a pint.Quantity , at least on the Python side, in places such as this, then it is unambiguous in terms of unit, without needing the unit hardcoding in the method/property name?

@dagewa
Copy link
Member

dagewa commented Apr 19, 2023

I suggest changing name to sample_to_source_distance in this PR, expressed in mm for consistency with other lab distance quantities, then set up an issue to introduce pint.Quantity in all relevant areas separately.

@ndevenish
Copy link
Collaborator

Okay, fixing this merge conflict was significantly more involved than I had expected. The fact that the Polybeam PR was merged (and this branch was on top of an earlier, before-rename, version of that branch) and that the Probe PR also touches many of the same places as this, caused git to get extremely confused. (I think a "clever" approach I tried early also turned out to be "the most difficult path").

I think this is okay, but not confident enough to merge. @toastisme, could you look over and make sure this updated branch makes sense?

@toastisme
Copy link
Contributor Author

Okay, fixing this merge conflict was significantly more involved than I had expected. The fact that the Polybeam PR was merged (and this branch was on top of an earlier, before-rename, version of that branch) and that the Probe PR also touches many of the same places as this, caused git to get extremely confused. (I think a "clever" approach I tried early also turned out to be "the most difficult path").

I think this is okay, but not confident enough to merge. @toastisme, could you look over and make sure this updated branch makes sense?

Ah what a mess. Thanks for sorting this out. Looks good to me.

…ce in BeamFactory.make_polychromatic_beam. Made sample_to_source_distance have default value of zero for exposed Python constructors. Added sample_to_source_distance to beam tests.
@toastisme toastisme merged commit 831061f into cctbx:main Aug 16, 2023
11 checks passed
toastisme added a commit to toastisme/dxtbx that referenced this pull request Jul 18, 2024
* Add sample_to_source_distance to Beam

---------

Co-authored-by: DiamondLightSource-build-server <[email protected]>
Co-authored-by: Nicholas Devenish <[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.

6 participants