Skip to content

Bad bin indices when rebinning outside of data range #3701

@jl-wynen

Description

@jl-wynen
events = sc.DataArray(
    sc.ones(sizes={'e': 10}),
    coords={'x': sc.linspace('e', 0, 1, 10)},
)
binned = events.bin(x=2)
rebinned = binned.bin(x=sc.linspace('x', 0, 2, 10))  # extends past data range
rebinned.bins.constituents 

potential output:

{'begin': <scipp.Variable> (x: 9)      int64        <no unit>  [0, 140028973768504, ..., 0, 140029301521992],
 'end': <scipp.Variable> (x: 9)      int64        <no unit>  [0, 140028970623760, ..., 140721491614320, 93999318766008],
 'dim': 'e',
 'data': <scipp.DataArray>
 Dimensions: Sizes[e:0, ]
 Coordinates:
 * x                         float64  [dimensionless]  (e)  []
 Data:
                             float64  [dimensionless]  (e)  []
 }

(Most) bin indices are wrong. It looks like they are uninitialised.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions