bugGNU Octave - Bugs: bug #37410, image.m has a wrong check for...

 
 

bug #37410: image.m has a wrong check for linearly-spaced x and y

Submitted by:  Francesco Potortì <pot>
Submitted on:  Thu 20 Sep 2012 11:44:33 AM UTC  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Regression
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.6.2Operating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Mon 14 Oct 2013 01:09:14 AM UTC, comment #6:

We don't necessarily need std(), but we would like something that is dimensionless and the coefficient of variation was one such measure.

Consider the following example which has small, but non-linear, spacing and would still pass your criterion.

which displays "linear".

I think this code should work which uses the percentage change (dimensionless) from the mean delta.

I checked it in here http://hg.savannah.gnu.org/hgweb/octave/rev/a433244dd697.

Rik <rik5>
Project Administrator
Sat 12 Oct 2013 02:18:31 PM UTC, comment #5:

I guess your testcase is

Why do we need std in the linearity check? Isn't something like

sufficient? Regards, Andy

Andreas Weber <andy1978>
Project Member
Thu 20 Sep 2012 01:50:18 PM UTC, comment #4:

I'd like to eliminate the use of length in Octave because the definition of length (inherited from prehistoric Matlab) is weird. So please use numel instead unless there is some specific case that actually needs the strange behavior of the length function. And in that case, please comment why it is needed.

John W. Eaton <jwe>
Project Administrator
Thu 20 Sep 2012 01:29:14 PM UTC, comment #3:

Yes. This is the code as I am currently using it:

dx = diff (x);
dy = diff (y);
dx = std (dx) / mean (abs (dx));
dy = std (dy) / mean (abs (dy));
tol = 100*eps;
if (any (dx > length(x)tol) || any (dy > length(y)tol))
warning ("Image does not map to non-linearly spaced coordinates")
endif

The only change is in the 'if' condition.

Francesco Potortì <pot>
Thu 20 Sep 2012 01:18:12 PM UTC, comment #2:

Did you mean:
tol = 100length(x) eps;

Doug Stewart <dastew>
Thu 20 Sep 2012 12:05:25 PM UTC, comment #1:

Sorry, I meant length(x) rather than rows(x).

Francesco Potortì <pot>
Thu 20 Sep 2012 11:44:33 AM UTC, original submission:

The check in image.m is

dx = diff (x);
dx = std (dx) / mean (abs (dx));
tol = 100*eps;
if (any (dx > tol))
warning

but this is too strict.

I stumbled upon it with x=linspace(0,10.43,743);

I suggest to set

tol = 100*rows(x);

Francesco Potortì <pot>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by andy1978 (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by dastew (Posted a comment)
  • -unavailable- added by pot (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 14 Oct 2013 01:09:14 AM UTCrik5StatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup