Skip to content

Conversation

@allevitan
Copy link
Collaborator

There was an issue in the calculation of the scaling for the scaled mean diffraction pattern, which would cause a crash whenever dataset.inspect() was called on a dataset with fully colinear scan points. A special case of this which happens a lot is when there is no scanning, or all the scan points are equal in the dataset.

I updated the functions to revert to just displaying the mean pattern in this case, and raising a warning. I also updated the docstrings. I did not add any tests because coverage for the dataset classes is quite sparse and feels like a separate project.

To test this specifically, one can run a modified version of inspect_dataset.py from the examples:

import cdtools
from matplotlib import pyplot as plt

# First, we load an example dataset from a .cxi file
filename = 'example_data/AuBalls_700ms_30nmStep_3_6SS_filter.cxi'
dataset = cdtools.datasets.Ptycho2DDataset.from_cxi(filename)

dataset.translations[:] = 0

# And we take a look at the data
dataset.inspect()
plt.show()

Copy link
Collaborator

@yoshikisd yoshikisd left a comment

Choose a reason for hiding this comment

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

I've tried the example you provided on my machine and it seems to work as intended.

These changes look good to me.

@allevitan allevitan merged commit b74aa82 into master May 20, 2025
6 checks passed
@allevitan allevitan deleted the bugfix/notranslationdataset branch May 20, 2025 09:52
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.

3 participants