Skip to content

Fix float indices in Spectrum demo#427

Merged
rkern merged 1 commit into
masterfrom
fix/spectrum
Oct 30, 2018
Merged

Fix float indices in Spectrum demo#427
rkern merged 1 commit into
masterfrom
fix/spectrum

Conversation

@achabotl
Copy link
Copy Markdown
Contributor

Fixes issue where NumPy doesn't accept float values to define shapes, to index, or to slice by replacing the true divisions with floor divisions (//) when dividing the number of samples by 2.

Traceback (most recent call last):
  File "spectrum.py", line 186, in <module>
    popup = Demo()
  File "spectrum.py", line 172, in __init__
    self.plot = _create_plot_component(self.controller)
  File "spectrum.py", line 41, in _create_plot_component
    empty_amplitude = zeros(NUM_SAMPLES/2)
TypeError: 'float' object cannot be interpreted as an integer

Fixes issue where NumPy doesn't accept float values to define shapes, to
index, or to slice by replacing the true divisions with floor divisions
(`//`) when dividing the number of samples by 2.

```python
Traceback (most recent call last):
  File "spectrum.py", line 186, in <module>
    popup = Demo()
  File "spectrum.py", line 172, in __init__
    self.plot = _create_plot_component(self.controller)
  File "spectrum.py", line 41, in _create_plot_component
    empty_amplitude = zeros(NUM_SAMPLES/2)
TypeError: 'float' object cannot be interpreted as an integer
```
@cfarrow
Copy link
Copy Markdown

cfarrow commented Oct 29, 2018

I cannot test this on my system, but the changes LGTM.

@rkern rkern merged commit 4389a25 into master Oct 30, 2018
@rkern rkern deleted the fix/spectrum branch October 30, 2018 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants