<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes -- although that behavior was also true in 2.x, to my recollection.<br></blockquote><div><br></div><div>It definitely was, I did it a bunch-- I didn't understand the results I was getting, so I didn't publish them yet. Now I think I do, and was hoping to resume that work, so I'm definitely hoping to be able to get particles from clumps soon.  </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">However, in 3.0, we *can* do this with a little bit of development, so<br>
</blockquote><div><br></div><div>If you point me at some source, I'm happy to get started on that.  All my particles are massless, so the deposited mass isn't enough. </div><div><br></div><div>Thanks!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think on the whole it's a net win.  With the work Doug Rudd did on<br>
composable objects, we should be able to supply one object as a<br>
base_source to another and then select particles that reside inside<br>
the cells that are selected, using bbox selection based on cells.<br>
<br>
All of that being said, I'd say just use the deposited mass from<br>
particles.  It'll give you exactly the same result and will work with<br>
clumps.  This was not available in 2.x, and now is in 3.x.<br>
<br>
Also, what I was alluding to in a previous email is that there's an<br>
internal "state" affiliated with an object -- "GenerationInProgress"<br>
-- which can sometimes, if an error is not correctly caught, be<br>
propagated up to the top.  I think this is what's happening.  Without<br>
it getting reset internally, it breaks the object.<br>
<br>
-Matt<br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, Dec 18, 2014 at 8:57 AM, Britton Smith <<a href="mailto:brittonsmith@gmail.com">brittonsmith@gmail.com</a>> wrote:<br>
> My understanding is that in yt-3.0 we cannot get particles from clumps.  Is<br>
> that true?<br>
><br>
> On Thu, Dec 18, 2014 at 9:36 AM, David Collins <<a href="mailto:dcollins4096@gmail.com">dcollins4096@gmail.com</a>><br>
> wrote:<br>
>>><br>
>>><br>
>>> I believe what's going on is that the object gets stuck in a mid-state<br>
>>> of generating data and is locked.  This is something that is not<br>
>>> supposed to happen, but we should be able to fail more gracefully.<br>
>>><br>
>><br>
>> Is it stuck because it's hard to get particles directly from the clump?<br>
>><br>
>><br>
>>><br>
>>> > For now, a workaround would be to avoid using the total_mass derived<br>
>>> > quantity and instead do something like this:<br>
>>> ><br>
>>> > clump = ...<br>
>>> > total_mass = clump.quantity.total_quantity('cell_mass')<br>
>>> > clump['density']<br>
>>> > clump['cell_mass']<br>
>>> ><br>
>>> >><br>
>>> >><br>
>>> >> The curious disappearing data can be seen here:<br>
>>> >><br>
>>> >> >>> leaf_clumps[0]['density']<br>
>>> >> YTArray([  94330.76550569,  111095.42419888,  111000.87780872,<br>
>>> >>         158489.47273191,  114487.69237444,  129849.08390983,<br>
>>> >>          95651.97426045,   95462.47824957,  104785.15137116,<br>
>>> >>         149758.92528478,  122558.83598019,   91829.8174425 ,<br>
>>> >>          97015.49553846,  118157.84068288]) g/cm**3<br>
>>> >> >>> leaf_clumps[0]['cell_mass']<br>
>>> >> YTArray([ 0.00070282,  0.00082773,  0.00082702,  0.00118084,  0.000853<br>
>>> >> ,<br>
>>> >>         0.00096745,  0.00071266,  0.00071125,  0.00078071,<br>
>>> >> 0.00111579,<br>
>>> >>         0.00091313,  0.00068419,  0.00072282,  0.00088034]) g<br>
>>> >> >>> leaf_clumps[0].quantities.total_quantity('cell_mass')<br>
>>> >> 0.0118797558199 g<br>
>>> >> >>> leaf_clumps[0].quantities.total_mass()<br>
>>> >> Traceback (most recent call last):<br>
>>> >>   File "<stdin>", line 1, in <module><br>
>>> >>   File<br>
>>> >><br>
>>> >> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",<br>
>>> >> line 193, in __call__<br>
>>> >>     rv = super(TotalMass, self).__call__(fields)<br>
>>> >>   File<br>
>>> >><br>
>>> >> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",<br>
>>> >> line 160, in __call__<br>
>>> >>     rv = super(TotalQuantity, self).__call__(fields)<br>
>>> >>   File<br>
>>> >><br>
>>> >> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",<br>
>>> >> line 56, in __call__<br>
>>> >>     sto.result = self.process_chunk(ds, *args, **kwargs)<br>
>>> >>   File<br>
>>> >><br>
>>> >> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",<br>
>>> >> line 166, in process_chunk<br>
>>> >>     for field in fields]<br>
>>> >>   File<br>
>>> >><br>
>>> >> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py",<br>
>>> >> line 248, in __getitem__<br>
>>> >>     self.get_data(f)<br>
>>> >>   File<br>
>>> >><br>
>>> >> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py",<br>
>>> >> line 749, in get_data<br>
>>> >>     raise YTMixedCutRegion(self.conditionals, field)<br>
>>> >> yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete<br>
>>> >> and<br>
>>> >> fluid/mesh conditions or<br>
>>> >>                quantities.  Field: ('all', 'particle_mass') and<br>
>>> >> Conditions<br>
>>> >> specified:<br>
>>> >>             obj['contours_72e8d63701e04d13bfec60cada79b7ad'] == 1<br>
>>> >> >>> leaf_clumps[0].quantities.total_quantity('cell_mass')<br>
>>> >> 0.0 g<br>
>>> >> >>> leaf_clumps[0]['cell_mass']<br>
>>> >> YTArray([], dtype=float64) g<br>
>>> >><br>
>>> >><br>
>>> >><br>
>>> >> The code to make the clumps<br>
>>> >><br>
>>> >>     ds = yt.load(setname)<br>
>>> >>     val, loc = ds.find_max('density')<br>
>>> >>     width = (0.05,'code_length')<br>
>>> >>     sphere = ds.sphere(loc,width)<br>
>>> >>     master_clump = Clump(sphere,"density")<br>
>>> >>     c_min = sphere["gas", "density"].min()<br>
>>> >>     c_max = sphere["gas", "density"].max()<br>
>>> >>     step = 2.0<br>
>>> >>     find_clumps(master_clump, c_min, c_max, step)<br>
>>> >>     leaf_clumps = get_lowest_clumps(master_clump)<br>
>>> >><br>
>>> >><br>
>>> >>><br>
>>> >>> I'll give that a shot in the morning and report back.<br>
>>> >>><br>
>>> >>><br>
>>> >>> Thanks!<br>
>>> >>> d.<br>
>>> >>><br>
>>> >>>><br>
>>> >>>><br>
>>> >>>>><br>
>>> >>>>><br>
>>> >>>>> If I instead try quantities.total_mass(), I get an odd error.<br>
>>> >>>>> >>> leaf_clumps[22].quantities.total_mass()<br>
>>> >>>>> Traceback (most recent call last):<br>
>>> >>>>>   File "<stdin>", line 1, in <module><br>
>>> >>>>>   File<br>
>>> >>>>><br>
>>> >>>>> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",<br>
>>> >>>>> line 193, in __call__<br>
>>> >>>>>     rv = super(TotalMass, self).__call__(fields)<br>
>>> >>>>>   File<br>
>>> >>>>><br>
>>> >>>>> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",<br>
>>> >>>>> line 160, in __call__<br>
>>> >>>>>     rv = super(TotalQuantity, self).__call__(fields)<br>
>>> >>>>>   File<br>
>>> >>>>><br>
>>> >>>>> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",<br>
>>> >>>>> line 56, in __call__<br>
>>> >>>>>     sto.result = self.process_chunk(ds, *args, **kwargs)<br>
>>> >>>>>   File<br>
>>> >>>>><br>
>>> >>>>> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",<br>
>>> >>>>> line 166, in process_chunk<br>
>>> >>>>>     for field in fields]<br>
>>> >>>>>   File<br>
>>> >>>>><br>
>>> >>>>> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py",<br>
>>> >>>>> line 248, in __getitem__<br>
>>> >>>>>     self.get_data(f)<br>
>>> >>>>>   File<br>
>>> >>>>><br>
>>> >>>>> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py",<br>
>>> >>>>> line 749, in get_data<br>
>>> >>>>>     raise YTMixedCutRegion(self.conditionals, field)<br>
>>> >>>>> yt.utilities.exceptions.YTMixedCutRegion: Can't mix<br>
>>> >>>>> particle/discrete<br>
>>> >>>>> and fluid/mesh conditions or<br>
>>> >>>>>                quantities.  Field: ('all', 'particle_mass') and<br>
>>> >>>>> Conditions specified:<br>
>>> >>>>>             obj['contours_8d0408a91fc34e2bbe9eb838d48de46e'] == 1<br>
>>> >>>><br>
>>> >>>><br>
>>> >>>> This is happening because, as the error indicates, you can't combine<br>
>>> >>>> mesh and particle quantities in a cut_region (like a clump is).  The<br>
>>> >>>> total_mass() quantity returns the total mass in particles and gas,<br>
>>> >>>> so that's<br>
>>> >>>> what's triggering the error. I bet this would work if you asked for<br>
>>> >>>> the<br>
>>> >>>> total gas mass only. Of course, that would only work if<br>
>>> >>>> clump['cell_mass']<br>
>>> >>>> returned something sensible.<br>
>>> >>>><br>
>>> >>>>><br>
>>> >>>>><br>
>>> >>>>><br>
>>> >>>>><br>
>>> >>>>> I build the clumps in the following manner.  I don't have any<br>
>>> >>>>> validators by design.  Plotting the clumps with<br>
>>> >>>>> annotate_clumps(leaf_clumps)<br>
>>> >>>>> gives reasonable results.<br>
>>> >>>>><br>
>>> >>>>>     ds = yt.load(setname)<br>
>>> >>>>>     loc = ds.arr([ 0.03613281,  0.79589844,  0.03027344],<br>
>>> >>>>> 'code_length')<br>
>>> >>>>>     width = (0.05,'code_length')<br>
>>> >>>>>     sphere = ds.sphere(loc,width)<br>
>>> >>>>>     master_clump = Clump(sphere,"density")<br>
>>> >>>>> use_particles=False, use_thermal_energy=False)<br>
>>> >>>>>     c_min = sphere["gas", "density"].min()<br>
>>> >>>>>     c_max = sphere["gas", "density"].max()<br>
>>> >>>>>     step = 2.0<br>
>>> >>>>>     find_clumps(master_clump, c_min, c_max, step)<br>
>>> >>>>>     leaf_clumps = get_lowest_clumps(master_clump)<br>
>>> >>>>><br>
>>> >>>>> Thanks a ton!<br>
>>> >>>>> d.<br>
>>> >>>>><br>
>>> >>>>> --<br>
>>> >>>>> -- Sent from a computer.<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>
>>> >>>> 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>
>>> >>> --<br>
>>> >>> -- Sent from a computer.<br>
>>> >><br>
>>> >><br>
>>> >><br>
>>> >> --<br>
>>> >> -- Sent from a computer.<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>
>>> > 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>
>> --<br>
>> -- Sent from a computer.<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>
> 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>
</div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">-- Sent from a computer.<br></div></div>
</div></div>