AllenDowney / ThinkDSP

Think DSP: Digital Signal Processing in Python, by Allen B. Downey.
https://allendowney.github.io/ThinkDSP/
3.97k stars 3.23k forks source link

low_pass filter issues #59

Closed simulsys closed 6 years ago

simulsys commented 6 years ago

Hi Allen,

I am trying to use low_pass() from the book ThinkDSP and I find the subsequent call to the amps of the filtered specrum gives an error: AttributeError: 'NoneType' object has no attribute 'amps'

Does the low_pass function return a new version of the spectrum or do I have to recreate the spectrum via wave? Can you help please? All I am trying to do is filter the spectrum and then use the amps data? Cheers, Andrew.

AllenDowney commented 6 years ago

Thanks for letting me know. I will check this out as soon as I can.

Can you send me a minimal snippet of code that reproduces the error?

On Mon, Sep 3, 2018 at 1:41 AM, Andrew notifications@github.com wrote:

Hi Allen,

I am trying to use low_pass() from the book ThinkDSP and I find the subsequent call to the amps of the filtered specrum gives an error: AttributeError: 'NoneType' object has no attribute 'amps'

Does the low_pass function return a new version of the spectrum or do I have to recreate the spectrum via wave? Can you help please? All I am trying to do is filter the spectrum and then use the amps data? Cheers, Andrew.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/AllenDowney/ThinkDSP/issues/59, or mute the thread https://github.com/notifications/unsubscribe-auth/ABy37ZmArw521DSjLsIWCPfZk-lK4P0pks5uXMEjgaJpZM4WW_sP .

simulsys commented 6 years ago

Hi Allen,

I fear it was my misinterpretation of the command line insruction in the book? I was following Python convention and instantiating a variable with the result of: spectrum2 = spectrum.low_pass(cutoff=600, factor=0.01)

I checked a code snippet form your github online and realized that the spectrum2 variable was superfluous. I now have codeline: spectrum.low_pass(cutoff=600, factor=0.01)

It seems to work. Apologies for setting a hare running. Andrew.

AllenDowney commented 6 years ago

No problem!

On Mon, Sep 3, 2018 at 10:11 AM, Andrew notifications@github.com wrote:

Closed #59 https://github.com/AllenDowney/ThinkDSP/issues/59.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/AllenDowney/ThinkDSP/issues/59#event-1823609643, or mute the thread https://github.com/notifications/unsubscribe-auth/ABy37Q-r_pY8Ia0ABx9CINUNY4Ri9sQIks5uXTiFgaJpZM4WW_sP .