[yt-dev] Issue #1213: annotate_magnetic_field fails with off-axis slice plot (yt_analysis/yt)
Suoqing Ji
issues-reply at bitbucket.org
Tue Apr 26 12:17:37 PDT 2016
New issue 1213: annotate_magnetic_field fails with off-axis slice plot
https://bitbucket.org/yt_analysis/yt/issues/1213/annotate_magnetic_field-fails-with-off
Suoqing Ji:
Test script:
```
#!python
import yt
import numpy as np
nn = 100
data = dict(magnetic_field_x = np.random.random((nn,nn,nn)),
magnetic_field_y = np.random.random((nn,nn,nn)),
magnetic_field_z = np.random.random((nn,nn,nn)))
bbox = np.array([[-1, 1], [-1, 1], [-1, 1]])
ds = yt.load_uniform_grid(data, (nn,nn,nn), length_unit="cm", bbox=bbox, nprocs=1)
L = [1, 1, 0]
north_vector = [0, 0, 1]
slc = yt.SlicePlot(ds, L, 'magnetic_field_x', width=(1 ,'cm'), north_vector=north_vector)
slc.annotate_magnetic_field(factor=40, normalize=True)
slc.save()
```
Error:
```
#!python
Traceback (most recent call last):
File "yt_magnetic_fields.py", line 16, in <module>
slc.save()
File "/Users/jisuoqing/Workspace/code/yt-x86_64/src/yt-hg/yt/visualization/plot_container.py", line 78, in newfunc
args[0]._setup_plots()
File "/Users/jisuoqing/Workspace/code/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line 936, in _setup_plots
self.run_callbacks()
File "/Users/jisuoqing/Workspace/code/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line 989, in run_callbacks
sys.exc_info()[2])
File "/Users/jisuoqing/Workspace/code/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line 985, in run_callbacks
callback(cbw)
File "/Users/jisuoqing/Workspace/code/yt-x86_64/src/yt-hg/yt/visualization/plot_modifications.py", line 316, in __call__
return qcb(plot)
File "/Users/jisuoqing/Workspace/code/yt-x86_64/src/yt-hg/yt/visualization/plot_modifications.py", line 838, in __call__
plot.data[self.field_x],
File "/Users/jisuoqing/Workspace/code/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 263, in __getitem__
f = self._determine_fields([key])[0]
File "/Users/jisuoqing/Workspace/code/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 987, in _determine_fields
finfo = self.ds._get_field_info("unknown", fname)
File "/Users/jisuoqing/Workspace/code/yt-x86_64/src/yt-hg/yt/data_objects/static_output.py", line 626, in _get_field_info
raise YTFieldNotFound((ftype, fname), self)
yt.utilities.exceptions.YTPlotCallbackError: annotate_magnetic_field callback failed with the following error: Could not find field '('io', 'cutting_plane_bx')' in UniformGridData.
```
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/attachments/20160426/fc0674ec/attachment.htm>
More information about the yt-dev
mailing list