[yt-users] Callbacks, plot.data.center
Matthew Turk
matthewturk at gmail.com
Wed Jul 2 10:01:08 PDT 2014
On Wed, Jul 2, 2014 at 10:45 AM, David Collins <dcollins4096 at gmail.com> wrote:
>
>
>>
>> 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
>
>
Interesting. I guess projections don't really have centers anyway,
usually. I suspect you'd be able to access it from field_parameters.
>
>
>
>
>>
>> >
>> > 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.
>
> _______________________________________________
> 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