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

Input 18 of the code/voss.ipynb, the Barlett Method function, fails with a type error #65

Closed tionebrr closed 3 years ago

tionebrr commented 4 years ago
TypeError                                 Traceback (most recent call last)
<ipython-input-19-4acaa3d0f7dd> in <module>
----> 1 spectrum = bartlett_method(wave, seg_length=seg_length, win_flag=False)
      2 spectrum.hs[0] = 0
      3 len(spectrum)

<ipython-input-18-0c3fecb9be50> in bartlett_method(wave, seg_length, win_flag)
     14     # compute the root mean power (which is like an amplitude)
     15     hs = np.sqrt(sum(psds) / len(psds))
---> 16     fs = spectrums[0].fs
     17 
     18     # make a Spectrum with the mean amplitudes

TypeError: 'dict_values' object is not subscriptable
AllenDowney commented 3 years ago

It looks like the current version is working, but let me know if a problem persists. Thank you!