[yt-users] clump to field?

David Collins dcollins4096 at gmail.com
Fri May 17 12:48:29 PDT 2013


Oh, right.  I can do

pf.h.boolean([pf.h.all_data(), "NOT", clump])

?


On Fri, May 17, 2013 at 1:41 PM, Matthew Turk <matthewturk at gmail.com> wrote:

> On Fri, May 17, 2013 at 3:39 PM, David Collins <dcollins4096 at gmail.com>
> wrote:
> > Is there an easy way to turn
> >   data._get_cut_mask(grid)
> > into an AMR region?
> >
> > Then I could just do a boolean "or" on those regions from each of the
> > regions?
>
> Oh, you want to do it grid-by-grid?  I assumed that you were operating
> on the full clump.  If you have the full clump, you can feed that
> (which should be an AMRExtractedRegion) to the boolean object.
>
> And now that I think about it, AMRExtractedRegion is what should have
> the _flush_to_grids method.
>
> >
> > d.
> >
> >
> > On Fri, May 17, 2013 at 1:34 PM, Matthew Turk <matthewturk at gmail.com>
> wrote:
> >>
> >> On Fri, May 17, 2013 at 3:31 PM, david collins <dcollins4096 at gmail.com>
> >> wrote:
> >> > Hi, all--
> >> >
> >> > I have a clump that I've gotten with the clump finder.  I'd like to
> >> > paint
> >> > those zones of that clump with a flag, so I can exclude that region
> from
> >> > other analysis.  I'm a little stuck on how to get this done-- I feel
> >> > like it
> >> > needs to involve clump.data._flush_data_to_grids and a cut_mask, but
> I'm
> >> > a
> >> > little stuck on how to define the field that I flush_to_grids.
> >> >
> >>
> >> I have to think about specifically how you might do this, but I do
> >> believe that you can probably accomplish what you're looking for by
> >> using a boolean region.
> >>
> >> > Specifically, how to get the cut_mask information to the field, and
> how
> >> > to
> >> > avoid clobbering the paint from one clump with another (or, from one
> >> > grid
> >> > with another)
> >> >
> >> > I'm trying to do something like:
> >> >
> >> > <code>
> >> > for grid in clump.data._grids:
> >> >     cut_mask = clump.data._get_cut_mask(grid)
> >> >     def masked_region(field,data):
> >> >         cut_mask = data.get_field_parameter('cut_mask', None)
> >> >         try:
> >> >             base = data['masked_region']
> >> >         except:
> >> >             base = na.zeros(data['Density'].shape)
> >> >         if cut_mask is not None:
> >> >             base = na.maximum(base,cut_mask)
> >> >         return base
> >> >
> >> >
> >> >
> add_field('masked_region',function=masked_region,validators=[ValidateGridType()],
> >> > not_in_all=True)
> >> >     grid.set_field_parameter('cut_mask',cut_mask)
> >> >     print grid, cut_mask.sum(), grid['masked_region'].sum()
> >> > clump.data._flush_to_grids('masked_region',0)
> >> > </code>
> >> >
> >> > but clump['masked_region'].sum() only returns the flagged zones in the
> >> > first
> >> > of the grids.
> >> >
> >> > I feel like this is something I've done before, but can't find any
> >> > reference
> >> > to it in my email or old scripts.  Apologies if this has been answered
> >> > elsewhere, or it's obvious and I'm being thick.
> >> >
> >> > Thanks!
> >> > d.
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20130517/78e3a085/attachment.html>


More information about the yt-users mailing list