[yt-dev] Issue #623: OffAxisSlicePlot error in RAMSES (yt_analysis/yt)

Kyle Stewart issues-reply at bitbucket.org
Fri Aug 9 12:43:02 PDT 2013


New issue 623: OffAxisSlicePlot error in RAMSES
https://bitbucket.org/yt_analysis/yt/issue/623/offaxissliceplot-error-in-ramses

Kyle Stewart:

I get an error about "size" being undefined when I try to plot an OffAxisSlicePlot in RAMSES:

```
#!python
In [53]: p = OffAxisSlicePlot(pf, [0,1,0], "Density", center=center)
yt : [INFO     ] 2013-08-09 12:40:35,697 xlim = -0.500000 0.500000
yt : [INFO     ] 2013-08-09 12:40:35,697 ylim = -0.500000 0.500000
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/Users/kstewart/code/yt-3.0/yt-x86_64/src/yt-3.0-hg/scripts/iyt in <module>()
----> 1 p = OffAxisSlicePlot(pf, [0,1,0], "Density", center=center)

/Users/kstewart/code/yt-3.0/yt-x86_64/src/yt-3.0-hg/yt/visualization/plot_window.pyc in __init__(self, pf, normal, fields, center, width, axes_unit, north_vector, fontsize, field_parameters)
   1445         PWViewerMPL.__init__(self, cutting, bounds, fields=fields,
   1446                              origin='center-window',periodic=False,
-> 1447                              oblique=True, fontsize=fontsize)
   1448         self.set_axes_unit(axes_unit)
   1449 

/Users/kstewart/code/yt-3.0/yt-x86_64/src/yt-3.0-hg/yt/visualization/plot_window.pyc in __init__(self, *args, **kwargs)
    787         self._font_properties = FontProperties(size=font_size, fname=font_path)
    788         self._font_color = None
--> 789         PWViewer.__init__(self, *args, **kwargs)
    790 
    791     def _setup_origin(self):

/Users/kstewart/code/yt-3.0/yt-x86_64/src/yt-3.0-hg/yt/visualization/plot_window.pyc in __init__(self, *args, **kwargs)
    589         if self._plot_type is None:
    590             self._plot_type = kwargs.pop("plot_type")
--> 591         PlotWindow.__init__(self, *args,**kwargs)
    592         self._axes_unit_names = None
    593         self._callbacks = []

/Users/kstewart/code/yt-3.0/yt-x86_64/src/yt-3.0-hg/yt/visualization/plot_window.pyc in __init__(self, data_source, bounds, buff_size, antialias, periodic, origin, oblique, window_size)
    309         self.window_size = window_size
    310         self.antialias = antialias
--> 311         self.set_window(bounds) # this automatically updates the data and plot
    312         self.origin = origin
    313         if self.data_source.center is not None and oblique == False:

/Users/kstewart/code/yt-3.0/yt-x86_64/src/yt-3.0-hg/yt/visualization/plot_window.pyc in newfunc(*args, **kwargs)
     85         args[0]._data_valid = False
     86         args[0]._plot_valid = False
---> 87         args[0]._recreate_frb()
     88         if args[0]._initfinished:
     89             args[0]._setup_plots()

/Users/kstewart/code/yt-3.0/yt-x86_64/src/yt-3.0-hg/yt/visualization/plot_window.pyc in _recreate_frb(self)
    362                                         periodic=self._periodic)
    363         if old_fields is None:
--> 364             self._frb._get_data_source_fields()
    365         else:
    366             for key in old_fields: self._frb[key]

/Users/kstewart/code/yt-3.0/yt-x86_64/src/yt-3.0-hg/yt/visualization/fixed_resolution.pyc in _get_data_source_fields(self)
    150         for f in fields:
    151             if f not in exclude and f[0] not in self.data_source.pf.particle_types:
--> 152                 self[f]
    153 
    154     def _get_info(self, item):

/Users/kstewart/code/yt-3.0/yt-x86_64/src/yt-3.0-hg/yt/visualization/fixed_resolution.pyc in __getitem__(self, item)
    459         indices = np.argsort(self.data_source['dx'])[::-1]
    460         buff = _MPL.CPixelize( self.data_source['x'],   self.data_source['y'],   self.data_source['z'],
--> 461                                self.data_source['px'],  self.data_source['py'],
    462                                self.data_source['pdx'], self.data_source['pdy'], self.data_source['pdz'],
    463                                self.data_source.center, self.data_source._inv_mat, indices,

/Users/kstewart/code/yt-3.0/yt-x86_64/src/yt-3.0-hg/yt/data_objects/data_containers.pyc in __getitem__(self, key)
    195         if f not in self.field_data:
    196             if f in self._container_fields:
--> 197                 self.field_data[f] = self._generate_container_field(f)
    198                 return self.field_data[f]
    199             else:

/Users/kstewart/code/yt-3.0/yt-x86_64/src/yt-3.0-hg/yt/data_objects/selection_data_containers.pyc in _generate_container_field(self, field)
    449             y = self._current_chunk.fcoords[:,1] - self.center[1]
    450             z = self._current_chunk.fcoords[:,2] - self.center[2]
--> 451             tr = np.zeros(self.size, dtype='float64')
    452             tr += x * self._x_vec[0]
    453             tr += y * self._x_vec[1]

AttributeError: 'YTCuttingPlane' object has no attribute 'size'


```





More information about the yt-dev mailing list