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

dials.scale: determine_Imids infinite loop #1622

Closed
rjgildea opened this issue Mar 5, 2021 · 2 comments · Fixed by #1623
Closed

dials.scale: determine_Imids infinite loop #1622

rjgildea opened this issue Mar 5, 2021 · 2 comments · Fixed by #1623
Assignees
Labels
dials.scale Affects dials.scale

Comments

@rjgildea
Copy link
Contributor

rjgildea commented Mar 5, 2021

Under some circumstances it appears that the _determine_Imids() method in dials.scale can enter an infinite loop, eventually consuming all available memory before being killed:

def _determine_Imids(self, raw_intensities):
if not self.Imids:
avg = flex.mean(raw_intensities)
Imid = flex.max(raw_intensities) / 10.0
Imid_list = [0, 1, avg, Imid]
while Imid > avg:
Imid /= 10.0
Imid_list.append(Imid)
self.Imids = Imid_list

This has been observed in autoprocessing at DLS.

@rjgildea rjgildea added the dials.scale Affects dials.scale label Mar 5, 2021
@rjgildea
Copy link
Contributor Author

rjgildea commented Mar 5, 2021

Logging the content of Imid_list before it enters the while loop gives:
[0, 1, -0.08802942570001496, 4230.601644563469]
I.e. avg is less than zero, so no matter how many times we divide Imid by 10, it will always be greater than avg.

@rjgildea
Copy link
Contributor Author

rjgildea commented Mar 5, 2021

Note that this function is duplicated further down in the same file (for MultiDatasetIntensityCombiner) so any bug fix should probably be applied here too:

def _determine_Imids(self, raw_intensities):
if not self.Imids:
avg = flex.mean(raw_intensities)
Imid = flex.max(raw_intensities) / 10.0
Imid_list = [0, 1, avg, Imid]
while Imid > avg:
Imid /= 10.0
Imid_list.append(Imid)
self.Imids = Imid_list

DiamondLightSource-build-server added a commit that referenced this issue Mar 5, 2021
Bugfixes
--------

- ``dials.import``: Selecting a subset of images with ``image_range=`` now works on stills (#1592)
- `dials.search_beam_centre`: Dramatically improved execution time for large data sets (#1612)
- ``dials.reindex``: Write ``.refl`` file output in the default
  "MessagePack" format for better compatibility with downstream programs (#1616)
- ``dials.scale``: Fix rare memory crash from infinite loop, that could
  occur with very bad quality datasets (#1622)

Improved Documentation
----------------------

- ``dials.refine``: More informative error message when reflections have weights of zero (#1584)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dials.scale Affects dials.scale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants