-
Notifications
You must be signed in to change notification settings - Fork 491
Closed
Labels
Description
Passing non-quantity parameters to np.pad in constant mode results in behaviour different from passing dimensionless quantities:
In [1]: import numpy as np
...: import pint
...: ureg = pint.UnitRegistry()
In [2]: a = np.arange(5) * ureg.m
In [3]: np.pad(a, (2, 4), mode="constant", constant_values=4)
Out[3]: array([4, 4, 0, 1, 2, 3, 4, 4, 4, 4, 4]) <Unit('meter')>
In [4]: np.pad(a, (2, 4), mode="constant", constant_values=4 * ureg.dimensionless)
DimensionalityError: Cannot convert from 'dimensionless' (dimensionless) to 'meter' ([length])I'd expect [3] and [4] to be equivalent, but one of the checks in test_pad seems to expect the current behaviour so I'm not sure if this is a misconception on my part.