Exceptions with strided coords in `bin`
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 146
- Forks
- 23
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 7
Description
Similar to #3255, scipp.bin still raises DimensionError: View over subspan can only be created for contiguous range of data. in some cases. Minimal example:
import scipp as sc
def make_vec_components(scale: sc.Variable) -> dict[str, sc.Variable]:
vec = scale * sc.vector(value=[1, 2, 3], unit='m')
return {'x': vec.fields.x, 'y': vec.fields.y, 'z': vec.fields.z}
scale = sc.linspace('point', 0.0, 1.0, num=10)
da = sc.DataArray(sc.ones_like(scale), coords={'scale': scale})
da = da.transform_coords(('x', 'y', 'z'), graph={('x', 'y', 'z'): make_vec_components})
da.hist(x=2) # ok
da.bin(x=2) # exception
da.hist(x=2, y=2) # exception since using `bin` internally
Originally reported in scipp/scippneutron#603.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the minimal Python example in the issue and compare the successful hist(x=2) call with bin(x=2) and hist(x=2, y=2). Trace the bin path involved in handling transformed, strided coordinates; done means bin no longer raises DimensionError and the two-dimensional hist case also succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100