bugGNU Octave - Bugs: bug #42832, signal package: findpeaks:...

 
 

bug #42832: signal package: findpeaks: operator -: nonconformant arguments - when no peaks found

Submitter:  None
Submitted:  Wed 23 Jul 2014 10:44:53 AM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * other
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 25 Feb 2016 03:03:24 PM UTC, comment #6: 

For what is worth, I fixed the real origin of this problem by allowing automatic broadcasting with zero length dimensions. I http://hg.savannah.gnu.org/hgweb/octave/rev/12280fef2741

Carnë Draug <carandraug>
Group Member
Sun 22 Feb 2015 05:30:55 PM UTC, comment #5: 

I've added more input validation checking to findpeaks and also modified it to accept a row vector input:

http://sourceforge.net/p/octave/signal/ci/93d8ef49e645312f395eb6db67eebc12cf9067c4

Mike Miller <mtmiller>
Group Member
Mon 19 Jan 2015 06:12:19 PM UTC, comment #4: 

Mike, sorry for the late reply.

cset 56e2f21ec883 fixed the "error: findpeaks: operator -: nonconformant arguments (op1 is 0x1, op2 is 1x0)" when using a column vector with no max or min (ones (6, 1)) for me. The reason is:


octave:> ones (0, 1) - ones (1, 0)
error: operator -: nonconformant arguments (op1 is 0x1, op2 is 1x0)


but with bsxfun:


octave:> bsxfun (@minus, ones (0, 1), ones (1, 0))
ans = [](0x0)


The other problem is, if DATA is a row vector despite the help text explicitely says: "DATA is expected to be a single column vector"

I think we should issue an error in this case:

diff -r 0393301722df inst/findpeaks.m
--- a/inst/findpeaks.m  Sun Jan 11 11:46:59 2015 -0500
+++ b/inst/findpeaks.m  Mon Jan 19 19:09:29 2015 +0100
@@ -133,6 +133,11 @@
            'Data contains negative values. You may want to "DoubleSided" option
   endif

+  if (! iscolumn (data))
+    error ("findpeaks:InvalidArgument",
+           "DATA is expected to be a single column vector");
+  endif
+
   ## Rough estimates of first and second derivative
   df1 = diff (data, 1)([1; (1:end)']);
   df2 = diff (data, 2)([1; 1; (1:end)']);


Thank you, Andy

Andreas Weber <andy1978>
Group Member
Sun 11 Jan 2015 04:58:27 PM UTC, comment #3: 

I can still reproduce, but only when the input vector is a row vector. Andy, did you try to reproduce with a row or column vector?

Mike Miller <mtmiller>
Group Member
Tue 25 Nov 2014 12:39:29 PM UTC, comment #2: 

I can't reproduce this with signal 1.3.2, must have been fixed at some stage between.

Andreas Weber <andy1978>
Group Member
Thu 24 Jul 2014 12:27:39 PM UTC, comment #1: 

Thanks for your bug report. Confirmed here as well.

Mike Miller <mtmiller>
Group Member
Wed 23 Jul 2014 10:44:53 AM UTC, original submission:  

When using findpeaks (from the 1.3.0 version of the signal processing toolset) on a data set where there are no peaks, e.g. [1 1 1 1 1 1], then the following error is raised:

'error: findpeaks: operator -: nonconformant arguments (op1 is 0x1, op2 is 1x0)
error: evaluating argument list element number 1
error: called from:
error:   findpeaks.m at line 135, column 5'

This may be by design, but perhaps returning empty idx and pks arrays would be more condusive as opposed to having to catch and handle this error to handle the case when no peaks are found. For comparison, the findpeaks function in Matlab returns an empty array on finding no peaks.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by andy1978 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-02-22 mtmiller StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2014-07-24 mtmiller Item GroupInaccurate Result Incorrect Result
        StatusNone Confirmed
        Release3.8.1 other
        Operating SystemGNU/Linux Any

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code