Follow-up to #3948. Re-binning a dim drops coords defined over that dim. hist applies all but the final edges by binning, so whether such a coord survives depends on the argument order.
Raises where the reverse order works — note that bin handles both orders:
import scipp as sc
da = sc.data.binned_x(nevent=1000, nbin=12)
da.coords['p'] = sc.midpoints(da.coords['x'])
da.hist(p=3, x=4) # works
da.hist(x=4, p=3) # KeyError: Expected 'p' in <scipp.Dict.keys {x}>
Same with a 1-D and a 2-D outer coord:
import scipp as sc
da = sc.data.table_xyz(1000).bin(x=5, y=4)
da.coords['p'] = sc.arange('x', 5, unit='s')
da.coords['r'] = sc.arange('x', 5, unit='K') + 5 * sc.arange('y', 4, unit='K')
da.hist(r=2, p=3, dim=()) # works
da.hist(p=3, r=2, dim=()) # DimensionError
A third symptom, reported by @jokasimr while reviewing #3949, is a large intermediate allocation. No ordering helps here, since none of p/z/r replaces an existing dim, so the input dims survive the binning step either way:
import scipp as sc
da = sc.data.table_xyz(1200).bin(x=40, y=30)
da.coords['p'] = sc.arange('x', 40, unit='s')
da.coords['r'] = sc.arange('x', 40, unit='K') + 40 * sc.arange('y', 30, unit='K')
da.hist(p=20, z=20, r=20, dim=da.dims) # 40 * 30 * 20 * 20 intermediate bins
The first two are marked as strict xfail in tests/binning_test.py.
Follow-up to #3948. Re-binning a dim drops coords defined over that dim.
histapplies all but the final edges by binning, so whether such a coord survives depends on the argument order.Raises where the reverse order works — note that
binhandles both orders:Same with a 1-D and a 2-D outer coord:
A third symptom, reported by @jokasimr while reviewing #3949, is a large intermediate allocation. No ordering helps here, since none of
p/z/rreplaces an existing dim, so the input dims survive the binning step either way:The first two are marked as strict xfail in
tests/binning_test.py.