mfitzp / icoshift Goto Github PK
View Code? Open in Web Editor NEWA versatile tool for the rapid alignment of 1D NMR spectra
Home Page: https://www.mfitzp.com/tools/icoshift/
License: Other
A versatile tool for the rapid alignment of 1D NMR spectra
Home Page: https://www.mfitzp.com/tools/icoshift/
License: Other
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.
Helloi @mfitzp,
this is to ask you if this script is still alive/valid. I´m trying it but I´m finding an issue probably related to versions...
It would be great if you could help me. Thanks
My plan is to use it to align chromatography data (vectors).
ImportError Traceback (most recent call last)
Input In [22], in <cell line: 1>()
----> 1 import icoshift
File ~\AppData\Roaming\Python\Python39\site-packages\icoshift_init_.py:1, in
----> 1 from .icoshift import *
File ~\AppData\Roaming\Python\Python39\site-packages\icoshift\icoshift.py:4, in
2 import numpy
3 import scipy as sp
----> 4 from scipy.stats import nanmean, nanmedian
5 from copy import copy
6 import sys
ImportError: cannot import name 'nanmean' from 'scipy.stats' (C:\ProgramData\Anaconda3\lib\site-packages\scipy\stats_init_.py)
This implementation should offer all the same options that exist in the original MATLAB implementation of the algorithm. At present many of the options work, although some combinations have issues. This is an issue to track the progress on implementing anything that does not work but should.
average2_multiplier
inter=1...inf
coshift_preprocessing_max_shift
fill_with_previous=False
to use np.inf
to fill gapsA declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.