[yt-users] projection depth

Britton Smith brittonsmith at gmail.com
Tue Apr 13 08:54:55 PDT 2010


Hi Luigi,

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.

Britton

On Tue, Apr 13, 2010 at 9:47 AM, Luigi Iapichino <
luigi at ita.uni-heidelberg.de> wrote:

> Hi John, Matt, Britton,
>
> thanks for your suggestions! Both specifying the data_source or the
> field_cuts
> work as I needed. The former option is much faster (~4X) in my problem, but
> I
> imagine that this is rather setup-dependent, and the choice between working
> in a region or in parallel should be taken case by case.
> Best,
>
>  Luigi
>
> On Tuesday 13 April 2010, Matthew Turk wrote:
> > Hi John,
> >
> > You know ... I have to confess I'm a bit surprised that it works, but
> > thinking back, I don't think there are any methods that it calls on
> > the parameter file that aren't present in the AMRegion.  And,
> > I think you're on to something: it makes more sense to have a
> > PlotCollection affiliated with either the (implicit) "all data in a
> > parameter file" or with a specific 3D data object.
> >
> > Maybe this is something that should definitely Work?
> >
> > -Matt
> >
> > On Tue, Apr 13, 2010 at 11:12 AM, John Wise <jwise at astro.princeton.edu>
> wrote:
> > > Hi Matt,
> > >
> > > 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 :)
> > >
> > > Thanks!
> > > John
> > >
> > > On 04/13/2010 11:06 AM, Matthew Turk wrote:
> > >> Hi John, Luigi,
> > >>
> > >> I think you also will need to specify the region as a data_source to
> > >> the add_projection call:
> > >>
> > >> pc.add_projection("Density", 0,source=reg)
> > >>
> > >> and I think PlotCollection sitll takes the pf, not the reg variable,
> > >> as its argument.  Here's an example script, if you wanted to do it
> > >> with a sphere:
> > >>
> > >> http://paste.enzotools.org/show/441/
> > >>
> > >> I'll add the scripts you sent with this modification to the cookbook.
> > >>  Thanks!
> > >>
> > >> -Matt
> > >>
> > >> On Tue, Apr 13, 2010 at 11:04 AM, John Wise<jwise at astro.princeton.edu
> >
> > >>
> > >>  wrote:
> > >>> Hi,
> > >>>
> > >>> I would think that you'd have to change the region boundaries, if you
> > >>> wanted
> > >>> to change the projection depth.  To have L=0.2, you have to change
> your
> > >>> region boundaries to reflect that change, i.e. [0.4,0.4,0.4] ->
> > >>> [0.6,0.6,0.6].
> > >>>
> > >>>
> > >>> If I wanted to make projections with a given width and depth, I'd do
> > >>> the following.
> > >>>
> > >>> L = 0.1  # projection width
> > >>> d = 0.2  # projection depth
> > >>> center = na.array([0.5]*3)
> > >>> dim = 0
> > >>>
> > >>> left_edge = center - 0.5*L
> > >>> right_edge = center + 0.5*L
> > >>>
> > >>> # For the projection dimension, use the depth
> > >>> left_edge[dim] = center - 0.5*d
> > >>> right_edge[dim] = center + 0.5*d
> > >>>
> > >>> pf = get_pf()
> > >>> reg = pf.h.region(center, left_edge, right_edge)
> > >>>
> > >>> pc = PlotCollection(reg, center=center)
> > >>> pc.add_projection("Density", 0, "Density")
> > >>> pc.set_width(L, '1')
> > >>> pc.save("test", override=True)
> > >>>
> > >>> Cheers,
> > >>> John
> > >>>
> > >>> On 04/13/2010 10:21 AM, Luigi Iapichino wrote:
> > >>>> Dear all,
> > >>>>
> > >>>> by comparing volume renderings and projections in my simulation I
> > >>>> realised
> > >>>> that I don't have control on the projection depth, in the latter
> case.
> > >>>> This is the relevant part of my script:
> > >>>>
> > >>>> ...
> > >>>>
> > >>>> L = 0.1 # projection width
> > >>>>
> > >>>> pf = load(data_dir+fn) # load data
> > >>>>
> > >>>> reg = pf.h.region([0.5, 0.5, 0.5],[0.45,0.45,0.45],[0.55,0.55,0.55])
> #
> > >>>> a small
> > >>>> region
> > >>>> #reg = pf.h.region([0.5, 0.5, 0.5],[0,0,0],[1,1,1]) # the whole box
> > >>>>
> > >>>> pc = PlotCollection(reg, center=[0.5,0.5,0.5])
> > >>>>
> > >>>> p = pc.add_projection("Density", 0,
> > >>>> weight_field="Density",fig_size=(7.5,6))
> > >>>>
> > >>>> p.modify["contour"]("Density", ncont=5,take_log=True)
> > >>>>
> > >>>> pc.set_width(L, '1')
> > >>>>
> > >>>> pc.save("%s_test-proj" % pf,override=True)
> > >>>>
> > >>>>
> > >>>> If I set L = 0.2, I don't see in the central region of the
> projection
> > >>>> more
> > >>>> structures than with L=0.1 (only the plot width is, of course,
> > >>>> larger). Moreover, the result do not depend on the region that I
> > >>>> select (either third
> > >>>> or fourth line). It seems to me that, in all cases, the projection
> is
> > >>>> actually performed along the whole simulation box, and not on the
> > >>>> region that
> > >>>> I select. In other words, I can control the plot width, but not the
> > >>>> projection depth. In the volume rendering, on the other hand, the
> plot
> > >>>> width
> > >>>> sets the depth, too. Is anything wrong or missing in my script?
> > >>>>
> > >>>> If needed, I can send you a few explanatory plots and the whole
> sample
> > >>>> script
> > >>>> for reproducing my issue.
> > >>>> Looking forward to your suggestions,
> > >>>>
> > >>>>   Luigi
> > >>>
> > >>> _______________________________________________
> > >>> 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
> > >
> > > _______________________________________________
> > > 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
>
>
>
> --
>
> ---------------------------------------------------------------
>
> Luigi Iapichino
> Zentrum fuer Astronomie der Universitaet Heidelberg
> Institut fuer Theoretische Astrophysik
> Albert-Ueberle-Str. 2, D-69120 Heidelberg, Germany
> Tel: +49 6221 548983, Fax: +49 6221 544221
> e-mail: luigi at ita.uni-heidelberg.de
> URL: http://www.ita.uni-heidelberg.de/~luigi/<http://www.ita.uni-heidelberg.de/%7Eluigi/>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20100413/54d30c96/attachment.html>


More information about the yt-users mailing list