We commonly use numpy.nextafter when constructing bin edges or slicing arrays by label. It would in some cases be more convenient to just use a function directly on scipp variables.
One thing to consider is, do we have to require a unit for the second argument? That is, do we need
sc.nextafter(x, sc.scalar(np.inf, unit='m'))
for and x with x.unit == 'm'. Or can we allow
sc.nextafter(x, np.inf)
I think that requiring a unit in all cases makes this so unergonomic that it is not worth implementing. We could make infinity special and allow omitting a unit iff the second argument is +/- infinity. I'm sure a mathematical argument can be made for why that is fine if we need to go there :-)
We commonly use numpy.nextafter when constructing bin edges or slicing arrays by label. It would in some cases be more convenient to just use a function directly on scipp variables.
One thing to consider is, do we have to require a unit for the second argument? That is, do we need
for and
x
withx.unit == 'm'
. Or can we allowI think that requiring a unit in all cases makes this so unergonomic that it is not worth implementing. We could make infinity special and allow omitting a unit iff the second argument is +/- infinity. I'm sure a mathematical argument can be made for why that is fine if we need to go there :-)