Example #1
0
    def linspace(cls, start, stop, num, endpoint=True):
        start = qty(start)
        stop = qty(stop)

        # Lets us the same base unit:
        stop = 1.0 * stop
        stop.units = start.units

        vals = np.linspace(start.magnitude, stop.magnitude, num=num,
                           endpoint=endpoint)
        return vals * start.units
Example #2
0
    def arange(cls, start, stop, step):
        #print start, stop, step
        start = qty(start)
        stop = qty(stop)
        step = qty(step)

        # Lets us the same base unit:
        stop = 1.0 * stop
        step = 1.0 * step
        stop.units = start.units
        step.units = start.units

        vals = np.arange(start.magnitude, stop.magnitude,
                         step=step.magnitude)
        return vals * start.units