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

TypeError: Cannot cast ufunc add output from dtype('float64') to dtype('uint8 #8

Open
nekosaur opened this issue Feb 2, 2016 · 2 comments

Comments

@nekosaur
Copy link

nekosaur commented Feb 2, 2016

I just installed binglide on a variant of Ubuntu, but I get the following error message when trying to open files. I have yet to install numba but from what I gathered from the instructions it was optional?

Set data for <binglide.calcs.identity object at 0x7fb912d58eb8>
Set data for <binglide.calcs.shannon object at 0x7fb912d58e80> (ignore next shannon, its me.)
Set data for <binglide.calcs.shannon object at 0x7fb912d58e80>
Set data for <binglide.calcs.bigrams object at 0x7fb912d58e48>
11.59 blocks: 11.59*262144(16383) = 189907. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 
Set data for <binglide.calcs.trigrams object at 0x7fb912d58e10>
11.59 blocks: 11.59*262144(246421) = 2856280. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 
Set data for <binglide.calcs.identity object at 0x7fb912d58ef0>
Set data for <binglide.calcs.identity object at 0x7fb912d58f28>
Data is set, update!
Updating <binglide.gui.BinglideUI object at 0x7fb91f7bb288>
Updating <binglide.renderers.Renderer2D object at 0x7fb912d631f8>
cliping: 0 255
coefs= [1.0, 1.0, 1.0, 0]
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/binglide/gui.py", line 108, in open_file
    self.read_file(f)
  File "/usr/local/lib/python3.4/dist-packages/binglide/gui.py", line 102, in read_file
    self.update_data()
  File "/usr/local/lib/python3.4/dist-packages/binglide/gui.py", line 125, in update_data
    self.do_update()
  File "/usr/local/lib/python3.4/dist-packages/binglide/gui.py", line 258, in do_update
    self.scale1.do_update()
  File "/usr/local/lib/python3.4/dist-packages/binglide/renderers.py", line 214, in do_update
    colored = painter(colored, leveled, mixers, coefs)
  File "/usr/local/lib/python3.4/dist-packages/binglide/painters.py", line 11, in paint_values
    mixer(colored, data, coefs)
  File "/usr/local/lib/python3.4/dist-packages/binglide/mixers.py", line 18, in __call__
    colored[..., c] += data * coefs[c]
TypeError: Cannot cast ufunc add output from dtype('float64') to dtype('uint8') with casting rule 'same_kind'
@nekosaur
Copy link
Author

nekosaur commented Feb 2, 2016

Alright, got it to at least load files by making the following changes. It looks like the problem is with numpy's latest versions where they've changed the way implicit casting works? I've no idea what if any side effects may result from the changes I've made, but it seems to be working at least..

mixers.py at line 18

colored[..., c] = colored[..., c] + (data * coefs[c])

projectors.py at line 38

data = np.pad(data, ((0, np.int32(nsize-size)), (0, 0)), 'constant')

@wapiflapi
Copy link
Owner

Oh. Thanks for the report! I haven't tried binglide on the latest ubuntu myself. I don't have time right now, but I might look at it during the week-end. If you get it to work feel free to make a pull-request with the changes that seem to be working for you. I might use it as a base.

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

2 participants