bugGNU Octave - Bugs: bug #43515, signal package: specgram example...

 
 

bug #43515: signal package: specgram example in docstring needs tweaking

Submitted by:  Doug Stewart <dastew>
Submitted on:  Sun 02 Nov 2014 02:35:11 AM UTC  
 
Category: Octave Forge PackageSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Documentation
Status: FixedAssigned to: Mike Miller <mtmiller>
Originator Name: Doug StewartOpen/Closed: Closed
Release: otherOperating System: Any

Add a New Comment(Rich 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)

Sun 11 Jan 2015 04:55:50 PM UTC, comment #13:

Applied your docstring patch in https://sourceforge.net/p/octave/signal/ci/e5577e2b208f87f6f28fc52f8e21ba8248d0e6f8/

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Tue 04 Nov 2014 02:22:43 PM UTC, comment #12:

I know, that's why I assigned this bug to myself :)

The main problem is that the demo as written now requires an audio file, which I'd rather avoid adding to the package just for a demo. So the demo will stay disabled. The rest of your changes are of course fine, I'll take care of merging it.

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Tue 04 Nov 2014 01:58:44 PM UTC, comment #11:

Hi Mike Miller.
Carandraug says the you are the closest one to a maintainer of the signal pkg. If you would review my two suggestions and push them then this bug report can be closed.
thanks

Doug Stewart <dastew>
Mon 03 Nov 2014 01:31:45 AM UTC, comment #10:

Here is a patch to make the second demo work.
This should be applied after the first patch.

(file #32359)

Doug Stewart <dastew>
Sun 02 Nov 2014 07:15:35 PM UTC, comment #9:

This problem might be a result of the fix to
bug #30509, 'imshow' doesn't reverse 'ydir'

Doug Stewart <dastew>
Sun 02 Nov 2014 07:11:31 PM UTC, comment #8:

here is a patch.

(file #32357)

Doug Stewart <dastew>
Sun 02 Nov 2014 06:40:47 PM UTC, comment #7:

If the last two lines of the example are set to:

imagesc(t, f, log(S)); # display in log scale
set (gca, 'ydir','normal')

then the plot looks good to me.

Doug Stewart <dastew>
Sun 02 Nov 2014 04:28:54 PM UTC, comment #6:

I mean just for this plot. Don't change image or imagesc.

Or use some other way to plot it

Doug Stewart <dastew>
Sun 02 Nov 2014 04:26:07 PM UTC, comment #5:

So to fix it we should change the ydir property.

Doug Stewart <dastew>
Sun 02 Nov 2014 04:17:35 PM UTC, comment #4:

That is correct, try calling `image()` or `demo image` for example. The y-axis for images always runs top to bottom. See the `ydir` axis property.

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Sun 02 Nov 2014 04:10:10 PM UTC, comment #3:

Yes that is the issue that I see. But I don't understand image and imagesc --- is the 0,0 location in the top left corner for images and in the bottom left corner for plots? the array that spegram produces expects the 0,0 to be in the bottom left corner. and when we look at a spectogram we expect 0,0 to be in the bottom left corner.

Doug Stewart <dastew>
Sun 02 Nov 2014 03:44:44 PM UTC, comment #2:

Thanks for your bug report. Can you suggest an appropriate fix for the y-axis label? Is that the only issue you see with the example in the docstring?

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Sun 02 Nov 2014 03:12:00 AM UTC, comment #1:

flipud flips the image but not the Y axis.

Doug Stewart <dastew>
Sun 02 Nov 2014 02:35:11 AM UTC, original submission:

the example given in specgram has a wrong Y axis
+verbatum+
## Speech spectrogram
[x, Fs] = auload(file_in_loadpath("sample.wav")); # audio file
step = fix(5*Fs/1000); # one spectral slice every 5 ms
window = fix(40*Fs/1000); # 40 ms data window
fftn = 2^nextpow2(window); # next highest power of 2
[S, f, t] = specgram(x, fftn, Fs, window, window-step);
S = abs(S(2:fftn*4000/Fs,:)); # magnitude in range 0<f<=4000 Hz.
S = S/max(S(:)); # normalize magnitude so that max is 0 dB.
S = max(S, 10^(-40/10)); # clip below -40 dB.
S = min(S, 10^(-3/10)); # clip above -3 dB.
imagesc(t, f, flipud(log(S))); # display in log scale
-verbatum-

Zero frequency is at the top left but should be at the bottom left.

Specgram works OK but the problem is with preparations and plotting with imagesc

Doug Stewart <dastew>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #32359:  487demoworking.patch added by dastew (1KiB - text/x-patch)
file #32357:  486patchYdirection.patch added by dastew (868B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by dastew (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 10 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 11 Jan 2015 04:55:50 PM UTCmtmillerStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Mon 03 Nov 2014 01:31:45 AM UTCdastewAttached File-=>Added 487demoworking.patch, #32359
    Sun 02 Nov 2014 07:11:31 PM UTCdastewAttached File-=>Added 486patchYdirection.patch, #32357
    Sun 02 Nov 2014 03:44:44 PM UTCmtmillerCategoryPlotting=>Octave Forge Package
      Item GroupIncorrect Result=>Documentation
      StatusNone=>Confirmed
      Assigned toNone=>mtmiller
      Releasedev=>other
      SummarySpecgram example is wrong=>signal package: specgram example in docstring needs tweaking

    Back to the top


    Powered by Savane 3.1-cleanup1