Skip to content

Instantly share code, notes, and snippets.

@scivision
Last active October 31, 2018 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scivision/86aaeef0d74d4da582625074285f4fe9 to your computer and use it in GitHub Desktop.
Save scivision/86aaeef0d74d4da582625074285f4fe9 to your computer and use it in GitHub Desktop.
#--- shell (Ubuntu 17.10, Octave 4.2.1, Python 3.6.4)
pip install oct2py==4.0.6
#--- Python
x=[0.,0,0,0,0,1,1,1,1,0,0,0,0,0]
from oct2py import Oct2Py
with Oct2Py() as oc:
oc.eval('pkg load signal')
y = oc.sgolayfilt(x,3,5)
#--- stderr
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "~/miniconda3/lib/python3.6/site-packages/oct2py/dynamic.py", line 96, in __call__
return self._ref().feval(self.name, *inputs, **kwargs)
File "~/miniconda3/lib/python3.6/site-packages/oct2py/core.py", line 369, in feval
store_as=store_as, plot_dir=plot_dir)
File "~/miniconda3/lib/python3.6/site-packages/oct2py/core.py", line 568, in _feval
raise Oct2PyError(msg)
oct2py.utils.Oct2PyError: Octave evaluation error:
error: =: nonconformant arguments (op1 is 1x5, op2 is 3x5)
#--- work in plain Octave 4.2.1
x=[0.,0,0,0,0,1,1,1,1,0,0,0,0,0];
pkg load signal
y = sgolayfilt(x,3,5);
type y
y is a variable
Columns 1 through 5:
0.00000 0.00000 0.00000 -0.08571 0.25714
Columns 6 through 10:
0.74286 1.08571 1.08571 0.74286 0.25714
Columns 11 through 14:
-0.08571 0.00000 0.00000 0.00000
# --- omitting all but first argument works from Python
sgolayfilt(x) == sgolayfilt(x,3,5) since those are the default parameters.
y = oc.sgolayfilt(x)
>>> y
array([[ 0. , 0. , 0. , -0.08571429, 0.25714286,
0.74285714, 1.08571429, 1.08571429, 0.74285714, 0.25714286,
-0.08571429, 0. , 0. , 0. ]])
@jmlarson1
Copy link

Is there any work towards resolving this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment