Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix float indices in Spectrum demo #427

Merged
merged 1 commit into from
Oct 30, 2018
Merged

Fix float indices in Spectrum demo #427

merged 1 commit into from
Oct 30, 2018

Conversation

achabotl
Copy link
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
Contributor

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