Field Cuts in Off-Axis Projections

Hey guys, I've been trying to make slices of density only looking at cooler gas (i.e. with a cut in Temperature). I've found a nice way to do this for simple projections. But my strategy breaks for Off-Axis projections. Specifically, this works fine: * * *field_parameters={'field_cuts':["grid['Temperature'] < 1e6 "]})* *cold_proj = ProjectionPlot(pf,0,'Density',field_parameters=field_parameters)* * * but this does not: *cold_proj = OffAxisProjectionPlot(pf,axis,'Density',north_vector=north,* * field_parameters= field_parameters)* sensibly enough, since field_parameters is not a keyword argument for off axis projections. Is there a decent workaround for this? Or would this be simple to add into yt's functionality? I've looked briefly into the source<http://yt-project.org/doc/_modules/yt/visualization/plot_window.html#OffAxisProjectionPlot.__init__>and it doesn't seem obvious how to slip this in. thanks! Munier -- Munier A. Salem // 845.489.6450

Hi Munier, Unfortunately I don't think that's possible at the moment. OffAxisProjectionPlot uses the volume renderer behind the scenes to actually calculate the projections and right now the volume renderer doesn't support arbitrary data sources, although I think Sam wants to add this functionality in the medium term. If the field cut you're using is based on a geometric constraint, it might be possible to hack something together using a covering grid, but if it's based on a field value I'm not sure how that would work currently. Sorry for the seemingly arbitrary limitation :( -Nathan On Wed, Aug 7, 2013 at 11:37 AM, Munier Azzam Salem < msalem@astro.columbia.edu> wrote:
Hey guys,
I've been trying to make slices of density only looking at cooler gas (i.e. with a cut in Temperature). I've found a nice way to do this for simple projections. But my strategy breaks for Off-Axis projections.
Specifically, this works fine: * * *field_parameters={'field_cuts':["grid['Temperature'] < 1e6 "]})* *cold_proj = ProjectionPlot(pf,0,'Density',field_parameters=field_parameters)* * *
but this does not:
*cold_proj = OffAxisProjectionPlot(pf,axis,'Density',north_vector=north,* * field_parameters= field_parameters)*
sensibly enough, since field_parameters is not a keyword argument for off axis projections.
Is there a decent workaround for this? Or would this be simple to add into yt's functionality? I've looked briefly into the source<http://yt-project.org/doc/_modules/yt/visualization/plot_window.html#OffAxisProjectionPlot.__init__>and it doesn't seem obvious how to slip this in.
thanks! Munier
-- Munier A. Salem // 845.489.6450
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

On Wed, Aug 7, 2013 at 2:42 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Munier,
Unfortunately I don't think that's possible at the moment. OffAxisProjectionPlot uses the volume renderer behind the scenes to actually calculate the projections and right now the volume renderer doesn't support arbitrary data sources, although I think Sam wants to add this functionality in the medium term.
If the field cut you're using is based on a geometric constraint, it might be possible to hack something together using a covering grid, but if it's based on a field value I'm not sure how that would work currently.
Sorry for the seemingly arbitrary limitation :(
I also recently ran into this a few weeks ago. The OffAxisProjectionCamera object has the facility (in both 2.x and 3.0, but considerably easier in 3.0) to do something like this, since it already iterates over source and gets masks back. For 3.0 this would be a matter of simply passing a source through into the OffAxisProjectionCamera and then around line 2200 of camera.py having it default to using the supplied source rather than creating a region. -Matt
-Nathan
On Wed, Aug 7, 2013 at 11:37 AM, Munier Azzam Salem <msalem@astro.columbia.edu> wrote:
Hey guys,
I've been trying to make slices of density only looking at cooler gas (i.e. with a cut in Temperature). I've found a nice way to do this for simple projections. But my strategy breaks for Off-Axis projections.
Specifically, this works fine:
field_parameters={'field_cuts':["grid['Temperature'] < 1e6 "]}) cold_proj = ProjectionPlot(pf,0,'Density',field_parameters=field_parameters)
but this does not:
cold_proj = OffAxisProjectionPlot(pf,axis,'Density',north_vector=north, field_parameters= field_parameters)
sensibly enough, since field_parameters is not a keyword argument for off axis projections.
Is there a decent workaround for this? Or would this be simple to add into yt's functionality? I've looked briefly into the source and it doesn't seem obvious how to slip this in.
thanks! Munier
-- Munier A. Salem // 845.489.6450
_______________________________________________ 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

On 07.08.2013 20:37, Munier Azzam Salem wrote:
Hey guys,
I've been trying to make slices of density only looking at cooler gas (i.e. with a cut in Temperature). I've found a nice way to do this for simple projections. But my strategy breaks for Off-Axis projections.
Specifically, this works fine: * * *field_parameters={'field_cuts':["grid['Temperature'] < 1e6 "]})* *cold_proj = ProjectionPlot(pf,0,'Density',field_parameters=field_parameters)* * *
but this does not:
*cold_proj = OffAxisProjectionPlot(pf,axis,'Density',north_vector=north,* * field_parameters= field_parameters)*
sensibly enough, since field_parameters is not a keyword argument for off axis projections.
Is there a decent workaround for this? Or would this be simple to add into yt's functionality?
Hi, I think that you could define auxiliary derived field like @derived_field(name = "cut_dens", validators = [ValidateSpatial(1)], units = r"g/cm^3") def _cut_dens(field, data): cut = data['Density'].copy() cut[data['Temperature'] < 1.0e6] = 0.0 return cut and make OffAxisProjection of that. Cheers, Kacper

Thanks Guys, Kacper, that looks like a work-around for now, thanks. Munier On Wed, Aug 7, 2013 at 2:53 PM, Kacper Kowalik <xarthisius.kk@gmail.com>wrote:
On 07.08.2013 20:37, Munier Azzam Salem wrote:
Hey guys,
I've been trying to make slices of density only looking at cooler gas (i.e. with a cut in Temperature). I've found a nice way to do this for simple projections. But my strategy breaks for Off-Axis projections.
Specifically, this works fine: * * *field_parameters={'field_cuts':["grid['Temperature'] < 1e6 "]})* *cold_proj = ProjectionPlot(pf,0,'Density',field_parameters=field_parameters)* * *
but this does not:
*cold_proj = OffAxisProjectionPlot(pf,axis,'Density',north_vector=north,* * field_parameters= field_parameters)*
sensibly enough, since field_parameters is not a keyword argument for off axis projections.
Is there a decent workaround for this? Or would this be simple to add into yt's functionality?
Hi, I think that you could define auxiliary derived field like
@derived_field(name = "cut_dens", validators = [ValidateSpatial(1)], units = r"g/cm^3") def _cut_dens(field, data): cut = data['Density'].copy() cut[data['Temperature'] < 1.0e6] = 0.0 return cut
and make OffAxisProjection of that. Cheers, Kacper
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Munier A. Salem // 845.489.6450

Munier, I think there is a way to do what you want. It involves using the HomogenizedVolume class (as opposed to the newer KDTree class) for decomposing the volume before raycasting in the camera object. I have an old script that did this, but I just tested it out, and it no longer works in the current yt paradigm. I poked around and cannot seem to get it to work to do what you want. Unfortunately, the main point of contact on the HomogenizedVolume class is Matt, and he's currently on his honeymoon for a few weeks. Furthermore, I think the path forward in yt was for completely doing away with the HomogenizedVolume class in the near future, as it is now almost a subclass of functionality of the kdtree. I think one of the main pieces of functionality that was holding up this changeover was that which you have discovered--being able to specify data sources to the camera object for rendering, as Nathan alluded to above. Sam, what is the status of the kdtree being able to handle arbitrary data sources for rendering? For reference, I've attached a modified form of my old script (along with some comments for options that wouldn't successfully run) which could do this circa 1.5 years ago here: http://paste.yt-project.org/show/3750/ Cameron On Wed, Aug 7, 2013 at 11:57 AM, Munier Azzam Salem < msalem@astro.columbia.edu> wrote:
Thanks Guys,
Kacper, that looks like a work-around for now, thanks.
Munier
On Wed, Aug 7, 2013 at 2:53 PM, Kacper Kowalik <xarthisius.kk@gmail.com>wrote:
On 07.08.2013 20:37, Munier Azzam Salem wrote:
Hey guys,
I've been trying to make slices of density only looking at cooler gas (i.e. with a cut in Temperature). I've found a nice way to do this for simple projections. But my strategy breaks for Off-Axis projections.
Specifically, this works fine: * * *field_parameters={'field_cuts':["grid['Temperature'] < 1e6 "]})* *cold_proj = ProjectionPlot(pf,0,'Density',field_parameters=field_parameters)* * *
but this does not:
*cold_proj = OffAxisProjectionPlot(pf,axis,'Density',north_vector=north,* * field_parameters= field_parameters)*
sensibly enough, since field_parameters is not a keyword argument for off axis projections.
Is there a decent workaround for this? Or would this be simple to add into yt's functionality?
Hi, I think that you could define auxiliary derived field like
@derived_field(name = "cut_dens", validators = [ValidateSpatial(1)], units = r"g/cm^3") def _cut_dens(field, data): cut = data['Density'].copy() cut[data['Temperature'] < 1.0e6] = 0.0 return cut
and make OffAxisProjection of that. Cheers, Kacper
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Munier A. Salem // 845.489.6450
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Cameron Hummels Postdoctoral Researcher Steward Observatory University of Arizona http://chummels.org

Hi all, I think for the idea of field cuts, the solution Kacper is the right way to go. Since the OffAxisProjection plots don't do vertex-centering, it should be equivalent to doing the field cuts as a data source object. As for going forward, HomogenizedVolume is deprecated. For the purposes of volume rendering arbitrary data sources, this is on my immediate todo list. Off-axis projections should gain the same type of functionality as that is implemented. The primary road block is determining exactly how the the starting and stopping criteria should function for arbitrary data sources. There is a fast/easy way and a difficult/more accurate method of doing so. I've done the fast/easy method in a few incarnations and am ~80% happy with it. Sam On Wed, Aug 7, 2013 at 2:32 PM, Cameron Hummels <chummels@gmail.com> wrote:
Munier,
I think there is a way to do what you want. It involves using the HomogenizedVolume class (as opposed to the newer KDTree class) for decomposing the volume before raycasting in the camera object. I have an old script that did this, but I just tested it out, and it no longer works in the current yt paradigm. I poked around and cannot seem to get it to work to do what you want. Unfortunately, the main point of contact on the HomogenizedVolume class is Matt, and he's currently on his honeymoon for a few weeks. Furthermore, I think the path forward in yt was for completely doing away with the HomogenizedVolume class in the near future, as it is now almost a subclass of functionality of the kdtree. I think one of the main pieces of functionality that was holding up this changeover was that which you have discovered--being able to specify data sources to the camera object for rendering, as Nathan alluded to above. Sam, what is the status of the kdtree being able to handle arbitrary data sources for rendering?
For reference, I've attached a modified form of my old script (along with some comments for options that wouldn't successfully run) which could do this circa 1.5 years ago here: http://paste.yt-project.org/show/3750/
Cameron
On Wed, Aug 7, 2013 at 11:57 AM, Munier Azzam Salem < msalem@astro.columbia.edu> wrote:
Thanks Guys,
Kacper, that looks like a work-around for now, thanks.
Munier
On Wed, Aug 7, 2013 at 2:53 PM, Kacper Kowalik <xarthisius.kk@gmail.com>wrote:
On 07.08.2013 20:37, Munier Azzam Salem wrote:
Hey guys,
I've been trying to make slices of density only looking at cooler gas (i.e. with a cut in Temperature). I've found a nice way to do this for simple projections. But my strategy breaks for Off-Axis projections.
Specifically, this works fine: * * *field_parameters={'field_cuts':["grid['Temperature'] < 1e6 "]})* *cold_proj = ProjectionPlot(pf,0,'Density',field_parameters=field_parameters)* * *
but this does not:
*cold_proj = OffAxisProjectionPlot(pf,axis,'Density',north_vector=north,* * field_parameters= field_parameters)*
sensibly enough, since field_parameters is not a keyword argument for off axis projections.
Is there a decent workaround for this? Or would this be simple to add into yt's functionality?
Hi, I think that you could define auxiliary derived field like
@derived_field(name = "cut_dens", validators = [ValidateSpatial(1)], units = r"g/cm^3") def _cut_dens(field, data): cut = data['Density'].copy() cut[data['Temperature'] < 1.0e6] = 0.0 return cut
and make OffAxisProjection of that. Cheers, Kacper
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Munier A. Salem // 845.489.6450
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Cameron Hummels Postdoctoral Researcher Steward Observatory University of Arizona http://chummels.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (6)
-
Cameron Hummels
-
Kacper Kowalik
-
Matthew Turk
-
Munier Azzam Salem
-
Nathan Goldbaum
-
Sam Skillman