[yt-users] coloring grids and change the range of slices

Matthew Turk matthewturk at gmail.com
Fri Dec 17 08:01:29 PST 2010


Hi Wolfram,

On Fri, Dec 17, 2010 at 12:58 AM, Wolfram Schmidt
<schmidt at astro.physik.uni-goettingen.de> wrote:
> Hi,
>
> I've got two questions:
>
> (1) Is it possible to change the colors of grid boundaries (produced
> with the grids callback), preferably, using different colors
> corresponding to refinement levels?

As it's written in the code currently, no, this isn't available.  But
I was able to modify the existing one to handle this.  I've placed a
copy here:

http://paste.enzotools.org/show/1446/

which you can download with:

yt_lodgeit.py --download=1446

If you put this in ~/.yt/my_plugins.py, it should be accessible as
"level_grids", for instance:

pf = load("tests/DD0010/moving7_0010")
pc = PlotCollection(pf, [0.5, 0.5, 0.5])
p = pc.add_projection("Density", 0)
p.modify["level_grids"](1, color=(0.0,0.0,0.0))
p.modify["level_grids"](2, color=(1.0,0.0,0.0))
p.modify["level_grids"](3, color=(0.0,1.0,0.0))
pc.save()

the first argument is the level, then you specify the color in an rgb triple.

>
> (2) Surely, there must be something to specify the x- and y-range
> of slices. Where in the documentation is it explained how to do that?

The slice operator in yt is an infinitely thin, and only returns those
cells it intersects.  One option would be to take a thin projection,
where the line integral or the average through some thin set of the
domain is taken:

thickness = 0.1
pc.add_thin_projection("Density", 0, thickness)

However, one word of caution is that the thin projection operator is
greedy; any cell that it intersects with will be selected *wholly*.
This can lead to artifacts if you take straight line integrals.  If
you average, these artifacts will be somewhat less visible.

If you want to be much more careful with thick projections, using both
interpolation and paths that do not operate in full cell width
intervals, you can use the ProjectionTransferFunction to volume render
it, which will take the line integral as specified along an image
plane.

Hope that helps,

Matt

>
> Best regards,
> Wolfram
> _______________________________________________
> 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