<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr">My understanding is that in yt-3.0 we cannot get particles from clumps. Is that true?</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 18, 2014 at 9:36 AM, David Collins <span dir="ltr"><<a href="mailto:dcollins4096@gmail.com" target="_blank">dcollins4096@gmail.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
</span>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>
<div><div><br></div></div></blockquote><div><br></div></span><div>Is it stuck because it's hard to get particles directly from the clump? </div><div><div class="h5"><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
> 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>
>> 0.00096745, 0.00071266, 0.00071125, 0.00078071, 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>
>> "/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>
>> "/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>
>> "/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>
>> "/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>
>> "/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>
>> "/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 and<br>
>> fluid/mesh conditions or<br>
>> quantities. Field: ('all', 'particle_mass') and 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>
>>>>> "/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>
>>>>> "/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>
>>>>> "/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>
>>>>> "/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>
>>>>> "/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>
>>>>> "/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 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, so that's<br>
>>>> what's triggering the error. I bet this would work if you asked for the<br>
>>>> total gas mass only. Of course, that would only work if 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 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" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">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></div></div><div><div class="h5"><br clear="all"><div><br></div>-- <br><div><div dir="ltr">-- Sent from a computer.<br></div></div>
</div></div></div></div>
<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></blockquote></div></div>