icoshift
icoshift copied to clipboard
Test fails on numpy 1.9.1
Hi I have some problem running the test.py:
import icoshift
import numpy as np
test = np.array([
[0, 0, 0, 2, 3, 2, 0, 0, 2, 1, 2, np.nan, 3, 4, 2, 3, 2, 0, 2, 3, 2],
[0, 0, 2, 3, 2, 0, 0, 2, 3, 1, 2, np.nan, 3, 4, 3, 2, 0, 2, 3, 2, 0],
[0, 2, 3, 2, 0, 0, 2, 3, 2, 1, 2, np.nan, 3, 4, 2, 0, 2, 3, 2, 0, 1],
])
xCS, ints, ind, target = icoshift.icoshift('average', test)
print '********** PASS 1: average **********'
test = np.array([
[0, 0, 0, 2, 3, 2, 0, 0, 2, 3, 2, np.nan, 0, 0, 2, 3, 2, 0, 2, 3, 2],
[0, 0, 2, 3, 2, 0, 0, 2, 3, 2, 0, np.nan, 0, 2, 3, 2, 0, 2, 3, 2, 0],
[0, 2, 3, 2, 0, 0, 2, 3, 2, 0, 0, np.nan, 2, 3, 2, 0, 2, 3, 2, 0, 1],
])
xCS, ints, ind, target = icoshift.icoshift('median', test)
print '********** PASS 2: median **********'
I get:
ValueError Traceback (most recent call last)
<ipython-input-3-729c4e491a6c> in <module>()
7 [0, 2, 3, 2, 0, 0, 2, 3, 2, 1, 2, np.nan, 3, 4, 2, 0, 2, 3, 2, 0, 1],
8 ])
----> 9 xCS, ints, ind, target = icoshift.icoshift('average', test)
10 print '********** PASS 1: average **********'
11
/gcdata/gcproj/Luca/noah/lib/python2.7/site-packages/icoshift/icoshift.pyc in icoshift(xt, xp, inter, n, scale, coshift_preprocessing, coshift_preprocessing_max_shift, fill_with_previous, average2_multiplier)
386 else:
387 intern_, flag_nan = remove_nan(
--> 388 ref(inter), cat(0, xt, xp), select, flags=True)
389 intern_ = vec(intern_.T).T
390
/gcdata/gcproj/Luca/noah/lib/python2.7/site-packages/icoshift/icoshift.pyc in remove_nan(b, signal, select, flags)
994
995 c.resize(d.shape)
--> 996 c[count:count + max(a.shape) + 1] = d
997
998 count = count + max(a.shape)
ValueError: could not broadcast input array from shape (4) into shape (3)
Any idea on how to fix it?
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.