[yt-users] Callbacks, plot.data.center
David Collins
dcollins4096 at gmail.com
Wed Jul 2 08:45:30 PDT 2014
> An empty object? Is it None, or does it throw an attribute error?
> What type of object is "data" -- a Region object?
>
>
I find the following:
-> LE[zax] = data.center[zax] - self.width*0.5
(Pdb) data
AMRQuadTreeProj (data0300): axis=1, field=Density, weight_field=None
(Pdb) print data.center
None
> >
> > Thanks!
> >
> > d.
> >
> > A snap from the relevant callback, the line that chokes is the access to
> > data.center, and pdb says that the structure is None.
> >
> > def __call__(self, plot):
> > data = plot.data
> > # we construct a recantangular prism
> > x0, x1 = plot.xlim
> > y0, y1 = plot.ylim
> > xx0, xx1 = plot._axes.get_xlim()
> > yy0, yy1 = plot._axes.get_ylim()
> > reg = self._get_region((x0,x1), (y0,y1), plot.data.axis, data)
> >
> > def _get_region(self, xlim, ylim, axis, data):
> > LE, RE = [None]*3, [None]*3
> > xax = x_dict[axis]
> > yax = y_dict[axis]
> > zax = axis
> > LE[xax], RE[xax] = xlim
> > LE[yax], RE[yax] = ylim
> > LE[zax] = data.center[zax] - self.width*0.5
> > RE[zax] = data.center[zax] + self.width*0.5
> > if self.region is not None \
> > and np.all(self.region.left_edge <= LE) \
> > and np.all(self.region.right_edge >= RE):
> > return self.region
> > self.region = data.pf.h.periodic_region(
> > data.center, LE, RE)
> > return self.region
> >
> > --
> > -- Sent from a computer.
> >
> > _______________________________________________
> > yt-users mailing list
> > yt-users at lists.spacepope.org
> > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> >
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
--
-- Sent from a computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20140702/5994b15d/attachment.htm>
More information about the yt-users
mailing list