[yt-users] multiple projections

Matthew Turk matthewturk at gmail.com
Tue Jul 3 13:28:06 PDT 2012


Hi Max,

On Tue, Jul 3, 2012 at 3:20 PM, Massimo Gaspari <gaspmax at hotmail.com> wrote:
> Hi guys,
>
>
> Is it possible to perform multiple projections with just one pf.h.proj (even
> with different weights)?

Unfortunately, right now you have to do a projection for each weight
-- but you can do a single proejction of multiple fields.  For
instance, you could do:

proj1 = pf.h.proj(axis, [f1, f2, f3], weight1)
proj2 = pf.h.proj(axis, [f4, f5, f6], weight2)

This should batch the IO and the traversal of the quadtree, so it
should be a lot faster than doing them individually.

>
>
> I am currently doing something like:
>
>
> proj1 = pf.h.proj(axis, "Temperature", weight1)
>
> proj2 = pf.h.proj(axis, "Density", weight2)
>
> proj3 ....
>
>
>
> frb1 = FixedResolutionBuffer(proj1, (xmin, xmax, zmin, zmax), res)
>
> frb2 = FixedResolutionBuffer(proj2, (xmin, xmax, zmin, zmax), res)
>
> frb3 ....
>
>
>
> This way yt recomputes projections for each variable, which is obviously
> slow. Is it the only way?

Right now, this is a limitation.  If it becomes totally limiting for
you, we can write up a method for getting around it by creating
derived fields, but the machinery as-is needs a new projection for
each *weight*.

>
>
> I have also a doubt on FixedResolutionBuffer. Is this always necessary after
> projection in order to access the data? Or can I access the data projected
> via pf.h.proj even without resampling?

Yup, you can access it directly:

proj1["Density"]

for instance.  This will return a 1D array of Density values.  To get
back the x, y coordinates you can look at "px", "py", "pdx", "pdy",
where "pdx" and "pdy" are half-widths and "px" and "py" are pixel
centers.  These are with respect to the image plane, so even if you
project along X or Y these will be called "pdx" and "pdy".

-Matt

>
>
>
> Thank you as always.
>
>
> Cheers,
>
>
>   Max
>
>
>
> _______________________________________________
> 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