TimeSeries.append (in place) error
Created by: pmeyers279
I'm getting a numpy error for resizing an array in GWpy when I try to append two timeseries. I'm not sure if it's a bug or if there's just something I'm missing. Here's a mwe:
In [96]: dat = TimeSeries([0,0,0,0], epoch=0, sample_rate=1)
In [97]: dat2 = TimeSeries([0,0,0,0],epoch=4, sample_rate=1)
In [98]: dat.append(dat2)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-98-fd3f6494163d> in <module>()
----> 1 dat.append(dat2)
/home/user1/meyers/virtualenvs/py2.7/lib/python2.7/site-packages/gwpy/types/series.pyc in append(self, other, gap, inplace, pad, resize)
652 s[0] = self.shape[0] + other.shape[0]
653 try:
--> 654 self.resize(s, refcheck=False)
655 except ValueError as e:
656 if 'resize only works on single-segment arrays' in str(e):
ValueError: cannot resize this array: it does not own its data
note one can get around this by setting "inplace=False" and outputting the appended array to a newone:
newdat = dat.append(dat2, inplace=False)