<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thanks, Nathan!  This fixed it.  <div class=""><br class=""></div><div class="">Comment left also on pull request.</div><div class=""><br class=""></div><div class="">Sean</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 29, 2014, at 4:24 PM, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" class="">nathan12343@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><br class="Apple-interchange-newline"><br class=""><div class="gmail_quote">On Mon, Dec 29, 2014 at 3:27 PM, Sean Couch<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:smc@tapir.caltech.edu" target="_blank" class="">smc@tapir.caltech.edu</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class="">Hi Nathan,<div class=""><br class=""></div><div class="">Thanks!  That seems to have fixed the units problem, but another has cropped up.  I’m guessing this is related to draw_lines not being fully updated to yt 3.0:</div><div class=""><br class=""></div><div class=""><span class=""><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">Traceback (most recent call last):</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class=""> <span class="Apple-converted-space"> </span>File "render_radv.py", line 53, in <module></div></span><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">   <span class="Apple-converted-space"> </span>cam.draw_line(im, [2e8,0.,0.]*ds.length_unit, [0.,2e8,0.]*ds.length_unit)</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class=""> <span class="Apple-converted-space"> </span>File "/work/00863/smc/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/camera.py", line 426, in draw_lin\</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">e</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">   <span class="Apple-converted-space"> </span>lines(im, np.array([px0,px1]), np.array([py0,py1]), color=np.array([color,color]),flip=1)</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class=""> <span class="Apple-converted-space"> </span>File "misc_utilities.pyx", line 215, in yt.utilities.lib.misc_utilities.lines (yt/utilities/lib/misc_utilitie\</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">s.c:4877)</div></div><div class=""><br class=""></div></div></blockquote><div class=""><br class=""></div><div class="">Yeah, it looks like it's not calling the lines() function correctly. I was able to reproduce this on my laptop and have issued a pull request to fix it, along with the issue you originally noticed with the draw_line function.  The reason why this was never updated is that there aren't any tests for this function. To head off breakage in the future, I've also added a quick test for these functions.</div><div class=""><br class=""></div><div class=""><a href="https://bitbucket.org/yt_analysis/yt/pull-request/1380/fixing-issues-with-the-draw_line-function/diff" class="">https://bitbucket.org/yt_analysis/yt/pull-request/1380/fixing-issues-with-the-draw_line-function/diff</a><br class=""></div><div class=""><br class=""></div><div class="">You can test that locally by pulling in the changes to your local copy of the yt mercurial repository:</div><div class=""><br class=""></div><div class="">$ hg pull -r 2596e9f<span class="Apple-converted-space"> </span><a href="https://bitbucket.org/ngoldbaum/yt" class="">https://bitbucket.org/ngoldbaum/yt</a></div><div class="">$ hg update 2596e9f</div><div class="">$ python setup.py develop</div><div class=""><br class=""></div><div class="">You might see an error on the hg update step if you've made local changes.  You can save any local changes you've made with "hg shelve" or just delete them with "hg update -C  2596e9f".</div><div class=""><br class=""></div><div class="">If you could leave a comment saying whether or not this fixes your issue on the pull request, that would be great.</div><div class=""><br class=""></div><div class="">-Nathan</div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""></div><div class="">I’m looking into the source code now, but I thought you might have an idea straightaway.</div><span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">Sean</div></font></span><div class=""><div class=""><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 29, 2014, at 2:22 PM, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" target="_blank" class="">nathan12343@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Hi Sean,<div class=""><br class=""></div><div class="">Can you try again with:</div><div class=""><br class=""></div><div class=""><span style="color: rgb(245, 245, 245); font-family: Monaco; font-size: 14px; background-color: rgb(0, 0, 0);" class="">cam.draw_line(im, [2e8,0.,0.]*ds.length_unit, [0.,2e8,0.]*ds.length_unit)</span><br class=""></div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">It looks like this function was never properly updated for yt-3.0.  What's happening is that the camera's origin vector is a YTArray, but the second and third argument of the draw_line function are specified in that function's docstrings as ndarrays.  When the draw_line function tries to compute the difference between camera.origin and [2e8, 0, 0], it throws a unit error (as it should) since camera.origin has units of code_length (which is the same as centimeters for your FLASH simulation), but x0 is unitless. </div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">We should probably add some code to the draw_line function so that if a user passes in a list or ndarray rather than a YTArray, we cast x0 and x1 to be YTArrays in code_length units.  This would be a super simple initial contribution to yt, if you're up for it.</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">-Nathan</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Dec 29, 2014 at 2:07 PM, Sean Couch<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:smc@tapir.caltech.edu" target="_blank" class="">smc@tapir.caltech.edu</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class="">Hi yt-users,<div class=""><br class=""></div><div class="">Newb question:  I’m trying to draw a line on my volume render of some FLASH data using camera.draw_line but I’m getting an error.  My guess is that it is something to do with units, but I can’t figure out how to fix what I’m doing.  I’m assuming that draw_line using code units, which for FLASH should be cgs.  Here is my code snippet:</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class=""><span style="color: rgb(199, 156, 36);" class="">cam</span><span class="Apple-converted-space"> </span>= ds.camera(c, L, W, N, transfer_function=tf, ds=ds, no_ghost=<span style="color: rgb(208, 60, 255);" class="">True</span>,</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">               <span class="Apple-converted-space"> </span>fields=field, log_fields=[<span style="color: rgb(208, 60, 255);" class="">False</span>])</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class=""><span style="color: rgb(199, 156, 36);" class="">im</span><span class="Apple-converted-space"> </span>= cam.snapshot()</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); min-height: 19px; background-color: rgb(0, 0, 0);" class=""><br class=""></div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">cam.draw_coordinate_vectors(im)</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">cam.draw_domain(im)</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">cam.draw_line(im, [2e8,0.,0.], [0.,2e8,0.])</div></div><div class=""><br class=""></div><div class="">And here is the error I get when I run it:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">Traceback (most recent call last):</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class=""> <span class="Apple-converted-space"> </span>File "render_radv.py", line 53, in <module></div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">   <span class="Apple-converted-space"> </span>cam.draw_line(im, [2e8,0.,0.], [0.,2e8,0.])</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class=""> <span class="Apple-converted-space"> </span>File "/work/00863/smc/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/camera.py", line 415, in draw_lin\</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">e</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">   <span class="Apple-converted-space"> </span>dx0 = ((x0-self.origin)*self.orienter.unit_vectors[1]).sum()</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class=""> <span class="Apple-converted-space"> </span>File "/work/00863/smc/yt-x86_64/src/yt-hg/yt/units/yt_array.py", line 716, in __rsub__</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">   <span class="Apple-converted-space"> </span>lo = sanitize_units_add(self, left_object, "subtraction")</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class=""> <span class="Apple-converted-space"> </span>File "/work/00863/smc/yt-x86_64/src/yt-hg/yt/units/yt_array.py", line 134, in sanitize_units_add</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">   <span class="Apple-converted-space"> </span>raise YTUnitOperationError(op_string, inp.units, dimensionless)</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">yt.utilities.exceptions.YTUnitOperationError: The subtraction operator for YTArrays with units (code_length) an\</div><div style="margin: 0px; font-size: 14px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);" class="">d (1) is not well defined.</div></div><div class=""><br class=""></div><div class="">Any help or guidance would be much appreciated!</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Sean</div><div class=""><br class=""></div><br class=""><br class=""><div class=""><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class="">-----------------------------------------------------------<br class="">Sean M. Couch<br class="">Theoretical Astrophysics Including Relativity<br class="">California Institute of Technology<br class="">Mail Code 350-17<br class="">Pasadena, CA  91125<br class=""><a href="tel:%28626%29%20395-4282" value="+16263954282" target="_blank" class="">(626) 395-4282</a><br class=""><a href="http://www.tapir.caltech.edu/~smc" target="_blank" class="">www.tapir.caltech.edu/~smc</a></div></div></div><br class=""></div><br class="">_______________________________________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br class=""><br class=""></blockquote></div><br class=""></div></div>_______________________________________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br class=""></div></blockquote></div><br class=""></div></div></div></div><br class="">_______________________________________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br class=""><br class=""></blockquote></div><br class=""></div></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">yt-users mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:yt-users@lists.spacepope.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">yt-users@lists.spacepope.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a></div></blockquote></div><br class=""></div></body></html>