Collapse arrays of identical values to scalar
Numpy operations are optimized when one of the operands is a scalar, representing a constant time series. Similarly, time-shift, interpolation, or timestamping operations are optimized for scalars. As an optimization, we should enforce that these constant time series remain as scalar as much as we can.
However, some operations turn them into arrays of identical values. E.g., a * b
, when a
is an array and b = 0
return an array full of zeros.
We should collapse this arrays of identical values at strategic points; maybe inside containers.ForEachObject
?