[SciPy-User] [scikits-timeseries] Some problems with inheritance (begginer's question, long)

Paweł Rumian gorkypl@gmail....
Sat Oct 2 19:14:17 CDT 2010

Thank you J. David - your mail was a significant help. I've read about
*args and *kwargs, and they indeed seem to be important in such cases.

However I still cannot solve the problem... For me it seems that the
function interp_masked1d from scikits.timeseries.lib.interpolate won't
work with anything else than TimeSeries instance - or is it still me
doing something wrong, maybe with initializing the instance of

I'm trying to do is as simple as it could be - I stripped the whole
ChromaData Class to single __init__ method, like this:

class ChromaData(ts.TimeSeries):
    u"""Represents chromatographic timeseries data, inherits from TimeSeries."""

    def __init__(self,data,dates,*args,**kwargs):
        super(ChromaData, self).__init__(*args,**kwargs)

Then I create a TimeSeries instance, loading it from file
(get_data_from_file is just a wrapper to ts.tsfromtxt), and a
ChromaData instance:

timeseries_instance= get_data_from_file('testdata.dat')

For certainity:
print (timeseries_instance.__class__)
<class 'scikits.timeseries.tseries.TimeSeries'>

print (chromadata_instance.__class__)
<class '__main__.ChromaData'>

And then I run
(everything is OK here)


and I get:

Traceback (most recent call last):
  File "testcase.py", line 39, in <module>
  File "/usr/lib/python2.6/site-packages/scikits/timeseries/lib/interpolate.py",
line 125, in interp_masked1d
    marr = marray(marr, copy=True)
  File "/usr/lib/python2.6/site-packages/numpy/ma/core.py", line 5491, in array
    fill_value=fill_value, ndmin=ndmin, shrink=shrink)
TypeError: __init__() takes at least 3 non-keyword arguments (2 given)

The whole code can be found at: http://pastebin.com/Vd3mCr8M

I've tried converting ChromaData instance to TimeSeries before feeding
interp_masked1d with it, like
chromadata_instance.dates), kind='linear')
and it works, but it's just a workaround...

Thank you for all possible help,

More information about the SciPy-User mailing list