-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Labels
enhancementNew feature or requestNew feature or requestgood first issuepythonPull requests that update Python codePull requests that update Python code
Description
If no explicit bin-edges are passed to the .bin method scipp tries to determine suitable bin-edges based on the values of the coordinate.
If the coordinate has nan values this fails
import scipp as sc
data = sc.data.table_xyz(10)
data.coords['x'][0] = sc.scalar(float('nan'), unit=data.coords['x'].unit)
data.bin(x=4, y=2)with error BinEdgeError: Bin edges in dim x must be sorted.
The error here is reasonable, we can't construct a binning without dropping the events associated with the nan coord values, and we don't want to do that automatically.
But the error message is not very clear. If we catch this issue before the faulty bin-edges are passed to _cpp.bin we could provide the user with a better error message like: ValueError: coordinate contains nan, could not determine bin edges automatically.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issuepythonPull requests that update Python codePull requests that update Python code
Type
Projects
Status
Done