pingwyn.bin
Bin an object by combining datapoints.
- param obj:
The object to bin.
- type obj:
pingwyn.Curve or pingwyn.Grid or pingwyn.Image or pingwyn.Profile
- param bins:
The number of elements to bin together. If a single integer is provided, the data will be binned based on the object type and a strategy explained below. If bins is an iterable of integers, each integer corresponds to the number of bins to combine per axis. In this case, len(bins) == len(obj.shape) must hold.
If there are not enough datapoints to bin together (i.e. when obj.shape[i] % bins[i] != 0 for axis i), the remaining unbinnable datapoints are discarded. Note: this will overrule keep_dims=True in a way that the dimensions of the returned object might be close, but not equal, to the dimensions of the input object.
Binning strategies for single integers: - pingwyn.Curve: the curve datapoints (axis 1) will be binned. - pingwyn.Grid: the datapoints making up the individual curves (axis 2) will be binned. - pingwyn.Image: both axes will be binned equally. - pingwyn.Profile: multiple curves (axis 0) will be binned together.
- type bins:
int or tuple/list of ints
- param keep_dims:
If set to True, will ensure that the object shape does not change. If false, the no. of bins will determine the new shape of the returned object. Default: True.
- type keep_dims:
bool, optional
- param method:
Method of combining the datapoints. Can be “mean” or “median”. Default: “mean”.
- type method:
str, optional
- returns:
An object with the same type as obj, with datapoints binned together.
- rtype:
pingwyn.Curve or pingwyn.Grid or pingwyn.Image or pingwyn.Profile