
Hi, all-- Can I hand a cut_region to a projection? I want to make a bunch of projections based on parameters, and don't want to have to instantiate 47 different fields. I'm hoping something like region = pf.h.all_data().cut_region('grid["Density"] > 0.1 and grid["Density"] < 0.2') proj = pf.h.proj(0,"Density",region=cut_region) or something like that. Is that possible? I'm poking around the help and source, but no method immediately popped out at me. Thanks, d.

Hi Dave, You can use the field_cuts keyword for just such a thing. You can supply multiple strings to be eval'ed in a list. For example, proj = pf.h.proj(0, 'Density', field_cuts=['grid["Density"] > 0.1', 'grid["Density"] < 0.2']) Of course, you could also use one long string connected with ands. This may not be documented, but certainly should be. Britton On Mon, Apr 22, 2013 at 6:00 PM, David Collins <dcollins4096@gmail.com>wrote:
Hi, all--
Can I hand a cut_region to a projection?
I want to make a bunch of projections based on parameters, and don't want to have to instantiate 47 different fields. I'm hoping something like
region = pf.h.all_data().cut_region('grid["Density"] > 0.1 and grid["Density"] < 0.2') proj = pf.h.proj(0,"Density",region=cut_region)
or something like that. Is that possible? I'm poking around the help and source, but no method immediately popped out at me.
Thanks, d.
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

Perfect, thanks, Britton! d. On Mon, Apr 22, 2013 at 6:20 PM, Britton Smith <brittonsmith@gmail.com>wrote:
Hi Dave,
You can use the field_cuts keyword for just such a thing. You can supply multiple strings to be eval'ed in a list. For example,
proj = pf.h.proj(0, 'Density', field_cuts=['grid["Density"] > 0.1', 'grid["Density"] < 0.2'])
Of course, you could also use one long string connected with ands. This may not be documented, but certainly should be.
Britton
On Mon, Apr 22, 2013 at 6:00 PM, David Collins <dcollins4096@gmail.com>wrote:
Hi, all--
Can I hand a cut_region to a projection?
I want to make a bunch of projections based on parameters, and don't want to have to instantiate 47 different fields. I'm hoping something like
region = pf.h.all_data().cut_region('grid["Density"] > 0.1 and grid["Density"] < 0.2') proj = pf.h.proj(0,"Density",region=cut_region)
or something like that. Is that possible? I'm poking around the help and source, but no method immediately popped out at me.
Thanks, d.
_______________________________________________ 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 my computer.

Hi Dave, One last followup here. You should be able to also create your cut region as you described in your original post, and then use the "source" keyword in the projection call. proj = pf.h.proj(0,"Density",source=cut_region) This way is more versatile, since you can do profiling and derived quantities (and eventually rendering) for cut regions, whereas the field_cuts method only applies to projections. Because of this, field_cuts will probably be phased out at some point. Britton On Tue, Apr 23, 2013 at 11:13 AM, David Collins <dcollins@physics.ucsd.edu>wrote:
Perfect, thanks, Britton!
d.
On Mon, Apr 22, 2013 at 6:20 PM, Britton Smith <brittonsmith@gmail.com>wrote:
Hi Dave,
You can use the field_cuts keyword for just such a thing. You can supply multiple strings to be eval'ed in a list. For example,
proj = pf.h.proj(0, 'Density', field_cuts=['grid["Density"] > 0.1', 'grid["Density"] < 0.2'])
Of course, you could also use one long string connected with ands. This may not be documented, but certainly should be.
Britton
On Mon, Apr 22, 2013 at 6:00 PM, David Collins <dcollins4096@gmail.com>wrote:
Hi, all--
Can I hand a cut_region to a projection?
I want to make a bunch of projections based on parameters, and don't want to have to instantiate 47 different fields. I'm hoping something like
region = pf.h.all_data().cut_region('grid["Density"] > 0.1 and grid["Density"] < 0.2') proj = pf.h.proj(0,"Density",region=cut_region)
or something like that. Is that possible? I'm poking around the help and source, but no method immediately popped out at me.
Thanks, d.
_______________________________________________ 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 my computer.
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

That's pretty slick, I'll use that! And that's consistent with my current needs, since I need both projections and analysis of those regions. Thanks, d. On Wed, Apr 24, 2013 at 2:02 PM, Britton Smith <brittonsmith@gmail.com>wrote:
Hi Dave,
One last followup here. You should be able to also create your cut region as you described in your original post, and then use the "source" keyword in the projection call. proj = pf.h.proj(0,"Density",source=cut_region)
This way is more versatile, since you can do profiling and derived quantities (and eventually rendering) for cut regions, whereas the field_cuts method only applies to projections. Because of this, field_cuts will probably be phased out at some point.
Britton
On Tue, Apr 23, 2013 at 11:13 AM, David Collins <dcollins@physics.ucsd.edu
wrote:
Perfect, thanks, Britton!
d.
On Mon, Apr 22, 2013 at 6:20 PM, Britton Smith <brittonsmith@gmail.com>wrote:
Hi Dave,
You can use the field_cuts keyword for just such a thing. You can supply multiple strings to be eval'ed in a list. For example,
proj = pf.h.proj(0, 'Density', field_cuts=['grid["Density"] > 0.1', 'grid["Density"] < 0.2'])
Of course, you could also use one long string connected with ands. This may not be documented, but certainly should be.
Britton
On Mon, Apr 22, 2013 at 6:00 PM, David Collins <dcollins4096@gmail.com>wrote:
Hi, all--
Can I hand a cut_region to a projection?
I want to make a bunch of projections based on parameters, and don't want to have to instantiate 47 different fields. I'm hoping something like
region = pf.h.all_data().cut_region('grid["Density"] > 0.1 and grid["Density"] < 0.2') proj = pf.h.proj(0,"Density",region=cut_region)
or something like that. Is that possible? I'm poking around the help and source, but no method immediately popped out at me.
Thanks, d.
_______________________________________________ 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 my 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 my computer.
participants (3)
-
Britton Smith
-
David Collins
-
David Collins