scipp.Bins
scipp.Bins¶
- class scipp.Bins(obj)¶
Proxy for access to bin contents and operations on bins of a variable.
This class is returned from the bins property of variables and should generally not be created directly.
- __init__(obj)¶
Methods
__init__
(obj)concat
([dim])Concatenate bins element-wise by concatenating bin contents along their internal bin dimension.
concatenate
(other, *[, out])Concatenate bins element-wise by concatenating bin contents along their internal bin dimension.
mean
()Mean of each bin.
size
()Number of events or elements in a bin.
sum
()Sum of each bin.
Attributes
Coords of the bins
Constituents of binned data, as supported by
sc.bins()
.Coords of the bins
Data of the bins
Masks of the bins
Coords and attrs of the bins
Unit of the bin elements
- property attrs: MutableMapping[str, scipp._scipp.core.Variable]¶
Coords of the bins
- concat(dim=None)¶
Concatenate bins element-wise by concatenating bin contents along their internal bin dimension.
This is a reduction operation similar to
scipp.sum()
but operates on binned data. Elements (bins) are concatenated along their internal dimension.- Parameters
dim (Optional[str]) – Reduction dimension.
- Returns
All bins along dim concatenated into a single bin.
- Return type
Union[scipp._scipp.core.Variable, scipp._scipp.core.DataArray]
- concatenate(other, *, out=None)¶
Concatenate bins element-wise by concatenating bin contents along their internal bin dimension.
The bins to concatenate are obtained element-wise from self and other.
- Parameters
other (Union[scipp._scipp.core.Variable, scipp._scipp.core.DataArray]) – Other input containing bins.
out (Optional[scipp._scipp.core.DataArray]) – Optional output buffer.
- Raises
If other is not binned data.
- Returns
The bins of the two inputs merged.
- Return type
Union[scipp._scipp.core.Variable, scipp._scipp.core.DataArray]
- property constituents: Dict[str, Union[str, scipp._scipp.core.Variable, scipp._scipp.core.DataArray]]¶
Constituents of binned data, as supported by
sc.bins()
.
- property coords: MutableMapping[str, scipp._scipp.core.Variable]¶
Coords of the bins
- property data: scipp._scipp.core.Variable¶
Data of the bins
- property masks: MutableMapping[str, scipp._scipp.core.Variable]¶
Masks of the bins
- mean()¶
Mean of each bin.
- Returns
The mean of each of the input bins.
- Seealso
scipp.mean()
for calculating the mean of non-bin data- Return type
Union[scipp._scipp.core.Variable, scipp._scipp.core.DataArray]
- property meta: MutableMapping[str, scipp._scipp.core.Variable]¶
Coords and attrs of the bins
- size()¶
Number of events or elements in a bin.
- Returns
The number of elements in each of the input bins.
- Return type
Union[scipp._scipp.core.Variable, scipp._scipp.core.DataArray]
- sum()¶
Sum of each bin.
- Returns
The sum of each of the input bins.
- Seealso
scipp.sum()
for summing non-bin data- Return type
Union[scipp._scipp.core.Variable, scipp._scipp.core.DataArray]
- property unit: scipp._scipp.core.Unit¶
Unit of the bin elements