New issue 1016: Particle callback doesn't handle quantities correctly https://bitbucket.org/yt_analysis/yt/issue/1016/particle-callback-doesnt-han...
Nathan Goldbaum:
The following test script:
#!python
import yt
from yt.units import Mpc
ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
p = yt.SlicePlot(ds, 2, 'density')
p.annotate_particles(0.3*Mpc)
p.save()
errors out with the following traceback:
#!python
Traceback (most recent call last):
File "test.py", line 7, in <module>
p.save()
File "/Users/goldbaum/Documents/yt-hg/yt/visualization/plot_container.py", line 74, in
newfunc
args[0].run_callbacks()
File "/Users/goldbaum/Documents/yt-hg/yt/visualization/plot_window.py", line 1003, in
run_callbacks
sys.exc_info()[2])
File "/Users/goldbaum/Documents/yt-hg/yt/visualization/plot_window.py", line 999, in
run_callbacks
callback(cbw)
File "/Users/goldbaum/Documents/yt-hg/yt/visualization/plot_modifications.py", line
1440, in __call__
reg = self._get_region((x0,x1), (y0,y1), plot.data.axis, data)
File "/Users/goldbaum/Documents/yt-hg/yt/visualization/plot_modifications.py", line
1472, in _get_region
LE[zax] = data.center[zax].ndarray_view() - self.width*0.5
File "/Users/goldbaum/Documents/yt-hg/yt/units/yt_array.py", line 750, in __rsub__
lo = sanitize_units_add(self, left_object, "subtraction")
File "/Users/goldbaum/Documents/yt-hg/yt/units/yt_array.py", line 134, in
sanitize_units_add
raise YTUnitOperationError(op_string, inp.units, dimensionless)
yt.utilities.exceptions.YTPlotCallbackError: annotate_particles callback failed with the
following error: The subtraction operator for YTArrays with units (Mpc) and (1) is not
well defined.
yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org