
Dear yt-users, I was trying to calculate only the total mass of cold gas(<1e4.5) within a sphere and I tried the following script:
ds=yt.load('RedshiftOutputxxxx') sp = ds.sphere(center,radius) *spcut = sp.cut_region(["obj['temperature']<1e4.5"])* *spcut.quantities.total_mass()*
But I got an error that says:
yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or
quantities. Field: ('all', 'particle_mass') and Conditions specified:
obj['temperature']<1e4.5
Does anyone know how to fix it?
Thanks,
Jingjing

On Tue, Apr 7, 2015 at 2:03 PM, Chen Jingjing chenjj235@gmail.com wrote:
Dear yt-users, I was trying to calculate only the total mass of cold gas(<1e4.5) within a sphere and I tried the following script:
ds=yt.load('RedshiftOutputxxxx') sp = ds.sphere(center,radius) *spcut = sp.cut_region(["obj['temperature']<1e4.5"])* *spcut.quantities.total_mass()*
But I got an error that says:
yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or
quantities. Field: ('all', 'particle_mass') and Conditions specified:
obj['temperature']<1e4.5
The total_mass() quantity includes both gas and particle mass. As you've discovered, cut_regions don't support selecting particle fields.
Instead you should use the total_quantity() derived quantity to find the total of the 'cell_mass' field, which will only include the gas mass.
Does anyone know how to fix it?
Thanks,
Jingjing
Jingjing Chen [ chenjj235@gmail.com ] Department of Astronomy Columbia University 550 West 120th Street New York, New York 10027 Cell Phone: +1(347)5746709
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

It works. Thanks!
2015-04-07 17:06 GMT-04:00 Nathan Goldbaum nathan12343@gmail.com:
On Tue, Apr 7, 2015 at 2:03 PM, Chen Jingjing chenjj235@gmail.com wrote:
Dear yt-users, I was trying to calculate only the total mass of cold gas(<1e4.5) within a sphere and I tried the following script:
ds=yt.load('RedshiftOutputxxxx') sp = ds.sphere(center,radius) *spcut = sp.cut_region(["obj['temperature']<1e4.5"])* *spcut.quantities.total_mass()*
But I got an error that says:
yt.utilities.exceptions.YTMixedCutRegion: Can't mix particle/discrete and fluid/mesh conditions or
quantities. Field: ('all', 'particle_mass') and Conditions specified:
obj['temperature']<1e4.5
The total_mass() quantity includes both gas and particle mass. As you've discovered, cut_regions don't support selecting particle fields.
Instead you should use the total_quantity() derived quantity to find the total of the 'cell_mass' field, which will only include the gas mass.
Does anyone know how to fix it?
Thanks,
Jingjing
Jingjing Chen [ chenjj235@gmail.com ] Department of Astronomy Columbia University 550 West 120th Street New York, New York 10027 Cell Phone: +1(347)5746709
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
participants (2)
-
Chen Jingjing
-
Nathan Goldbaum