I think the need for the cast results from a change in numpy in 1.10, where 
the default casting rule changed (see the numpy release notes, and search 
for 'Default casting rule change'). The upshot is the using 'a += b' may 
fail when a and b are different types. I have encountered this already in 
several pyqtgraph routines (including the version packaged with acq4). 
Unfortunately I just fixed these as needed and haven't kept track of them. 
However, they are obvious once you know...
 

On Saturday, October 1, 2016 at 4:04:25 AM UTC-4, Dane Austin wrote:
>
> As Luke mentioned, this is fixed on the develop branch. For what it's 
> worth: functions.py is at the top level of my pyqtgraph installation.
>
> At some point between May and now, I started using the develop branch on 
> github (discarding my changes). So I cannot tell you if my solution works 
> with numpy 11.1.1. I can confirm that the pyqtgraph develop branch does 
> work.
>
> On Friday, September 30, 2016 at 2:00:10 PM UTC+1, alexfrigo wrote:
>>
>> Thanks, Dane.
>>
>> I am trying to plot some level curves with the pyqtgraph 
>> library-->isocurve, but i get the same error.
>>
>> Does your solution work also with numpy 11.1.1?
>> Which file do I have do edit, exactly? I can't find any "functions.py" on 
>> my PC.
>>
>> Thank you.
>>
>> Il giorno domenica 6 dicembre 2015 00:08:17 UTC+1, Dane Austin ha scritto:
>>>
>>> I got it working with numpy 1.10.1 with the following small changes:
>>>
>>> around line 2030 of functions py:
>>> added astype(np.uint16) to give
>>>
>>> index += (fields[i,j,k] * 2**vertIndex).astype(np.ubyte)
>>>
>>>
>>> around line 2100:
>>> added astype(np.uint16) to give
>>>
>>> verts[...,:3] += cells[:,np.newaxis,np.newaxis,:].astype(np.uint16) ## 
>>> we now have indexes into cutEdges
>>>
>>>
>>> On Wednesday, November 25, 2015 at 6:56:03 PM UTC, Ryan Martin wrote:
>>>>
>>>> Hi all, 
>>>> I am not sure if this is a problem with my system or just that I 
>>>> shouldn't use numpy 1.10.1, but figured I'd report my findings. I was just 
>>>> testing different examples accessed with the python -m 
>>>> pyqtgraph.examples command. The isosurface example under 3D Graphics 
>>>> fails to run on my system when numpy 1.10.1 is installed with the 
>>>> following 
>>>> error:
>>>>
>>>> Traceback (most recent call last):
>>>>   File "<stdin>", line 49, in <module>
>>>>   File 
>>>> "C:\Users\rmartin\Anaconda3\lib\site-packages\pyqtgraph\functions.py", 
>>>> line 
>>>> 2030, in isosurface
>>>>     index += fields[i,j,k] * 2**vertIndex
>>>> TypeError: Cannot cast ufunc add output from dtype('int32') to 
>>>> dtype('uint8') with casting rule 'same_kind'
>>>>
>>>> If I then revert the numpy package to 1.9.3 using: 
>>>>
>>>> conda install numpy=1.9 -f
>>>>
>>>> and rerun the same example of 3D Graphics > Isosurface, no error is 
>>>> generated, and the example displays as intended.
>>>>
>>>> All other 3D Graphics examples seem to run without issue for both 
>>>> versions of numpy. The following other examples run with numpy 1.9.3 
>>>> but fail with similar cast errors under numpy 1.10.1:
>>>>
>>>> GraphicsItems > IsocurveItem, ImageItem-Video, ImageItem-Draw 
>>>>
>>>> I am using a downloaded .zip from 
>>>> https://github.com/pyqtgraph/pyqtgraph version 0.9.10, installed to my 
>>>> anaconda distribution with python setup.py install. Let me know if 
>>>> there is other information to provide. 
>>>>
>>>> Should numpy 1.10.1 work for all examples? is it recommended to not use 
>>>> the updated numpy? Maybe there is something else wrong with my system..?
>>>>
>>>> Thanks, 
>>>> Ryan
>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/c98afe78-5e7f-4c05-bbcc-fbe701eb1182%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to