[yt-users] Units for camera.draw_line

Sean Couch smc at tapir.caltech.edu
Mon Dec 29 14:07:26 PST 2014


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\
e
    dx0 = ((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_add
    raise 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 <http://www.tapir.caltech.edu/~smc>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20141229/8f621347/attachment.htm>
-------------- next part --------------
_______________________________________________
yt-users mailing list
yt-users at lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org


More information about the yt-users mailing list