I am tracking the values of two fluctuating quantities as a function of time and am trying to analyze possible correlations between the two as a function of frequency. The application is experimental physics but I have been dipping into the signal processing world to better understand this. I am using Python to do data analysis.

What I initially thought I wanted was the cross-spectral density, or the magnitude-squared coherence for a normalized result. I began by using the Welch packages in Python because they seemed nice and compact and also well-suited to my noisy, finite data. Unfortunately this doesn't distinguish between potential anti-correlation because it takes the amplitude of the spectrum.

Next I thought I could get what I want by simply taking the correlation functions and then doing a fourier transform (using Numpy functions) but now I'm not quite sure what to do with my complex output of the FFT. I can of course look at just the real part, but I worry I may be throwing away some important information..

In qualitative terms, I know that I can simply calculate the Pearson coefficient between the two traces to answer the question "Are these two things correlated or not?". But I would like to go a bit further - they may be correlated on long time scales, but uncorrelated on shorter time scales, for example, and that's why I am trying to go to the frequency domain.

I could show some sample code but I think perhaps I am not even going in the right direction here trying to look at the cross-spectral density. Does anyone have any tips here for analyzing correlation/anticorrelation in frequency domain?

| improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.