-
Notifications
You must be signed in to change notification settings - Fork 2
Description
In the Dream powder reduction notebook, increasing the number of dspacing bins from 201 to 1001 uses all ram on 32GB laptop and crashes my notebook (and my terminal!).
It happens when we compute FocussedDataDspacingTwoTheta[SampleRun]: https://github.com/scipp/essdiffraction/blob/main/src/ess/powder/grouping.py#L109
I'm not entirely sure why it's using up so much RAM, but I suspect it's something to do with thet fact that the data is already binned in two_theta and then we bin in new two_theta bins...
I am actually not sure why we bin the data in 1024 hardcoded two_theta bins early on. There is a comment about needing to keep good resolution in two_theta, but why not assign two_theta as an event coord with bins_like. It shouldn't be so expensive as multiple other coords exist on the events.
Doing something like
da.bins.assign_coords(two_theta=sc.bins_like(da.bins.coords['dspacing'], b.coords['two_theta'])).hist(dim=da.dims, two_theta=200, dspacing=2000)where da is the CorrectedDetector[SampleRun] seems to work nicely with low RAM usage.