![](https://secure.gravatar.com/avatar/f93e6c9cc5465e92eff37ffb7ef58f28.jpg?s=120&d=mm&r=g)
Hi there-- I'm doing something wrong with clumps in yt3, and can't quite figure out what I"m doing. When I make some clumps, the field 'density' shows up, but no other fields seem to be well defined. Is this a familiar error to anyone? What I'm doing is the following: I make some clumps from a sphere, similar to what's in the docs (details at the end of the email), and when I do
leaf_clumps[n]['density'] I get something sensical. But if I do leaf_clumps[n]['cell_mass'] YTArray([], dtype=float64) g
leaf_clumps[22].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
I get this empty array. If I instead try quantities.total_mass(), I get an odd error. line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 166, in process_chunk for field in fields] File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py", line 248, in __getitem__ self.get_data(f) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_8d0408a91fc34e2bbe9eb838d48de46e'] == 1 I build the clumps in the following manner. I don't have any validators by design. Plotting the clumps with annotate_clumps(leaf_clumps) gives reasonable results. ds = yt.load(setname) loc = ds.arr([ 0.03613281, 0.79589844, 0.03027344], 'code_length') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") use_particles=False, use_thermal_energy=False) c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump) Thanks a ton! d. -- -- Sent from a computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
![](https://secure.gravatar.com/avatar/7857f26c1ef2e9bdbfa843f9087710f7.jpg?s=120&d=mm&r=g)
On Tue, Dec 16, 2014 at 2:32 PM, David Collins <dcollins4096@gmail.com> wrote:
Hi there--
I'm doing something wrong with clumps in yt3, and can't quite figure out what I"m doing. When I make some clumps, the field 'density' shows up, but no other fields seem to be well defined. Is this a familiar error to anyone? What I'm doing is the following:
I make some clumps from a sphere, similar to what's in the docs (details at the end of the email), and when I do
leaf_clumps[n]['density'] I get something sensical. But if I do leaf_clumps[n]['cell_mass'] YTArray([], dtype=float64) g
I get this empty array.
Not sure why this is happening. Any chance you can reproduce it using one of the test datasets on yt-project.org/data?
leaf_clumps[22].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
If I instead try quantities.total_mass(), I get an odd error. line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 166, in process_chunk for field in fields] File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py", line 248, in __getitem__ self.get_data(f) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_8d0408a91fc34e2bbe9eb838d48de46e'] == 1
This is happening because, as the error indicates, you can't combine mesh and particle quantities in a cut_region (like a clump is). The total_mass() quantity returns the total mass in particles and gas, so that's what's triggering the error. I bet this would work if you asked for the total gas mass only. Of course, that would only work if clump['cell_mass'] returned something sensible.
I build the clumps in the following manner. I don't have any validators by design. Plotting the clumps with annotate_clumps(leaf_clumps) gives reasonable results.
ds = yt.load(setname) loc = ds.arr([ 0.03613281, 0.79589844, 0.03027344], 'code_length') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") use_particles=False, use_thermal_energy=False) c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump)
Thanks a ton! d.
-- -- Sent from a computer.
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
![](https://secure.gravatar.com/avatar/f93e6c9cc5465e92eff37ffb7ef58f28.jpg?s=120&d=mm&r=g)
Hi-- Not sure why this is happening. Any chance you can reproduce it using one
of the test datasets on yt-project.org/data?
I'll give that a shot in the morning and report back. Thanks! d.
leaf_clumps[22].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
If I instead try quantities.total_mass(), I get an odd error. line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 166, in process_chunk for field in fields] File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py", line 248, in __getitem__ self.get_data(f) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_8d0408a91fc34e2bbe9eb838d48de46e'] == 1
This is happening because, as the error indicates, you can't combine mesh and particle quantities in a cut_region (like a clump is). The total_mass() quantity returns the total mass in particles and gas, so that's what's triggering the error. I bet this would work if you asked for the total gas mass only. Of course, that would only work if clump['cell_mass'] returned something sensible.
I build the clumps in the following manner. I don't have any validators by design. Plotting the clumps with annotate_clumps(leaf_clumps) gives reasonable results.
ds = yt.load(setname) loc = ds.arr([ 0.03613281, 0.79589844, 0.03027344], 'code_length') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") use_particles=False, use_thermal_energy=False) c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump)
Thanks a ton! d.
-- -- Sent from a computer.
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- -- Sent from a computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
![](https://secure.gravatar.com/avatar/f93e6c9cc5465e92eff37ffb7ef58f28.jpg?s=120&d=mm&r=g)
Not sure why this is happening. Any chance you can reproduce it using one
of the test datasets on yt-project.org/data?
leaf_clumps[0]['density'] YTArray([ 94330.76550569, 111095.42419888, 111000.87780872, 158489.47273191, 114487.69237444, 129849.08390983, 95651.97426045, 95462.47824957, 104785.15137116, 149758.92528478, 122558.83598019, 91829.8174425 , 97015.49553846, 118157.84068288]) g/cm**3 leaf_clumps[0]['cell_mass'] YTArray([ 0.00070282, 0.00082773, 0.00082702, 0.00118084, 0.000853 , 0.00096745, 0.00071266, 0.00071125, 0.00078071, 0.00111579, 0.00091313, 0.00068419, 0.00072282, 0.00088034]) g leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0118797558199 g leaf_clumps[0].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
I tried with the IsolatedGalaxy simulation, using the same code as before (below for reference) but everything works fine. I did learn that if I don't do quantities.total_mass() on any clump, I get sensical results, but as soon as I do call total_mass, it eliminates the data on all clumps. This simulation has only tracer particles, an no other particles, is that possibly the problem? The curious disappearing data can be seen here: line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 166, in process_chunk for field in fields] File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py", line 248, in __getitem__ self.get_data(f) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_72e8d63701e04d13bfec60cada79b7ad'] == 1
leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0 g leaf_clumps[0]['cell_mass'] YTArray([], dtype=float64) g
The code to make the clumps ds = yt.load(setname) val, loc = ds.find_max('density') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump)
I'll give that a shot in the morning and report back.
Thanks! d.
leaf_clumps[22].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
If I instead try quantities.total_mass(), I get an odd error. line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 166, in process_chunk for field in fields] File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py", line 248, in __getitem__ self.get_data(f) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_8d0408a91fc34e2bbe9eb838d48de46e'] == 1
This is happening because, as the error indicates, you can't combine mesh and particle quantities in a cut_region (like a clump is). The total_mass() quantity returns the total mass in particles and gas, so that's what's triggering the error. I bet this would work if you asked for the total gas mass only. Of course, that would only work if clump['cell_mass'] returned something sensible.
I build the clumps in the following manner. I don't have any validators by design. Plotting the clumps with annotate_clumps(leaf_clumps) gives reasonable results.
ds = yt.load(setname) loc = ds.arr([ 0.03613281, 0.79589844, 0.03027344], 'code_length') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") use_particles=False, use_thermal_energy=False) c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump)
Thanks a ton! d.
-- -- Sent from a computer.
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- -- Sent from a computer.
-- -- Sent from a computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
![](https://secure.gravatar.com/avatar/7857f26c1ef2e9bdbfa843f9087710f7.jpg?s=120&d=mm&r=g)
On Wed Dec 17 2014 at 10:24:51 AM David Collins <dcollins4096@gmail.com> wrote:
Not sure why this is happening. Any chance you can reproduce it using one
of the test datasets on yt-project.org/data?
I tried with the IsolatedGalaxy simulation, using the same code as before (below for reference) but everything works fine.
I did learn that if I don't do quantities.total_mass() on any clump, I get sensical results, but as soon as I do call total_mass, it eliminates the data on all clumps. This simulation has only tracer particles, an no other particles, is that possibly the problem?
Ah, thanks for the hint, I can reproduce this using IsolatedGalaxy now. I will file an issue shortly. Having a repro script should help debugging here. For now, a workaround would be to avoid using the total_mass derived quantity and instead do something like this: clump = ... total_mass = clump.quantity.total_quantity('cell_mass') clump['density'] clump['cell_mass']
The curious disappearing data can be seen here:
leaf_clumps[0]['density'] YTArray([ 94330.76550569, 111095.42419888, 111000.87780872, 158489.47273191, 114487.69237444, 129849.08390983, 95651.97426045, 95462.47824957, 104785.15137116, 149758.92528478, 122558.83598019, 91829.8174425 , 97015.49553846, 118157.84068288]) g/cm**3 leaf_clumps[0]['cell_mass'] YTArray([ 0.00070282, 0.00082773, 0.00082702, 0.00118084, 0.000853 , 0.00096745, 0.00071266, 0.00071125, 0.00078071, 0.00111579, 0.00091313, 0.00068419, 0.00072282, 0.00088034]) g leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0118797558199 g leaf_clumps[0].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 166, in process_chunk for field in fields] File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py", line 248, in __getitem__ self.get_data(f) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_72e8d63701e04d13bfec60cada79b7ad'] == 1 leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0 g leaf_clumps[0]['cell_mass'] YTArray([], dtype=float64) g
The code to make the clumps
ds = yt.load(setname) val, loc = ds.find_max('density') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump)
I'll give that a shot in the morning and report back.
Thanks! d.
> leaf_clumps[22].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
If I instead try quantities.total_mass(), I get an odd error. line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 166, in process_chunk for field in fields] File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py", line 248, in __getitem__ self.get_data(f) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_8d0408a91fc34e2bbe9eb838d48de46e'] == 1
This is happening because, as the error indicates, you can't combine mesh and particle quantities in a cut_region (like a clump is). The total_mass() quantity returns the total mass in particles and gas, so that's what's triggering the error. I bet this would work if you asked for the total gas mass only. Of course, that would only work if clump['cell_mass'] returned something sensible.
I build the clumps in the following manner. I don't have any validators by design. Plotting the clumps with annotate_clumps(leaf_clumps) gives reasonable results.
ds = yt.load(setname) loc = ds.arr([ 0.03613281, 0.79589844, 0.03027344], 'code_length') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") use_particles=False, use_thermal_energy=False) c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump)
Thanks a ton! d.
-- -- Sent from a computer.
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- -- Sent from a computer.
-- -- Sent from a computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
![](https://secure.gravatar.com/avatar/f93e6c9cc5465e92eff37ffb7ef58f28.jpg?s=120&d=mm&r=g)
Ah, thanks for the hint, I can reproduce this using IsolatedGalaxy now. I will file an issue shortly. Having a repro script should help debugging here.
Awesome. Let me know if I can help out with your debuging.
For now, a workaround would be to avoid using the total_mass derived quantity and instead do something like this:
Groovy. That seems good for now. Thanks a ton! d.
clump = ... total_mass = clump.quantity.total_quantity('cell_mass') clump['density'] clump['cell_mass']
The curious disappearing data can be seen here:
leaf_clumps[0]['density'] YTArray([ 94330.76550569, 111095.42419888, 111000.87780872, 158489.47273191, 114487.69237444, 129849.08390983, 95651.97426045, 95462.47824957, 104785.15137116, 149758.92528478, 122558.83598019, 91829.8174425 , 97015.49553846, 118157.84068288]) g/cm**3 leaf_clumps[0]['cell_mass'] YTArray([ 0.00070282, 0.00082773, 0.00082702, 0.00118084, 0.000853 , 0.00096745, 0.00071266, 0.00071125, 0.00078071, 0.00111579, 0.00091313, 0.00068419, 0.00072282, 0.00088034]) g leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0118797558199 g leaf_clumps[0].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 166, in process_chunk for field in fields] File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py", line 248, in __getitem__ self.get_data(f) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_72e8d63701e04d13bfec60cada79b7ad'] == 1 leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0 g leaf_clumps[0]['cell_mass'] YTArray([], dtype=float64) g
The code to make the clumps
ds = yt.load(setname) val, loc = ds.find_max('density') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump)
I'll give that a shot in the morning and report back.
Thanks! d.
>> leaf_clumps[22].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
If I instead try quantities.total_mass(), I get an odd error. line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 166, in process_chunk for field in fields] File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py", line 248, in __getitem__ self.get_data(f) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_8d0408a91fc34e2bbe9eb838d48de46e'] == 1
This is happening because, as the error indicates, you can't combine mesh and particle quantities in a cut_region (like a clump is). The total_mass() quantity returns the total mass in particles and gas, so that's what's triggering the error. I bet this would work if you asked for the total gas mass only. Of course, that would only work if clump['cell_mass'] returned something sensible.
I build the clumps in the following manner. I don't have any validators by design. Plotting the clumps with annotate_clumps(leaf_clumps) gives reasonable results.
ds = yt.load(setname) loc = ds.arr([ 0.03613281, 0.79589844, 0.03027344], 'code_length') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") use_particles=False, use_thermal_energy=False) c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump)
Thanks a ton! d.
-- -- Sent from a computer.
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- -- Sent from a computer.
-- -- Sent from a computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- -- Sent from a computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
![](https://secure.gravatar.com/avatar/b279d746f54e2cd6062e8279a767c4bc.jpg?s=120&d=mm&r=g)
On Wed, Dec 17, 2014 at 2:32 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
On Wed Dec 17 2014 at 10:24:51 AM David Collins <dcollins4096@gmail.com> wrote:
Not sure why this is happening. Any chance you can reproduce it using one of the test datasets on yt-project.org/data?
I tried with the IsolatedGalaxy simulation, using the same code as before (below for reference) but everything works fine.
I did learn that if I don't do quantities.total_mass() on any clump, I get sensical results, but as soon as I do call total_mass, it eliminates the data on all clumps. This simulation has only tracer particles, an no other particles, is that possibly the problem?
Ah, thanks for the hint, I can reproduce this using IsolatedGalaxy now. I will file an issue shortly. Having a repro script should help debugging here.
I believe what's going on is that the object gets stuck in a mid-state of generating data and is locked. This is something that is not supposed to happen, but we should be able to fail more gracefully.
For now, a workaround would be to avoid using the total_mass derived quantity and instead do something like this:
clump = ... total_mass = clump.quantity.total_quantity('cell_mass') clump['density'] clump['cell_mass']
The curious disappearing data can be seen here:
leaf_clumps[0]['density'] YTArray([ 94330.76550569, 111095.42419888, 111000.87780872, 158489.47273191, 114487.69237444, 129849.08390983, 95651.97426045, 95462.47824957, 104785.15137116, 149758.92528478, 122558.83598019, 91829.8174425 , 97015.49553846, 118157.84068288]) g/cm**3 leaf_clumps[0]['cell_mass'] YTArray([ 0.00070282, 0.00082773, 0.00082702, 0.00118084, 0.000853 , 0.00096745, 0.00071266, 0.00071125, 0.00078071, 0.00111579, 0.00091313, 0.00068419, 0.00072282, 0.00088034]) g leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0118797558199 g leaf_clumps[0].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 166, in process_chunk for field in fields] File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py", line 248, in __getitem__ self.get_data(f) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_72e8d63701e04d13bfec60cada79b7ad'] == 1 leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0 g leaf_clumps[0]['cell_mass'] YTArray([], dtype=float64) g
The code to make the clumps
ds = yt.load(setname) val, loc = ds.find_max('density') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump)
I'll give that a shot in the morning and report back.
Thanks! d.
>> leaf_clumps[22].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
If I instead try quantities.total_mass(), I get an odd error. line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 166, in process_chunk for field in fields] File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py", line 248, in __getitem__ self.get_data(f) File "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_8d0408a91fc34e2bbe9eb838d48de46e'] == 1
This is happening because, as the error indicates, you can't combine mesh and particle quantities in a cut_region (like a clump is). The total_mass() quantity returns the total mass in particles and gas, so that's what's triggering the error. I bet this would work if you asked for the total gas mass only. Of course, that would only work if clump['cell_mass'] returned something sensible.
I build the clumps in the following manner. I don't have any validators by design. Plotting the clumps with annotate_clumps(leaf_clumps) gives reasonable results.
ds = yt.load(setname) loc = ds.arr([ 0.03613281, 0.79589844, 0.03027344], 'code_length') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") use_particles=False, use_thermal_energy=False) c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump)
Thanks a ton! d.
-- -- Sent from a computer.
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- -- Sent from a computer.
-- -- Sent from a computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
![](https://secure.gravatar.com/avatar/f93e6c9cc5465e92eff37ffb7ef58f28.jpg?s=120&d=mm&r=g)
I believe what's going on is that the object gets stuck in a mid-state of generating data and is locked. This is something that is not supposed to happen, but we should be able to fail more gracefully.
Is it stuck because it's hard to get particles directly from the clump?
For now, a workaround would be to avoid using the total_mass derived quantity and instead do something like this:
clump = ... total_mass = clump.quantity.total_quantity('cell_mass') clump['density'] clump['cell_mass']
The curious disappearing data can be seen here:
leaf_clumps[0]['density'] YTArray([ 94330.76550569, 111095.42419888, 111000.87780872, 158489.47273191, 114487.69237444, 129849.08390983, 95651.97426045, 95462.47824957, 104785.15137116, 149758.92528478, 122558.83598019, 91829.8174425 , 97015.49553846, 118157.84068288]) g/cm**3 leaf_clumps[0]['cell_mass'] YTArray([ 0.00070282, 0.00082773, 0.00082702, 0.00118084, 0.000853
,
0.00096745, 0.00071266, 0.00071125, 0.00078071, 0.00111579, 0.00091313, 0.00068419, 0.00072282, 0.00088034]) g
leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0118797558199 g leaf_clumps[0].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 166, in process_chunk for field in fields] File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py",
line 248, in __getitem__ self.get_data(f) File
line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_72e8d63701e04d13bfec60cada79b7ad'] == 1
leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0 g leaf_clumps[0]['cell_mass'] YTArray([], dtype=float64) g
The code to make the clumps
ds = yt.load(setname) val, loc = ds.find_max('density') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump)
I'll give that a shot in the morning and report back.
Thanks! d.
If I instead try quantities.total_mass(), I get an odd error. >>> leaf_clumps[22].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 166, in process_chunk for field in fields] File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py",
line 248, in __getitem__ self.get_data(f) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py",
line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_8d0408a91fc34e2bbe9eb838d48de46e'] == 1
This is happening because, as the error indicates, you can't combine mesh and particle quantities in a cut_region (like a clump is). The total_mass() quantity returns the total mass in particles and gas, so
what's triggering the error. I bet this would work if you asked for
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", that's the
total gas mass only. Of course, that would only work if clump['cell_mass'] returned something sensible.
I build the clumps in the following manner. I don't have any validators by design. Plotting the clumps with
annotate_clumps(leaf_clumps)
gives reasonable results.
ds = yt.load(setname) loc = ds.arr([ 0.03613281, 0.79589844, 0.03027344], 'code_length') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") use_particles=False, use_thermal_energy=False) c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump)
Thanks a ton! d.
-- -- Sent from a computer.
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- -- Sent from a computer.
-- -- Sent from a computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- -- Sent from a computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
![](https://secure.gravatar.com/avatar/c1ca883bfb6bc32bcd9a65c5ec9b0bf9.jpg?s=120&d=mm&r=g)
My understanding is that in yt-3.0 we cannot get particles from clumps. Is that true? On Thu, Dec 18, 2014 at 9:36 AM, David Collins <dcollins4096@gmail.com> wrote:
I believe what's going on is that the object gets stuck in a mid-state of generating data and is locked. This is something that is not supposed to happen, but we should be able to fail more gracefully.
Is it stuck because it's hard to get particles directly from the clump?
For now, a workaround would be to avoid using the total_mass derived quantity and instead do something like this:
clump = ... total_mass = clump.quantity.total_quantity('cell_mass') clump['density'] clump['cell_mass']
The curious disappearing data can be seen here:
> leaf_clumps[0]['density'] YTArray([ 94330.76550569, 111095.42419888, 111000.87780872, 158489.47273191, 114487.69237444, 129849.08390983, 95651.97426045, 95462.47824957, 104785.15137116, 149758.92528478, 122558.83598019, 91829.8174425 , 97015.49553846, 118157.84068288]) g/cm**3 > leaf_clumps[0]['cell_mass'] YTArray([ 0.00070282, 0.00082773, 0.00082702, 0.00118084,
0.000853 ,
0.00096745, 0.00071266, 0.00071125, 0.00078071, 0.00111579, 0.00091313, 0.00068419, 0.00072282, 0.00088034]) g
> leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0118797558199 g > leaf_clumps[0].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 166, in process_chunk for field in fields] File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py",
line 248, in __getitem__ self.get_data(f) File
line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_72e8d63701e04d13bfec60cada79b7ad'] == 1
> leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0 g > leaf_clumps[0]['cell_mass'] YTArray([], dtype=float64) g
The code to make the clumps
ds = yt.load(setname) val, loc = ds.find_max('density') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump)
I'll give that a shot in the morning and report back.
Thanks! d.
> > > If I instead try quantities.total_mass(), I get an odd error. > >>> leaf_clumps[22].quantities.total_mass() > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File >
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
> line 193, in __call__ > rv = super(TotalMass, self).__call__(fields) > File > "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", > line 160, in __call__ > rv = super(TotalQuantity, self).__call__(fields) > File > "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", > line 56, in __call__ > sto.result = self.process_chunk(ds, *args, **kwargs) > File > "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", > line 166, in process_chunk > for field in fields] > File > "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py", > line 248, in __getitem__ > self.get_data(f) > File > "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", > line 749, in get_data > raise YTMixedCutRegion(self.conditionals, field) > yt.utilities.exceptions.YTMixedCutRegion: Can't mix
> and fluid/mesh conditions or > quantities. Field: ('all', 'particle_mass') and > Conditions specified: > obj['contours_8d0408a91fc34e2bbe9eb838d48de46e'] == 1
This is happening because, as the error indicates, you can't combine mesh and particle quantities in a cut_region (like a clump is). The total_mass() quantity returns the total mass in particles and gas, so that's what's triggering the error. I bet this would work if you asked for
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", particle/discrete the
total gas mass only. Of course, that would only work if clump['cell_mass'] returned something sensible.
> > > > > I build the clumps in the following manner. I don't have any > validators by design. Plotting the clumps with annotate_clumps(leaf_clumps) > gives reasonable results. > > ds = yt.load(setname) > loc = ds.arr([ 0.03613281, 0.79589844, 0.03027344], > 'code_length') > width = (0.05,'code_length') > sphere = ds.sphere(loc,width) > master_clump = Clump(sphere,"density") > use_particles=False, use_thermal_energy=False) > c_min = sphere["gas", "density"].min() > c_max = sphere["gas", "density"].max() > step = 2.0 > find_clumps(master_clump, c_min, c_max, step) > leaf_clumps = get_lowest_clumps(master_clump) > > Thanks a ton! > d. > > -- > -- Sent from a computer. > > _______________________________________________ > yt-users mailing list > yt-users@lists.spacepope.org > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org >
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- -- Sent from a computer.
-- -- Sent from a computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- -- Sent from a computer.
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
![](https://secure.gravatar.com/avatar/b279d746f54e2cd6062e8279a767c4bc.jpg?s=120&d=mm&r=g)
Hi Britton and Dave, Yes -- although that behavior was also true in 2.x, to my recollection. However, in 3.0, we *can* do this with a little bit of development, so I think on the whole it's a net win. With the work Doug Rudd did on composable objects, we should be able to supply one object as a base_source to another and then select particles that reside inside the cells that are selected, using bbox selection based on cells. All of that being said, I'd say just use the deposited mass from particles. It'll give you exactly the same result and will work with clumps. This was not available in 2.x, and now is in 3.x. Also, what I was alluding to in a previous email is that there's an internal "state" affiliated with an object -- "GenerationInProgress" -- which can sometimes, if an error is not correctly caught, be propagated up to the top. I think this is what's happening. Without it getting reset internally, it breaks the object. -Matt On Thu, Dec 18, 2014 at 8:57 AM, Britton Smith <brittonsmith@gmail.com> wrote:
My understanding is that in yt-3.0 we cannot get particles from clumps. Is that true?
On Thu, Dec 18, 2014 at 9:36 AM, David Collins <dcollins4096@gmail.com> wrote:
I believe what's going on is that the object gets stuck in a mid-state of generating data and is locked. This is something that is not supposed to happen, but we should be able to fail more gracefully.
Is it stuck because it's hard to get particles directly from the clump?
For now, a workaround would be to avoid using the total_mass derived quantity and instead do something like this:
clump = ... total_mass = clump.quantity.total_quantity('cell_mass') clump['density'] clump['cell_mass']
The curious disappearing data can be seen here:
>> leaf_clumps[0]['density'] YTArray([ 94330.76550569, 111095.42419888, 111000.87780872, 158489.47273191, 114487.69237444, 129849.08390983, 95651.97426045, 95462.47824957, 104785.15137116, 149758.92528478, 122558.83598019, 91829.8174425 , 97015.49553846, 118157.84068288]) g/cm**3 >> leaf_clumps[0]['cell_mass'] YTArray([ 0.00070282, 0.00082773, 0.00082702, 0.00118084, 0.000853 , 0.00096745, 0.00071266, 0.00071125, 0.00078071, 0.00111579, 0.00091313, 0.00068419, 0.00072282, 0.00088034]) g >> leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0118797558199 g >> leaf_clumps[0].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", line 166, in process_chunk for field in fields] File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py", line 248, in __getitem__ self.get_data(f) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_72e8d63701e04d13bfec60cada79b7ad'] == 1
>> leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0 g >> leaf_clumps[0]['cell_mass'] YTArray([], dtype=float64) g
The code to make the clumps
ds = yt.load(setname) val, loc = ds.find_max('density') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump)
I'll give that a shot in the morning and report back.
Thanks! d.
> > >> >> >> If I instead try quantities.total_mass(), I get an odd error. >> >>> leaf_clumps[22].quantities.total_mass() >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> File >> >> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", >> line 193, in __call__ >> rv = super(TotalMass, self).__call__(fields) >> File >> >> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", >> line 160, in __call__ >> rv = super(TotalQuantity, self).__call__(fields) >> File >> >> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", >> line 56, in __call__ >> sto.result = self.process_chunk(ds, *args, **kwargs) >> File >> >> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", >> line 166, in process_chunk >> for field in fields] >> File >> >> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py", >> line 248, in __getitem__ >> self.get_data(f) >> File >> >> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", >> line 749, in get_data >> raise YTMixedCutRegion(self.conditionals, field) >> yt.utilities.exceptions.YTMixedCutRegion: Can't mix >> particle/discrete >> and fluid/mesh conditions or >> quantities. Field: ('all', 'particle_mass') and >> Conditions specified: >> obj['contours_8d0408a91fc34e2bbe9eb838d48de46e'] == 1 > > > This is happening because, as the error indicates, you can't combine > mesh and particle quantities in a cut_region (like a clump is). The > total_mass() quantity returns the total mass in particles and gas, > so that's > what's triggering the error. I bet this would work if you asked for > the > total gas mass only. Of course, that would only work if > clump['cell_mass'] > returned something sensible. > >> >> >> >> >> I build the clumps in the following manner. I don't have any >> validators by design. Plotting the clumps with >> annotate_clumps(leaf_clumps) >> gives reasonable results. >> >> ds = yt.load(setname) >> loc = ds.arr([ 0.03613281, 0.79589844, 0.03027344], >> 'code_length') >> width = (0.05,'code_length') >> sphere = ds.sphere(loc,width) >> master_clump = Clump(sphere,"density") >> use_particles=False, use_thermal_energy=False) >> c_min = sphere["gas", "density"].min() >> c_max = sphere["gas", "density"].max() >> step = 2.0 >> find_clumps(master_clump, c_min, c_max, step) >> leaf_clumps = get_lowest_clumps(master_clump) >> >> Thanks a ton! >> d. >> >> -- >> -- Sent from a computer. >> >> _______________________________________________ >> yt-users mailing list >> yt-users@lists.spacepope.org >> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org >> > > _______________________________________________ > yt-users mailing list > yt-users@lists.spacepope.org > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org >
-- -- Sent from a computer.
-- -- Sent from a computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- -- Sent from a computer.
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
![](https://secure.gravatar.com/avatar/f93e6c9cc5465e92eff37ffb7ef58f28.jpg?s=120&d=mm&r=g)
Yes -- although that behavior was also true in 2.x, to my recollection.
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.
However, in 3.0, we *can* do this with a little bit of development, so
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. Thanks!
I think on the whole it's a net win. With the work Doug Rudd did on composable objects, we should be able to supply one object as a base_source to another and then select particles that reside inside the cells that are selected, using bbox selection based on cells.
All of that being said, I'd say just use the deposited mass from particles. It'll give you exactly the same result and will work with clumps. This was not available in 2.x, and now is in 3.x.
Also, what I was alluding to in a previous email is that there's an internal "state" affiliated with an object -- "GenerationInProgress" -- which can sometimes, if an error is not correctly caught, be propagated up to the top. I think this is what's happening. Without it getting reset internally, it breaks the object.
-Matt
My understanding is that in yt-3.0 we cannot get particles from clumps. Is that true?
On Thu, Dec 18, 2014 at 9:36 AM, David Collins <dcollins4096@gmail.com> wrote:
I believe what's going on is that the object gets stuck in a mid-state of generating data and is locked. This is something that is not supposed to happen, but we should be able to fail more gracefully.
Is it stuck because it's hard to get particles directly from the clump?
For now, a workaround would be to avoid using the total_mass derived quantity and instead do something like this:
clump = ... total_mass = clump.quantity.total_quantity('cell_mass') clump['density'] clump['cell_mass']
The curious disappearing data can be seen here:
>>> leaf_clumps[0]['density'] YTArray([ 94330.76550569, 111095.42419888, 111000.87780872, 158489.47273191, 114487.69237444, 129849.08390983, 95651.97426045, 95462.47824957, 104785.15137116, 149758.92528478, 122558.83598019, 91829.8174425 , 97015.49553846, 118157.84068288]) g/cm**3 >>> leaf_clumps[0]['cell_mass'] YTArray([ 0.00070282, 0.00082773, 0.00082702, 0.00118084,
0.000853
, 0.00096745, 0.00071266, 0.00071125, 0.00078071, 0.00111579, 0.00091313, 0.00068419, 0.00072282, 0.00088034]) g >>> leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0118797558199 g >>> leaf_clumps[0].quantities.total_mass() Traceback (most recent call last): File "<stdin>", line 1, in <module> File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 193, in __call__ rv = super(TotalMass, self).__call__(fields) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 160, in __call__ rv = super(TotalQuantity, self).__call__(fields) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 56, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py",
line 166, in process_chunk for field in fields] File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py",
line 248, in __getitem__ self.get_data(f) File
"/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py",
line 749, in get_data raise YTMixedCutRegion(self.conditionals, field) yt.utilities.exceptions.YTMixedCutRegion: Can't mix
On Thu, Dec 18, 2014 at 8:57 AM, Britton Smith <brittonsmith@gmail.com> wrote: particle/discrete
and fluid/mesh conditions or quantities. Field: ('all', 'particle_mass') and Conditions specified: obj['contours_72e8d63701e04d13bfec60cada79b7ad'] == 1 >>> leaf_clumps[0].quantities.total_quantity('cell_mass') 0.0 g >>> leaf_clumps[0]['cell_mass'] YTArray([], dtype=float64) g
The code to make the clumps
ds = yt.load(setname) val, loc = ds.find_max('density') width = (0.05,'code_length') sphere = ds.sphere(loc,width) master_clump = Clump(sphere,"density") c_min = sphere["gas", "density"].min() c_max = sphere["gas", "density"].max() step = 2.0 find_clumps(master_clump, c_min, c_max, step) leaf_clumps = get_lowest_clumps(master_clump)
> > I'll give that a shot in the morning and report back. > > > Thanks! > d. > >> >> >>> >>> >>> If I instead try quantities.total_mass(), I get an odd error. >>> >>> leaf_clumps[22].quantities.total_mass() >>> Traceback (most recent call last): >>> File "<stdin>", line 1, in <module> >>> File >>> >>> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", >>> line 193, in __call__ >>> rv = super(TotalMass, self).__call__(fields) >>> File >>> >>> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", >>> line 160, in __call__ >>> rv = super(TotalQuantity, self).__call__(fields) >>> File >>> >>> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", >>> line 56, in __call__ >>> sto.result = self.process_chunk(ds, *args, **kwargs) >>> File >>> >>> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/derived_quantities.py", >>> line 166, in process_chunk >>> for field in fields] >>> File >>> >>> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/data_containers.py", >>> line 248, in __getitem__ >>> self.get_data(f) >>> File >>> >>> "/home/dcollins4096/local-yt-2014-08-27/src/yt-hg/yt/data_objects/selection_data_containers.py", >>> line 749, in get_data >>> raise YTMixedCutRegion(self.conditionals, field) >>> yt.utilities.exceptions.YTMixedCutRegion: Can't mix >>> particle/discrete >>> and fluid/mesh conditions or >>> quantities. Field: ('all', 'particle_mass') and >>> Conditions specified: >>> obj['contours_8d0408a91fc34e2bbe9eb838d48de46e'] == 1 >> >> >> This is happening because, as the error indicates, you can't combine >> mesh and particle quantities in a cut_region (like a clump is). The >> total_mass() quantity returns the total mass in particles and gas, >> so that's >> what's triggering the error. I bet this would work if you asked for >> the >> total gas mass only. Of course, that would only work if >> clump['cell_mass'] >> returned something sensible. >> >>> >>> >>> >>> >>> I build the clumps in the following manner. I don't have any >>> validators by design. Plotting the clumps with >>> annotate_clumps(leaf_clumps) >>> gives reasonable results. >>> >>> ds = yt.load(setname) >>> loc = ds.arr([ 0.03613281, 0.79589844, 0.03027344], >>> 'code_length') >>> width = (0.05,'code_length') >>> sphere = ds.sphere(loc,width) >>> master_clump = Clump(sphere,"density") >>> use_particles=False, use_thermal_energy=False) >>> c_min = sphere["gas", "density"].min() >>> c_max = sphere["gas", "density"].max() >>> step = 2.0 >>> find_clumps(master_clump, c_min, c_max, step) >>> leaf_clumps = get_lowest_clumps(master_clump) >>> >>> Thanks a ton! >>> d. >>> >>> -- >>> -- Sent from a computer. >>> >>> _______________________________________________ >>> yt-users mailing list >>> yt-users@lists.spacepope.org >>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org >>> >> >> _______________________________________________ >> yt-users mailing list >> yt-users@lists.spacepope.org >> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org >> > > > -- > -- Sent from a computer.
-- -- Sent from a computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- -- Sent from a computer.
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- -- Sent from a computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (4)
-
Britton Smith
-
David Collins
-
Matthew Turk
-
Nathan Goldbaum