possible issue with _spectral_helper function in matplotlib/mlab.py when compensate windowing loss

Forwarding an email to the devel list, we seem to have an error in mlab.

Dimitris: Please send future issues like this directly to the mailing list or create an issue on GH.

···

---------- Forwarded message ---------
From: Dimitris Daniel <ddanielwork@…149…>
Date: Thu, Mar 26, 2015 at 4:04 AM
Subject: possible issue with _spectral_helper function in matplotlib/mlab.py when compensate windowing loss
To: <tcaswell@…149…>, <martin.fitzpatrick@…149…>

Dear Mr. Thomas and Mr. Martin,

First of all I would like to thank you for your work.
My name is Dimitris Daniel and I use _spectral_helper in a process.

I think that there is a problem when we try to compensate windowing loss.

You use the row:
result /= (np.abs(windowVals)**2).sum()

However as I can see in Bendat & Piersol Sec 11.5.2. (see attached 3.png) I think the right is something like:

result *= np.sqrt((np.ones(NFFT)**2).sum() / (np.abs(windowVals)**2).sum())

Actually I had some correlation problems with the data from a customer of my for which I build a script for Signal Analysis.

He gave me the input signal and the output he gets from the hardware he is using.

I use some parts from your functions and it was not possible to get the same results.

By changing this row the results are matching together.

Am I missing something or am I right.

Thank you very much for your time and sorry for any inconvenience.

I am looking forward to your response.

Best Regards,

Dimitris Daniel

wouldn’t np.sqrt(np.ones(NFFT)**2).sum() just be NFFT? So, it looks like our power spectra isn’t normalized at that point. But, IIRC, the code that calls this helper function does normalize the result if the user specifies it to be.

Ben Root

···

On Thu, Mar 26, 2015 at 8:35 AM, Thomas Caswell <tcaswell@…149…> wrote:

Forwarding an email to the devel list, we seem to have an error in mlab.

Dimitris: Please send future issues like this directly to the mailing list or create an issue on GH.

---------- Forwarded message ---------
From: Dimitris Daniel <ddanielwork@…149…>
Date: Thu, Mar 26, 2015 at 4:04 AM
Subject: possible issue with _spectral_helper function in matplotlib/mlab.py when compensate windowing loss
To: <tcaswell@…552…149…>, <martin.fitzpatrick@…149…>

Dear Mr. Thomas and Mr. Martin,

First of all I would like to thank you for your work.
My name is Dimitris Daniel and I use _spectral_helper in a process.

I think that there is a problem when we try to compensate windowing loss.

You use the row:
result /= (np.abs(windowVals)**2).sum()

However as I can see in Bendat & Piersol Sec 11.5.2. (see attached 3.png) I think the right is something like:

result *= np.sqrt((np.ones(NFFT)**2).sum() / (np.abs(windowVals)**2).sum())

Actually I had some correlation problems with the data from a customer of my for which I build a script for Signal Analysis.

He gave me the input signal and the output he gets from the hardware he is using.

I use some parts from your functions and it was not possible to get the same results.

By changing this row the results are matching together.

Am I missing something or am I right.

Thank you very much for your time and sorry for any inconvenience.

I am looking forward to your response.

Best Regards,

Dimitris Daniel


Dive into the World of Parallel Programming The Go Parallel Website, sponsored

by Intel and developed in partnership with Slashdot Media, is your hub for all

things parallel software development, from weekly thought leadership blogs to

news, videos, case studies, tutorials and more. Take a look and join the

conversation now. http://goparallel.sourceforge.net/


Matplotlib-devel mailing list

Matplotlib-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-devel