Introduction

Hi All, I'm a longtime Matlab user. I've been using Python

    > for a year or two and have begun using
    > Matplotlib/Numpy/Scipy. I have a patch for specgram() that
    > will plot the spectrogram with the positive and negative
    > frequencies flipped (fftshift). This is the way that you
    > would examine the complex data coming out of a receiver.

    > What is the prefered method for submitting patches? I
    > didn't find any information on the website.

The best way is to add them as patches to the sf site and then post
here with a link to the patch (and attach the patch if possible). I
tend to monitor this list much more closely, but it is nice to have it
on the sf site if it falls between the cracks because it is easier for
someone to pick it up later. If you get no action in a week or two,
ping us again.

    > Also, I would like to add support for more window functions
    > in specgram(). I see three options for doing this: a) Add
    > the window functions directly ( drawback: code duplication)
    > b) Add wrappers for the window functions in SciPy (drawback:
    > additional dependencies?)

We are trying to move away from adding our own numerical code and have
this go into numpy/scipy. I suggest adding a docstring saying,
additional window functions a,b and c are available in
somepackage.somemodule

    > c) Modify specgram so that if it
    > receives an array as the window parameter it checks its
    > length and then applies it as a window. If the window
    > parameter is not an array then it treats it as a function
    > (current behaviour)

This is fine -- I suggest using the matplotlib.cookbook.iterable
function or the python builtin callable function to do the check.
Whatever changes you make for specgram should also be ported into psd,
csd and cohere.

Thanks,
JDH

Hi,
I’ll do these patches a little at a time.

Here is a patch to show a complex spectrogram with the negative frequencies flipped down. I’ve also attached a modified version of the spectrogram_demo.py that creates the two signals as complex exponentials so they are only in one half of the spectrum (long signal positive, short signal negative).

Basically, if the input signal is complex then the whole spectrogram is shown. If the input is real then just the positive frequencies are shown.

Next I’ll work on the following as discussed.
Thanks
Greg

cmplx_specgram_demo.py (782 Bytes)

complex-specgram-patch (2.08 KB)

···

On 10/6/06, John Hunter <jdhunter@…5…> wrote:

> c) Modify specgram so that if it
> receives an array as the window parameter it checks its

> length and then applies it as a window.  If the window
> parameter is not an array then it treats it as a function
> (current behaviour)

This is fine – I suggest using the matplotlib.cookbook.iterable
function or the python builtin callable function to do the check.
Whatever changes you make for specgram should also be ported into psd,
csd and cohere.


Linux. Because rebooting is for adding hardware.

Hi,
I changed my mind. The second patch was so easy that here is the complete patch that includes allowing psd, csd, cohere_pairs, cohere, and specgram to pass in a vector of length NFFT for “window”.

I’ll go attach this patch to the SF site for the ticket I created yesterday.
Thanks
Greg

cmplx-specgram-window-vector-patch (5.41 KB)

···

On 10/7/06, Greg Willden < gregwillden@…149…> wrote:

Hi,
I’ll do these patches a little at a time.

Here is a patch to show a complex spectrogram with the negative frequencies flipped down. I’ve also attached a modified version of the spectrogram_demo.py that creates the two signals as complex exponentials so they are only in one half of the spectrum (long signal positive, short signal negative).

Basically, if the input signal is complex then the whole spectrogram is shown. If the input is real then just the positive frequencies are shown.

Next I’ll work on the following as discussed.
Thanks

Greg

On 10/6/06, John Hunter < > jdhunter@…5…> wrote:

> c) Modify specgram so that if it
> receives an array as the window parameter it checks its

> length and then applies it as a window.  If the window
> parameter is not an array then it treats it as a function
> (current behaviour)

This is fine – I suggest using the matplotlib.cookbook.iterable
function or the python builtin callable function to do the check.
Whatever changes you make for specgram should also be ported into psd,
csd and cohere.

Linux. Because rebooting is for adding hardware.


Linux. Because rebooting is for adding hardware.