raise ValueError(
"x must be within [%f; %f], but was %f" % (self.x[0], self.x[-1], x))
i = numpy.searchsorted(self.x, x, side="left")
if self.x[i] != x:
i -= 1
return self.a * self.y[i] + self.b
def __repr__(self):
return "StepFunction(x=%r, y=%r)" % (self.x, self.y)
After Change
y : float|array-like, shape=(n_values,)
Values of step function at `x`.
x = numpy.atleast_1d(x)
if not numpy.isfinite(x).all():
raise ValueError("x must be finite")
if numpy.min(x) < self.x[0] or numpy.max(x) > self.x[-1]:
raise ValueError(