subsample_field

hcipy.field.subsample_field(field, subsampling, new_grid=None, statistic='mean')

Average the field over subsampling pixels in each dimension.

Note

The dimensions of the grid of field must be divisible by subsampling.

Parameters
fieldField

The field to subsample. The grid of this field must have the right dimensions to be able to be subsampled.

subsamplinginteger or scalar or ndarray

The subsampling factor. If this is a scalar, it will be rounded to the nearest integer. If this is an array, the subsampling factor will be different for each dimension.

new_gridGrid

If this grid is given, no new grid will be calculated and this grid will be used instead. This saves on calculation time if your new grid is already known beforehand.

statisticstring

The statistic to compute (default is ‘mean’). The following statistics are available: * ‘mean’: compute the mean of values for points within each superpixel. * ‘sum’: compute the sum of values for points within each superpixel. This is identical to a weighted histogram. * ‘min’: compute the minimum of values for points within each superpixel. * ‘max’: compute the maximum of values for point within each superpixel.

Returns
Field

The subsampled field.