Allow reflection_table.remove_on_experiment_identifiers
when len==0
#2298
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I encountered what I believe is a bug in
flex
behavior, and since it stops my jobs, I decided to suggest a fix. This PR is tiny, but it is my first one here, so please let me know if I'm missing anything.When filtering problematic dataset in
cctbx.xfel
, I encountered multiple instances of the following error:The dataset I'm processing has very few reflections, so the error most likely stems from the fact, that an empty
flex.reflection_table()
does not have keyid
. However, all methods utilized withinremove_on_experiment_identifiers()
can act on empty table. In my understanding, theassert "id" in self
statement is supposed to catch tables which have reflections, but the reflections have noid
.This PR suggests to add a conditional statement before the assertion, so that the presence of
id
keyword is required only if the table has any reflections to begin with. As a result, the method should act as a null-operation for a zero-length table. Alternatively, the method could justreturn self
iflen(self)==0
, but this would create two return points, which is generally undesirable.