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

IndexError for window_length / 2 with __future__ division #14

Open
alexklibisz opened this issue Aug 1, 2017 · 0 comments
Open

IndexError for window_length / 2 with __future__ division #14

alexklibisz opened this issue Aug 1, 2017 · 0 comments

Comments

@alexklibisz
Copy link

I get the following error when calling c2s.train:

File "/raid/alex-scratch/pyenvs/py2ml/local/lib/python2.7/site-packages/c2s/c2s.py", line 362, in train
    output_mask[1, window_length / 2] = True
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

Referring to this line: https://github.com/lucastheis/c2s/blob/master/c2s/c2s.py#L362

This change seems to fix it:

output_mask[1, int(window_length / 2)] = True

I believe it happens because another library I'm using uses from __future__ import division, which makes any division return a float.

It would be a trivial fix to cast all the indexes that use division to integers, but I'm not sure if that would change the behavior in a way that matters for other functionality.

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

No branches or pull requests

1 participant