Open lucapinello opened 9 years ago
Thanks @lucapinello not sure what the issue is, but the tests still need some work. I'll take a look.
I noticed that the problem is related to the presence of nan values so probably in the function: remove_nan. Without nan it works.
The test fails for me too but with a different error.
Any Idea why?
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 **********'
gives
C:\Anaconda2\lib\site-packages\scipy\stats\stats.py:316: RuntimeWarning: invalid value encountered in true_divide
return np.mean(x, axis) / factor
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-1-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
C:\Anaconda2\lib\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
C:\Anaconda2\lib\site-packages\icoshift\icoshift.pyc in remove_nan(b, signal, select, flags)
980
981 if numpy.any(~in_[0]):
--> 982 a = cat(1, numpy.array([0]), a)
983
984 else:
C:\Anaconda2\lib\site-packages\icoshift\icoshift.pyc in cat(dim, *args)
23
24 def cat(dim, *args):
---> 25 return numpy.concatenate([r for r in args if r.shape[0] > 0], axis=dim)
26
27
IndexError: axis 1 out of bounds [0, 1)
I see! removing the np.nan fixed the example My own spectra(without 'nan') does not work though.
Is it safe to assume that this project is no longer maintained?
This is exactly why the versions of the required packages should be listed (install within virtualenv + include pip freeze
in the repo) . Apparently NumPy/SciPy have had some breaking changes which is why this library no longer works with the up-to-date versions. For instance, nanmean
has been deprecated and removed from numpy. Does anyone know what scipy/numpy version combination has worked with this library?
Hi @amergin, would you be interested in collaborating on a rewrite of this?
PRs that fix any issues are most welcome.
I'm no longer using the library myself (no longer working with NMR) so another maintainer would also be very welcome.
There are plenty of improvements to make, not least adding tests to catch these issues quicker.
On 18 Sep 2017 13:32, "KeironO" notifications@github.com wrote:
Hi @amergin https://github.com/amergin, would you be interested in collaborating on a rewrite of this?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mfitzp/icoshift/issues/2#issuecomment-330193536, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHtH04_WiK39VDx6Ty_1cRm-sU-9mQ4ks5sjlTOgaJpZM4DJH-W .
@mfitzp Dim problem.
Disgwyl cais gwthio yn weddol fuan!
@KeironO Unfortunately I don't have the time to get into developing this.
Hi I have some problem running the test.py:
I get:
Any idea on how to fix it?
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.