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

If crystal frame, use U for each crystal #1868

Merged
merged 4 commits into from
Sep 2, 2021

Conversation

graeme-winter
Copy link
Contributor

Weird side effect of this is you never map the unindexed reflections. Need to
iterate through and assign unindexed reflections a U matrix for mapping or
similar.

WIP for #1829

Weird side effect of this is you never map the unindexed reflections. Need to
iterate through and assign unindexed reflections a U matrix for mapping or
similar.

WIP for #1829
Comment on lines 1242 to 1245
if "id" in self:
sel_expt = self["id"] == i
else:
sel_expt = self["imageset_id"] == i
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you ran the indexing tests after making this change? I'm pretty sure this will result in some indexing failures as it explicitly relies on the existing behaviour - i.e. use the imageset_ids which are distinct, rather than the ids which will have been reset to -1 at the beginning of indexing to indicate "unindexed". (Yes, I know #1029 #1104.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course: this is precisely why I flagged this very early as a draft PR as I thought this will be über destructive - though that to me indicates that we have a different issue... but point well made.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unsurprisingly this breaks many things

Results (264.31s):
    1022 passed
       4 failed
         - tests/algorithms/indexing/test_index.py:753 test_index_known_orientation
         - tests/algorithms/indexing/test_assign_indices.py:247 test_local_multiple_rotations
         - tests/command_line/test_export_best.py:4 test_export_best
         - tests/command_line/test_search_beam_position.py:170 test_search_small_molecule
     157 skipped

Comment on lines 1242 to 1245
if "id" in self:
sel_expt = self["id"] == i
else:
sel_expt = self["imageset_id"] == i
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps the following would solve your problem in a less destructive way?

Suggested change
if "id" in self:
sel_expt = self["id"] == i
else:
sel_expt = self["imageset_id"] == i
if not crystal_frame and "imageset_id" in self:
sel_expt = self["imageset_id"] == i
else:
sel_expt = self["id"] == i

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Am doing a little bit of hunting around - I have a suspicion that there are better ways to fix this problem, as there are other derived questions from this (like: is this part of the reason why re-running indexing on multi-lattice data does not re-index all lattiecs)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BTW I recognise that this would fix the behaviour but I worry that it is not fixing the underlying problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change also broke indexing with > 1 lattice...

@graeme-winter
Copy link
Contributor Author

Looking at the code @rjgildea if there are multiple experiments with the same imageset_id then the points will be mapped multiple times... this is probably not what we want? I mention for your opinion, perhaps I should raise a new issue?

As suggested by @rjgildea but with added comments to explain to me-in-two-years
@graeme-winter graeme-winter marked this pull request as ready for review September 1, 2021 13:59
@codecov
Copy link

codecov bot commented Sep 1, 2021

Codecov Report

Merging #1868 (fdf754a) into main (5ea13ea) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head fdf754a differs from pull request most recent head 6b6869e. Consider uploading reports for the commit 6b6869e to get more accurate results

@@           Coverage Diff           @@
##             main    #1868   +/-   ##
=======================================
  Coverage   67.15%   67.15%           
=======================================
  Files         617      617           
  Lines       69532    69532           
  Branches     9672     9672           
=======================================
+ Hits        46695    46697    +2     
+ Misses      20894    20892    -2     
  Partials     1943     1943           

@graeme-winter graeme-winter merged commit 9aede7c into main Sep 2, 2021
@graeme-winter graeme-winter deleted the multi-lattice-viewer-fixes branch September 2, 2021 12:45
ndevenish added a commit that referenced this pull request Sep 21, 2021
If crystal_frame: iterate through experiments not image sets, performing the mapping for each unique experiment to put data into crystal frame. By definition then does not show _unindexed_ reflections as these have no crystal frame. 

Fixes #1829

Co-authored-by: Nicholas Devenish <ndevenish@gmail.com>
Co-authored-by: Richard Gildea <rjgildea@users.noreply.github.com>
DiamondLightSource-build-server added a commit that referenced this pull request Sep 21, 2021
Bugfixes
--------

- ``dials.reciprocal_lattice_viewer``: In cases with multiple lattices, "Crystal Frame" now aligns all crystal frames, rather than just the first. Unindexed reflections are no longer shown in this mode. (#1868)
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.

None yet

3 participants