Task (from Project Spec 3) Please change the class constructor to take two sequences as input. The call signature should look something like this now:
# order of arguments has changed because no default
def __init__(self, times, values): # notice no default for times now
...
Make sure you implement the __iter__, itertimes, iteritems, __len__, __getitem__ and __setitem__ (the latter two take an index and get a value and set a value correspoinding to that index respectively..note I say index, not time).
Details Rewrite your ArrayTimeSeries class, with two goals:
We want you to store two arrays internally, even if you only have a single vector of values. The first should represent a list of time points, and the other should be a set of values.
Go ahead and use numpy arrays for the internal storage.
The goal of your new arrays is to work something like a cross between an array and a dictionary. Your class is an ordered container, where each time point should be monotonically increasing (you don't need to enforce this right now, but you're welcome to if you want). It's like a sequence or array in this way.
Task (from Project Spec 3) Please change the class constructor to take two sequences as input. The call signature should look something like this now:
Make sure you implement the
__iter__
,itertimes
,iteritems
,__len__
,__getitem__
and__setitem__
(the latter two take an index and get a value and set a value correspoinding to that index respectively..note I say index, not time).Details Rewrite your
ArrayTimeSeries
class, with two goals:numpy
arrays for the internal storage.The goal of your new arrays is to work something like a cross between an array and a dictionary. Your class is an ordered container, where each time point should be monotonically increasing (you don't need to enforce this right now, but you're welcome to if you want). It's like a sequence or array in this way.