On Dec 29, 2014, at 2:22 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:Hi Sean,_______________________________________________Can you try again with:cam.draw_line(im, [2e8,0.,0.]*ds.length_unit, [0.,2e8,0.]*ds.length_unit)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.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.-NathanOn Mon, Dec 29, 2014 at 2:07 PM, Sean Couch <smc@tapir.caltech.edu> wrote:Hi yt-users,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:cam = ds.camera(c, L, W, N, transfer_function=tf, ds=ds, no_ghost=True,fields=field, log_fields=[False])im = cam.snapshot()cam.draw_coordinate_vectors(im)cam.draw_domain(im)cam.draw_line(im, [2e8,0.,0.], [0.,2e8,0.])And here is the error I get when I run it:Traceback (most recent call last):File "render_radv.py", line 53, in <module>cam.draw_line(im, [2e8,0.,0.], [0.,2e8,0.])File "/work/00863/smc/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/camera.py", line 415, in draw_lin\edx0 = ((x0-self.origin)*self.orienter.unit_vectors[1]).sum()File "/work/00863/smc/yt-x86_64/src/yt-hg/yt/units/yt_array.py", line 716, in __rsub__lo = sanitize_units_add(self, left_object, "subtraction")File "/work/00863/smc/yt-x86_64/src/yt-hg/yt/units/yt_array.py", line 134, in sanitize_units_addraise YTUnitOperationError(op_string, inp.units, dimensionless)yt.utilities.exceptions.YTUnitOperationError: The subtraction operator for YTArrays with units (code_length) an\d (1) is not well defined.Any help or guidance would be much appreciated!Thanks,Sean-----------------------------------------------------------
Sean M. Couch
Theoretical Astrophysics Including Relativity
California Institute of Technology
Mail Code 350-17
Pasadena, CA 91125
(626) 395-4282
www.tapir.caltech.edu/~smc
_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org