Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #--- 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. ]])
Add Comment
Please, Sign In to add comment