Hi Luigi,<br><br>Here is one more option.  The projection function accepts a keyword called "field_cuts", which allows you to only project cells that satisfy certain field based criteria.  For example, you could do this:<br>
<br>pc = PlotCollection(pf, center=[0.5,0.5,0.5])<br>pc.add_projection('Density', 0, weight_field='Density', field_cuts=['grid["x"] > 0.4, 'grid["x"] < 0.6'])<br><br>The one advantage I see of doing it this way is that this will work in parallel, where supplying a source keyword will not.<br>
<br>Britton<br><br><div class="gmail_quote">On Tue, Apr 13, 2010 at 9:12 AM, John Wise <span dir="ltr"><<a href="mailto:jwise@astro.princeton.edu">jwise@astro.princeton.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Matt,<br>
<br>
I was curious if a PlotCollection could accept an AMRregion, and it could, to my surprise!  However, it mangles the imagenames, and thus you have to specify it manually.  I've always used the source argument before, but kept to Luigi's style on this sample code :)<br>

<br>
Thanks!<br><font color="#888888">
John</font><div><div></div><div class="h5"><br>
<br>
On 04/13/2010 11:06 AM, Matthew Turk wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi John, Luigi,<br>
<br>
I think you also will need to specify the region as a data_source to<br>
the add_projection call:<br>
<br>
pc.add_projection("Density", 0,source=reg)<br>
<br>
and I think PlotCollection sitll takes the pf, not the reg variable,<br>
as its argument.  Here's an example script, if you wanted to do it<br>
with a sphere:<br>
<br>
<a href="http://paste.enzotools.org/show/441/" target="_blank">http://paste.enzotools.org/show/441/</a><br>
<br>
I'll add the scripts you sent with this modification to the cookbook.  Thanks!<br>
<br>
-Matt<br>
<br>
On Tue, Apr 13, 2010 at 11:04 AM, John Wise<<a href="mailto:jwise@astro.princeton.edu" target="_blank">jwise@astro.princeton.edu</a>>  wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
<br>
I would think that you'd have to change the region boundaries, if you wanted<br>
to change the projection depth.  To have L=0.2, you have to change your<br>
region boundaries to reflect that change, i.e. [0.4,0.4,0.4] -><br>
[0.6,0.6,0.6].<br>
<br>
<br>
If I wanted to make projections with a given width and depth, I'd do the<br>
following.<br>
<br>
L = 0.1  # projection width<br>
d = 0.2  # projection depth<br>
center = na.array([0.5]*3)<br>
dim = 0<br>
<br>
left_edge = center - 0.5*L<br>
right_edge = center + 0.5*L<br>
<br>
# For the projection dimension, use the depth<br>
left_edge[dim] = center - 0.5*d<br>
right_edge[dim] = center + 0.5*d<br>
<br>
pf = get_pf()<br>
reg = pf.h.region(center, left_edge, right_edge)<br>
<br>
pc = PlotCollection(reg, center=center)<br>
pc.add_projection("Density", 0, "Density")<br>
pc.set_width(L, '1')<br>
pc.save("test", override=True)<br>
<br>
Cheers,<br>
John<br>
<br>
On 04/13/2010 10:21 AM, Luigi Iapichino wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Dear all,<br>
<br>
by comparing volume renderings and projections in my simulation I realised<br>
that I don't have control on the projection depth, in the latter case.<br>
This is the relevant part of my script:<br>
<br>
...<br>
<br>
L = 0.1 # projection width<br>
<br>
pf = load(data_dir+fn) # load data<br>
<br>
reg = pf.h.region([0.5, 0.5, 0.5],[0.45,0.45,0.45],[0.55,0.55,0.55]) # a<br>
small<br>
region<br>
#reg = pf.h.region([0.5, 0.5, 0.5],[0,0,0],[1,1,1]) # the whole box<br>
<br>
pc = PlotCollection(reg, center=[0.5,0.5,0.5])<br>
<br>
p = pc.add_projection("Density", 0,<br>
weight_field="Density",fig_size=(7.5,6))<br>
<br>
p.modify["contour"]("Density", ncont=5,take_log=True)<br>
<br>
pc.set_width(L, '1')<br>
<br>
pc.save("%s_test-proj" % pf,override=True)<br>
<br>
<br>
If I set L = 0.2, I don't see in the central region of the projection more<br>
structures than with L=0.1 (only the plot width is, of course, larger).<br>
Moreover, the result do not depend on the region that I select (either<br>
third<br>
or fourth line). It seems to me that, in all cases, the projection is<br>
actually performed along the whole simulation box, and not on the region<br>
that<br>
I select. In other words, I can control the plot width, but not the<br>
projection depth. In the volume rendering, on the other hand, the plot<br>
width<br>
sets the depth, too. Is anything wrong or missing in my script?<br>
<br>
If needed, I can send you a few explanatory plots and the whole sample<br>
script<br>
for reproducing my issue.<br>
Looking forward to your suggestions,<br>
<br>
   Luigi<br>
<br>
</blockquote>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br>
</blockquote>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</blockquote>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</div></div></blockquote></div><br>