-
Notifications
You must be signed in to change notification settings - Fork 45
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
dials.index: do not write out reflections for removed experiments #2653
base: main
Are you sure you want to change the base?
dials.index: do not write out reflections for removed experiments #2653
Conversation
…imilar to an existing model, any reflections associated with that experiment id should be reset to unindexed. Reuse existing code for removing reflections with a certain id by refactoring that into its own function.
try: | ||
# Unset ids for the last experiment that is now deleted | ||
self._remove_id_from_reflections(len(experiments)) | ||
except AttributeError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the scenario in which the above call would raise an AttributeError
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wondered if there is a circumstance in which self.refined_reflections
does not exist because it's not actually defined until later. However I think the condition in this block is only true if there are already two crystals, in which case self.refined_reflections
must have been created during the handling of the first one.
Maybe it would be better if self.refined_reflections
was always created at the start of the index
function, even as an empty reflection table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case i think adding in the except AttributeError
is misleading, and we should either define self.refined_reflections at the start or add a comment to explain that this is only called once self.refined_reflections
exists.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2653 +/- ##
=======================================
Coverage 78.31% 78.31%
=======================================
Files 613 613
Lines 75504 75507 +3
Branches 10792 10792
=======================================
+ Hits 59128 59131 +3
Misses 14190 14190
Partials 2186 2186 |
@@ -613,6 +613,11 @@ def index(self): | |||
|
|||
if self._check_have_similar_crystal_models(experiments): | |||
have_similar_crystal_models = True | |||
try: | |||
# Unset ids for the last experiment that is now deleted | |||
self._remove_id_from_reflections(len(experiments)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this may be overlooking the case of shared crystal models. A possibility is that you have four experiments and two crystals (e.g. multi-sweep indexing with two lattices). In that case you need to match experiments that share the crystal to be removed, which is what is done in the other case of _remove_id_from_reflections
below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I think the additional shared crystal matching could be incorporated into the function so there's one place that does the removal properly. However, this is an area where I've run into trouble before (#2609). Maybe there are use-cases where we don't want to throw out all experiments if the crystal model is bad for just one of them. This might need more thought...
self.refined_reflections will exist if self._check_have_similar_crystal_models(experiments) is True
where we want to remove the last crystal. This function deletes the experiments with that crystal model, including any times it is shared, and also removes all associated reflections.
* Add dials.import test for multi-panel distance overrides.
New dials program to calculate correlation matrices between datasets as a stand-alone module extracting methods from xia2.multiplex. --------- Co-authored-by: James Beilsten-Edmands <30625594+jbeilstenedmands@users.noreply.github.com> Co-authored-by: Ben Williams <benjaminhwilliams@users.noreply.github.com>
…2658) * For a multi-axis goniometer we set the overall rotation axis by altering the orientation of the base axis. That way we are not changing the relationship between axes of the goniometer (so we still trust the header angles), we are just rotating the whole goniometer to fit the observations
* Fix dials.show for time of flight experiments.
* Trap d_min > d_max in masking Stop with an error if d_min > d_max as the user almost certainly did not mean this. If they are equal still no spots will be found but no error will be raised. Fixes #2663
…-rejected-experiment
I attempted to include the deletion of shared crystal models when removing a crystal and reflections that are too similar to a previously-found crystal. However, this now causes a test failure in
where it is seen that all experiments and reflections are removed. I have not been able to figure out why this is happening yet. |
Ah, I think I see the problem. I did not need to include the removal of the crystal models, because this is actually done in |
… places" This reverts commit c445b96.
…al_models - Also remove the associated reflections here
I think this addresses the comments and is ready for re-review |
If a new crystal model was found to be too similar to an existing model, but only after some refinement was done, then indexed reflections associated with that experiment made it into the output, and crashed dials.integrate.
This PR fixes that corner case by resetting such reflections to unindexed straight after the experiment was removed.