Rank: 1189 based on 76 downloads (last 30 days) and 10 files submitted
photo

Andrew Davis

E-mail
Company/University
McMaster University

Personal Profile:
Professional Interests:
MR Imaging, Image Processing, Signal Processing, Medical Physics

 

Watch this Author's files

 

Files Posted by Andrew View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
04 Feb 2013 Screenshot GETCLIM: Suggest appropriate values for colormap limits Determines thresholds such that 2% of data values will be mapped to the extremes of the colormap Author: Andrew Davis image processing, threshold, colormap, colorbar 1 2
31 Jan 2013 Screenshot STATMASK: Overlay image with coloured statistical mask Overlay an image with a thresholded statistical mask. The mask values are not rescaled. Author: Andrew Davis image processing, data presentation 5 0
09 Nov 2012 Screenshot WelchWin: Welch (parabolic) window function The function returns a parabolic window of length n. This is useful for spectral estimation. Author: Andrew Davis welch, window, signal processing 1 0
22 May 2012 Screenshot ISEQUALFP: Check equality within floating point precision Accepts two values, returns a logical indicating if they are equal within floating point precision Author: Andrew Davis mathematics, floating point 6 4
  • 4.0
4.0 | 1 rating
22 May 2012 Screenshot FFTWN: Round up to efficient FFT integer Accepts an integer n. Returns m>=n that is an optimum data length for fast FFT computation Author: Andrew Davis noise, fourier analysis, signal processing 8 0
Comments and Ratings by Andrew View all
Updated File Comments Rating
06 Feb 2013 GETCLIM: Suggest appropriate values for colormap limits Determines thresholds such that 2% of data values will be mapped to the extremes of the colormap Author: Andrew Davis

Thanks for the comment, Jurgen. I agree that a single output vector makes more sense -- I've updated the file accordingly.

22 May 2012 ISEQUALFP: Check equality within floating point precision Accepts two values, returns a logical indicating if they are equal within floating point precision Author: Andrew Davis

I think I'll keep the behaviour for different sizes as it is, simply because I think it would confuse me if I was expecting yn=1, but got 0 because one vector was 1 item shorter, for example. Alternatively the function could return 0 but with a warning about the sizes, I suppose, but this is easy enough for people to change if it bugs them.

As for the mixed single and double cases, I like the current behaviour because I had intended for this function to be somewhat generous in calling values equal. This is because I'm never operating near the limits of floating point precision in my day-to-day work. In this way the max() function keeps things somewhat loose in that it returns a single-valued result for mixed single and double inputs. Even, for example, max(single(1), 1+1e6*eps('double')) returns single(1). So the behaviour is:

isequalfp(single(1), 1+1e8*eps('double')) => 1
isequalfp(single(1)+eps('single'), 1) => 1
isequalfp(single(1)+2*eps('single'), 1) => 0

I've updated the documentation to attempt to convey this. Again, thanks for your comments, I'm glad this generated some discussion.

18 May 2012 ISEQUALFP: Check equality within floating point precision Accepts two values, returns a logical indicating if they are equal within floating point precision Author: Andrew Davis

You're right, Jan, that does work better for very disparate arrays. I've updated the file -- thanks for your comment!

19 Apr 2012 Flexible search and listing tool for field names in a structure array Searches for field names in a structure array and lists them Author: Paul A.M. Bune

Very useful

15 Apr 2012 Tools for NIfTI and ANALYZE image Load, save, make, reslice, view (and edit) both NIfTI and ANALYZE data on any platform Author: Jimmy Shen

Comments and Ratings on Andrew's Files View all
Updated File Comment by Comments Rating
06 Feb 2013 GETCLIM: Suggest appropriate values for colormap limits Determines thresholds such that 2% of data values will be mapped to the extremes of the colormap Author: Andrew Davis Davis, Andrew

Thanks for the comment, Jurgen. I agree that a single output vector makes more sense -- I've updated the file accordingly.

01 Feb 2013 GETCLIM: Suggest appropriate values for colormap limits Determines thresholds such that 2% of data values will be mapped to the extremes of the colormap Author: Andrew Davis Jurgen

A better version of matlabs stretchlim.
Better because:
- Stretchlim returns 0-1 normalized thresholds, regardless of input class.
- Stretchlim fails with int16 even though the help says it can be used
- Any data from single or double class must be in the 0-1 range.

That said, I personally prefer 1 output vector containing both values, like with stretchlim.

12 Jan 2013 SEROUND: Round value and standard error Input: value and associated standard error (or deviation) Output: string of rounded value +/- error Author: Andrew Davis Southon, Nicholas

22 May 2012 ISEQUALFP: Check equality within floating point precision Accepts two values, returns a logical indicating if they are equal within floating point precision Author: Andrew Davis Davis, Andrew

I think I'll keep the behaviour for different sizes as it is, simply because I think it would confuse me if I was expecting yn=1, but got 0 because one vector was 1 item shorter, for example. Alternatively the function could return 0 but with a warning about the sizes, I suppose, but this is easy enough for people to change if it bugs them.

As for the mixed single and double cases, I like the current behaviour because I had intended for this function to be somewhat generous in calling values equal. This is because I'm never operating near the limits of floating point precision in my day-to-day work. In this way the max() function keeps things somewhat loose in that it returns a single-valued result for mixed single and double inputs. Even, for example, max(single(1), 1+1e6*eps('double')) returns single(1). So the behaviour is:

isequalfp(single(1), 1+1e8*eps('double')) => 1
isequalfp(single(1)+eps('single'), 1) => 1
isequalfp(single(1)+2*eps('single'), 1) => 0

I've updated the documentation to attempt to convey this. Again, thanks for your comments, I'm glad this generated some discussion.

19 May 2012 ISEQUALFP: Check equality within floating point precision Accepts two values, returns a logical indicating if they are equal within floating point precision Author: Andrew Davis Simon, Jan

Fine. Now it works as expected. I'd prefer to get FALSE if the sizes do not match, equivalently to ISEQUAL. But this is a matter of taste.
What do you expect if one input is a SINGLE and the other a DOUBLE? E.g.:
isequalfp(single(1), 1+eps('double'))
isequalfp(single(1)+eps('single'), 1)
Note that "single(1) - (1+eps('double'))" replies: single(-2.2204e-016)
However, the function works as I expect it, it is well documented, useful and usable. Although this is a one-line actually, floating point arithmetics are never trivial. See also: http://en.wikipedia.org/wiki/Floating_point

Top Tags Applied by Andrew
image processing, signal processing, mask, mathematics, visualization
Files Tagged by Andrew View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
04 Feb 2013 Screenshot GETCLIM: Suggest appropriate values for colormap limits Determines thresholds such that 2% of data values will be mapped to the extremes of the colormap Author: Andrew Davis image processing, threshold, colormap, colorbar 1 2
31 Jan 2013 Screenshot STATMASK: Overlay image with coloured statistical mask Overlay an image with a thresholded statistical mask. The mask values are not rescaled. Author: Andrew Davis image processing, data presentation 5 0
09 Nov 2012 Screenshot WelchWin: Welch (parabolic) window function The function returns a parabolic window of length n. This is useful for spectral estimation. Author: Andrew Davis welch, window, signal processing 1 0
22 May 2012 Screenshot ISEQUALFP: Check equality within floating point precision Accepts two values, returns a logical indicating if they are equal within floating point precision Author: Andrew Davis mathematics, floating point 6 4
  • 4.0
4.0 | 1 rating
22 May 2012 Screenshot FFTWN: Round up to efficient FFT integer Accepts an integer n. Returns m>=n that is an optimum data length for fast FFT computation Author: Andrew Davis noise, fourier analysis, signal processing 8 0

Contact us