ess.imaging.tools.analysis.resample#
- ess.imaging.tools.analysis.resample(image, sizes, method='sum')[source]#
Resample an image by folding it into blocks of specified sizes and applying a reduction method. The sizes should be provided as a dictionary where the keys are dimension names and the values are the sizes of the blocks. The shape of the input image must be divisible by the block sizes.
- Parameters:
sizes (
dict[str,int]) – A dictionary specifying the block sizes for each dimension. For example,{'x': 4, 'y': 4}will create blocks of size 4x4.method (
str|Callable, default:'sum') – The reduction method to apply to the blocks. This can be a string referring to any valid Scipp reduction method, such as ‘sum’, ‘mean’, ‘max’, etc. Alternatively, a custom reduction function can be provided. The function signature should accept ascipp.Variableorscipp.DataArrayas first argument and a set of dimensions to reduce over as second argument. The function should return ascipp.Variableorscipp.DataArray.
- Return type: