Repository navigation
Add Integrate2dResult.to_1dresults method - #2986
Conversation
| inside = numpy.where(numpy.logical_and(centers >= min(requested), | ||
| centers <= max(requested)))[0] | ||
| if requested_range is None: | ||
| return slice(None), axis_range |
There was a problem hiding this comment.
This changes rebin1d behavior: before the ranges in the 1D result were set to None if no range was requested. Now it uses the range from the input 2D result.
| if axis_range: | ||
| edges = numpy.linspace(*axis_range, len(bin_centers) + 1) | ||
| else: # assume close to regular binning | ||
| edges = _to_edges(bin_centers) |
There was a problem hiding this comment.
I left it as it was, thought this an be improved: it builds the edges to only pick 2.
Since edges will be stored in the results (#2984) this will no longer be an issue.
| self.radial, self._radial_range, radial_range, "radial" | ||
| ) | ||
|
|
||
| _check_regular_binning(self.azimuthal, "azimuth") |
There was a problem hiding this comment.
I kept a warning for irregular bins since it may affect the stored azimuth_range.
Likely to be lifted once bin edges are stored in the results (#2984)
| numpy.logical_and( | ||
| bin_centers >= min(requested_range), bin_centers <= max(requested_range) | ||
| ) | ||
| )[0] |
There was a problem hiding this comment.
I definitely hate the way this is formatted ... 5 lines instead of 2 and in addition, the symmetry of the upper and lower bound is broken, making the code less readable.
Add a helper method that converts an
Integrate2dResultinto NIntegrate1dResult, one for each azimuth bin.closes #2985
AI used: Claude used to write tests, review and final rework.