"""
        Returns
        -------
        TimeSeries
           A copy of `self`.
        """
        return TimeSeries(self.times, self.values)

    def to_json(self):
        json_dict_ts = {
            "times": self._times.tolist(),
            "values": self._values.tolist()
        }
        return json_dict_ts

    @property
    def lazy(self):
        return lz.lazy(lambda x: x)(self)


if __name__ == '__main__':
    from lazy import lazy as lz
    dtest(TimeSeries, globals(), verbose=True)
else:
    import timeseries.lazy as lz

try:
    __version__ = pkg_resources.get_distribution(__name__).version
except:
    __version__ = 'unknown'
Example #2
0
            else: #
                self._check_length_helper(rhs)
                pairs = zip(self, rhs)
                return Vector(a - b for a, b in pairs)
        except TypeError:
            raise NotImplemented

    def __rsub__(self, other): # other + self delegates to __add__
        """
        """
        return -(self - other)

    def __mul__(self, rhs):
        """
        """
        try:
            if isinstance(rhs, numbers.Real):
                return Vector(a * rhs for a in self)
            else: #
                self._check_length_helper(rhs)
                pairs = zip(self, rhs)
                return Vector(a * b for a, b in pairs)
        except TypeError:
            raise NotImplemented

    def __rmul__(self, other):
        return self * other
#### To run doctest:
from doctest import run_docstring_examples as dtest
dtest(Vector, globals(), verbose = True)
        return TimeSeries(self.times, -self.values)

    def __pos__(self):
        """
        Returns
        -------
        TimeSeries
           A copy of `self`.
        """
        return TimeSeries(self.times, self.values)

    def to_json(self):
        json_dict_ts = {"times": self._times.tolist(), "values": self._values.tolist()}
        return json_dict_ts

    @property
    def lazy(self):
        return lz.lazy(lambda x: x)(self)


if __name__ == '__main__':
    from lazy import lazy as lz
    dtest(TimeSeries, globals(), verbose=True)
else:
    import timeseries.lazy as lz

try:
    __version__ = pkg_resources.get_distribution(__name__).version
except:
    __version__ = 'unknown'