[yt-users] clump to field?

Matthew Turk matthewturk at gmail.com
Fri May 17 12:49:40 PDT 2013


I believe that is correct, yes.  One very simple way to test this and
verify would be to compare the volume in that object plus the volume
in your clump against the volume in the domain.

On Fri, May 17, 2013 at 3:48 PM, David Collins <dcollins4096 at gmail.com> wrote:
> 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
>
>
>
> _______________________________________________
> 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