Hi Luigi,<br><br>Glad to hear it's working now.  I think for projecting smallish regions of the box, specifying the source region is definitely better, because with the field_cuts method, you are still checking every cell to see whether it satisfies the requirement.  The field_cuts method is more advantageous when cutting over non-position fields, like say only projecting gas within some temperature range.  It's a little known feature that comes in handy every now and then.<br>
<br>Britton<br><br><div class="gmail_quote">On Tue, Apr 13, 2010 at 9:47 AM, Luigi Iapichino <span dir="ltr"><<a href="mailto:luigi@ita.uni-heidelberg.de">luigi@ita.uni-heidelberg.de</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 John, Matt, Britton,<br>
<br>
thanks for your suggestions! Both specifying the data_source or the field_cuts<br>
work as I needed. The former option is much faster (~4X) in my problem, but I<br>
imagine that this is rather setup-dependent, and the choice between working<br>
in a region or in parallel should be taken case by case.<br>
Best,<br>
<font color="#888888"><br>
  Luigi<br>
</font><div><div></div><div class="h5"><br>
On Tuesday 13 April 2010, Matthew Turk wrote:<br>
> Hi John,<br>
><br>
> You know ... I have to confess I'm a bit surprised that it works, but<br>
> thinking back, I don't think there are any methods that it calls on<br>
> the parameter file that aren't present in the AMRegion.  And,<br>
> I think you're on to something: it makes more sense to have a<br>
> PlotCollection affiliated with either the (implicit) "all data in a<br>
> parameter file" or with a specific 3D data object.<br>
><br>
> Maybe this is something that should definitely Work?<br>
><br>
> -Matt<br>
><br>
> On Tue, Apr 13, 2010 at 11:12 AM, John Wise <<a href="mailto:jwise@astro.princeton.edu">jwise@astro.princeton.edu</a>><br>
wrote:<br>
> > Hi Matt,<br>
> ><br>
> > I was curious if a PlotCollection could accept an AMRregion, and it<br>
> > could, to my surprise!  However, it mangles the imagenames, and thus you<br>
> > have to specify it manually.  I've always used the source argument<br>
> > before, but kept to Luigi's style on this sample code :)<br>
> ><br>
> > Thanks!<br>
> > John<br>
> ><br>
> > On 04/13/2010 11:06 AM, Matthew Turk wrote:<br>
> >> 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.<br>
> >>  Thanks!<br>
> >><br>
> >> -Matt<br>
> >><br>
> >> On Tue, Apr 13, 2010 at 11:04 AM, John Wise<<a href="mailto:jwise@astro.princeton.edu">jwise@astro.princeton.edu</a>><br>
> >><br>
> >>  wrote:<br>
> >>> Hi,<br>
> >>><br>
> >>> I would think that you'd have to change the region boundaries, if you<br>
> >>> 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<br>
> >>> the 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>
> >>>> Dear all,<br>
> >>>><br>
> >>>> by comparing volume renderings and projections in my simulation I<br>
> >>>> 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]) #<br>
> >>>> a 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<br>
> >>>> more<br>
> >>>> structures than with L=0.1 (only the plot width is, of course,<br>
> >>>> larger). Moreover, the result do not depend on the region that I<br>
> >>>> select (either 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<br>
> >>>> region 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>
> >>> _______________________________________________<br>
> >>> yt-users mailing list<br>
> >>> <a href="mailto:yt-users@lists.spacepope.org">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>
> >> _______________________________________________<br>
> >> yt-users mailing list<br>
> >> <a href="mailto:yt-users@lists.spacepope.org">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>
> > _______________________________________________<br>
> > yt-users mailing list<br>
> > <a href="mailto:yt-users@lists.spacepope.org">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>
> _______________________________________________<br>
> yt-users mailing list<br>
> <a href="mailto:yt-users@lists.spacepope.org">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>
<br>
<br>
</div></div><div class="im">--<br>
<br>
---------------------------------------------------------------<br>
<br>
Luigi Iapichino<br>
Zentrum fuer Astronomie der Universitaet Heidelberg<br>
Institut fuer Theoretische Astrophysik<br>
Albert-Ueberle-Str. 2, D-69120 Heidelberg, Germany<br>
Tel: +49 6221 548983, Fax: +49 6221 544221<br>
e-mail: <a href="mailto:luigi@ita.uni-heidelberg.de">luigi@ita.uni-heidelberg.de</a><br>
URL: <a href="http://www.ita.uni-heidelberg.de/%7Eluigi/" target="_blank">http://www.ita.uni-heidelberg.de/~luigi/</a><br>
_______________________________________________<br>
</div><div><div></div><div class="h5">yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">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>