0

I'm trying to get a sense of the spatial frequencies present in a series of images I want to analyze. I decided to do this with the numpy.fft.fft2 function, but apparetly the output can't be plotted - can you help me figure out what's wrong?

Apparently this is happening because the output contains values like 0.+0.j which` matplotlib can't deal with. But I don't know how to change them to something it can deal with either.

Here's a minimal example with my issue.

1 Answer 1

5

Matplotlib can only handle real values. Your options are to take the real or imaginary parts of the results, or magnitude and maybe even phase. These can be done with numpy.real or numpy.imag, or numpy.abs and numpy.angle.

Ultimately, I guess it just depends on what you want to know about your FFT. People are usually most interested in the magnitude of FFT data, which suggests abs. This gives you an idea of the "power" in the various frequencies.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.