'One dimensional Trapezoid model function'

@staticmethod
def evaluate(x, amplitude, x_0, width, slope):

    x2 = (x_0 - (width / 2.0))
    x3 = (x_0 + (width / 2.0))
    x1 = (x2 - (amplitude / slope))
    x4 = (x3 + (amplitude / slope))
    range_a = np.logical_and((x >= x1), (x < x2))
    range_b = np.logical_and((x >= x2), (x < x3))
    range_c = np.logical_and((x >= x3), (x < x4))
    val_a = (slope * (x - x1))
    val_b = amplitude
    val_c = (slope * (x4 - x))
    result = np.select([range_a, range_b, range_c], [val_a, val_b, val_c])
    if isinstance(amplitude, Quantity):
        return Quantity(result, unit=amplitude.unit, copy=False)
    else:
        return result
