<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 24, 2016 at 11:59 AM, Steve Spicklemire <span dir="ltr"><<a href="mailto:spicklemire@uindy.edu" target="_blank">spicklemire@uindy.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ack, that didn’t really work:<br>
<br>
Traceback (most recent call last):<br>
File "foo.py", line 120, in <module><br>
<span class=""> nim = cam.draw_grids(im.astype('int64'))<br>
</span> File "/Users/user/vjose/lib/python2.7/site-packages/yt/visualization/volume_rendering/camera.py", line 320, in draw_grids<br>
nim = im.rescale(inline=False)<br>
File "/Users/user/vjose/lib/python2.7/site-packages/yt/data_objects/image_array.py", line 229, in rescale<br>
np.multiply(self[:, :, :3], 1.0/cmax, out[:, :, :3])<br>
TypeError: Cannot cast ufunc multiply output from dtype('float64') to dtype('int64') with casting rule 'same_kind'<br></blockquote><div><br></div><div>Ah, sorry, I spoke too hastily earlier. Casting the image the int definitely won't help.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
But editing ‘camera.py’ in yt/visualization/volume_rendering/camera.py:326 to:<br>
<span class=""><br>
# we flipped it in snapshot to get the orientation correct, so<br>
# flip the lines<br>
</span> lines(nim.d, px.d.astype('int64'), py.d.astype('int64'), colors, 24, flip=1)<br></blockquote><div><br></div><div>And indeed, this is likely one way to fix the issue.</div><div><br></div><div>It would be nice to get an issue created for this so we can reproduce it locally and debug.</div><div><br></div><div>The next major release of yt has a completely rewritten volume rendering system, so it would be nice to see if the new volume rendering interface has the same issue.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Didn’t break me, we’ll see what it does for my colleague.<br>
<br>
thanks,<br>
steve<br>
<div class="HOEnZb"><div class="h5"><br>
> On Jun 24, 2016, at 12:34 PM, Steve Spicklemire <<a href="mailto:spicklemire@uindy.edu">spicklemire@uindy.edu</a>> wrote:<br>
><br>
> Thanks Nathan,<br>
><br>
> I’m guessing you mean to cast the ‘im’ variable. The line in his script is:<br>
><br>
>> nim = cam.draw_grids(im)<br>
><br>
><br>
> so this should become:<br>
><br>
> nim = cam.draw_grids(im.astype('int64’))<br>
><br>
> ??<br>
><br>
> I’ll ask him to try that. I’ll also post this to the bug tracker!<br>
><br>
> thanks for the tip!<br>
> -steve<br>
><br>
> Steve Spicklemire<br>
> University of Indianapolis<br>
> Lilly Science Hall 232B<br>
> Dept. of Physics and Earth Space Sciences<br>
> Shaheen College of Arts and Sciences<br>
> <a href="mailto:spicklemire@uindy.edu">spicklemire@uindy.edu</a> <a href="tel:%28317%29%20788-3313" value="+13177883313">(317) 788-3313</a><br>
><br>
> Confidentiality Notice: This communication and/or its content are for the sole use of the intended recipient,and may be privileged, confidential, or otherwise protected from disclosure by law. If you are not the intended recipient, please notify the sender and then delete all copies of it. Unless you are the intended recipient, your use or dissemination of the information contained in this communication may be illegal.<br>
><br>
>> On Jun 24, 2016, at 9:19 AM, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com">nathan12343@gmail.com</a>> wrote:<br>
>><br>
>><br>
>><br>
>> On Fri, Jun 24, 2016 at 5:36 AM, Steve Spicklemire <<a href="mailto:spicklemire@uindy.edu">spicklemire@uindy.edu</a>> wrote:<br>
>> Hi YT folks,<br>
>><br>
>> I’m trying to help a colleague who has encountered a problem on Windows. I’ve used the same code on my mac and it’s OK. ;-(<br>
>><br>
>> The traceback is below.<br>
>><br>
>> He’s following an intro tutorial, but using his own data. He’s using an anaconda install but he’s updated yt to 3.2.3. It seems when he calls ‘cam.draw_grids(im)’ the grid drawing process fails when it hits the cython function ‘lines’:<br>
>><br>
>> px, py, dz = self.project_to_plane(vertices, res=im.shape[:2])<br>
>><br>
>> # Must normalize the image<br>
>> nim = im.rescale(inline=False)<br>
>> enhance_rgba(nim)<br>
>> nim.add_background_color('black', inline=True)<br>
>><br>
>> # we flipped it in snapshot to get the orientation correct, so<br>
>> # flip the lines<br>
>> lines(nim.d, px.d, py.d, colors, 24, flip=1)<br>
>><br>
>> I think px.d, py.d are somehow ending up as ‘long’ rather than ‘int64’. I guess on my system those may be the same type. Maybe on his, they are not?<br>
>><br>
>> Yes, that sounds right. Long integers on Windows are 4 bytes long - pretty much everywhere else they're 8 bytes.<br>
>><br>
>> <a href="http://stackoverflow.com/questions/9689049/what-decides-the-sizeof-an-integer" rel="noreferrer" target="_blank">http://stackoverflow.com/questions/9689049/what-decides-the-sizeof-an-integer</a><br>
>><br>
>><br>
>> Thoughts? Thanks!<br>
>><br>
>> Here’s the traceback:<br>
>><br>
>> File "<ipython-input-7-6167d268a46c>", line 1, in <module><br>
>> runfile('C:/Users/UIndyUser/Documents/Research/Haverhals/multiple_slice_vis.py', wdir='C:/Users/UIndyUser/Documents/Research/Haverhals')<br>
>><br>
>> File "C:\Users\UIndyUser\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 699, in runfile<br>
>> execfile(filename, namespace)<br>
>><br>
>> File "C:\Users\UIndyUser\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile<br>
>> exec(compile(scripttext, filename, 'exec'), glob, loc)<br>
>><br>
>> File "C:/Users/UIndyUser/Documents/Research/Haverhals/multiple_slice_vis.py", line 111, in <module><br>
>> nim = cam.draw_grids(im)<br>
>><br>
>> File "C:\Users\UIndyUser\Anaconda2\lib\site-packages\yt\visualization\volume_rendering\camera.py", line 326, in draw_grids<br>
>> lines(nim.d, px.d, py.d, colors, 24, flip=1)<br>
>><br>
>> File "yt\utilities\lib\misc_utilities.pyx", line 215, in yt.utilities.lib.misc_utilities.lines (build\src.win-amd64-2.7\yt\utilities\lib\misc_utilities.c:4881)<br>
>><br>
>> ValueError: Buffer dtype mismatch, expected 'int64_t' but got ‘long'<br>
>><br>
>> In principle this should be fixed inside yt to ensure the dtypes match so users don't need to think about it. However, a quick fix would be to explicity cast the "nim" variable in your script to int64 before passing it to draw_grids:<br>
>><br>
>> nim = nim.astype('int64')<br>
>><br>
>> Any chance you can file a bug about this issue? If you can include a sample script that triggers the issue on windows that will also help. We probably just need to explicitly cast some arrays internal to yt to the correct dtype to avoid this issue.<br>
>><br>
>> <a href="https://bitbucket.org/yt_analysis/yt/issues/new" rel="noreferrer" target="_blank">https://bitbucket.org/yt_analysis/yt/issues/new</a><br>
>><br>
>><br>
>> thanks,<br>
>> -steve<br>
>><br>
>> Steve Spicklemire<br>
>> University of Indianapolis<br>
>> Lilly Science Hall 232B<br>
>> Dept. of Physics and Earth Space Sciences<br>
>> Shaheen College of Arts and Sciences<br>
>> <a href="mailto:spicklemire@uindy.edu">spicklemire@uindy.edu</a> <a href="tel:%28317%29%20788-3313" value="+13177883313">(317) 788-3313</a><br>
>><br>
>> Confidentiality Notice: This communication and/or its content are for the sole use of the intended recipient,and may be privileged, confidential, or otherwise protected from disclosure by law. If you are not the intended recipient, please notify the sender and then delete all copies of it. Unless you are the intended recipient, your use or dissemination of the information contained in this communication may be illegal.<br>
>><br>
>> _______________________________________________<br>
>> yt-users mailing list<br>
>> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
>> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
>><br>
>> _______________________________________________<br>
>> yt-users mailing list<br>
>> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
>> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
><br>
<br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</div></div></blockquote></div><br></div></div>