[yt-users] OffAxisProjection axes problems

Nathan Goldbaum nathan12343 at gmail.com
Mon Jun 6 15:52:43 PDT 2016


>
> On Mon, Jun 6, 2016 at 2:47 PM, Nathan Goldbaum <nathan12343 at gmail.com>
>  wrote:
>
>> Hi Stephanie,
>>
>> So I think I know what's happening here. Here's a reduced, simplified
>> version of your script that illustrates the issue:
>>
>> http://paste.yt-project.org/show/6589/
>>
>
Oops, it looks like I pasted the wrong thing. Here's what I originally
meant to paste:

http://paste.yt-project.org/show/6592/

On Monday, June 6, 2016, Stephanie Tonnesen <stonnes at gmail.com> wrote:

> Hi Nathan,
>
> How do I put in that request?  I am trying to do direct comparisons with
> observations, and unfortunately chose my line of sight axis to be the y
> axis.  In future simulations I can change that, but I agree that this would
> be a nice feature.
>

You can create issues here:

https://bitbucket.org/yt_analysis/yt/issues/new

Mark it as an enhancement for 3.4, and include a link to this e-mail thread:

http://lists.spacepope.org/pipermail/yt-users-spacepope.org/2016-June/007893.html

as well as the test script we came up with:

http://paste.yt-project.org/show/6592/

Unfortunately we have a code freeze coming up starting this Wednesday, so
we may not be able to get to this until after yt 3.3 comes out.

One very hacky, no-good, awful, but perhaps practical way to force the
plots to look how you want them to look would be to make the following
small adjustment to the yt source code:

diff -r 068d09108046 yt/visualization/fixed_resolution.py
--- a/yt/visualization/fixed_resolution.py      Thu Jun 02 11:49:11 2016
-0500
+++ b/yt/visualization/fixed_resolution.py      Mon Jun 06 17:48:27 2016
-0500
@@ -576,7 +576,7 @@ class OffAxisProjectionFixedResolutionBu
                                    interpolated=dd.interpolated,
                                    north_vector=dd.north_vector,
                                    method=dd.method)
-        ia = ImageArray(buff.swapaxes(0,1), info=self._get_info(item))
+        ia = ImageArray(np.fliplr(buff.swapaxes(0,1)),
info=self._get_info(item))
         self[item] = ia
         return ia

That said, having a generic interface for declaring the orientation of
individual plots would definitely be nice...

Thanks!
> Stephanie
>
> --
> Dr. Stephanie Tonnesen
> Alvin E. Nashman Postdoctoral Fellow
> Carnegie Observatories, Pasadena, CA
> stonnes at gmail.com
>
>
>>
>> In this example I've tried to construct the SlicePlot and
>> OffAxisProjectionPlot to be as similar as possible to ease comparison.
>>
>> In your slices, when we you do:
>>
>> ds.coordinates.x_axis[1] = 0
>> ds.coordinates.x_axis['y'] = 0
>> ds.coordinates.y_axis[1] = 2
>> ds.coordinates.y_axis['y'] = 2
>>
>> You're explicitly asking for a non-right handed representation of the
>> simulation's coordinate system. Note that the SlicePlot and
>> OffAxisProjecitonPlot coordinate system *would* line up, if you didn't
>> adjust ds.coordinates.x_axis and ds.coordinates.y_axis, so long as you set
>> north_vector = [1, 0, 0].
>>
>> The trouble for your use comes comes when you try to generate a plot with
>> an inverted coordinate system using OffAxisProjectionPlot. That doesn't
>> work because OffAxisProjectionPlot doesn't have a way to declare the
>> orientation of the plot coordinate system. As you said, if it were possible
>> to specify an east_vector (or a coordinate system orientation) you would be
>> able to work around this. Unfortunately, that's not supported right now.
>>
>> Assuming there isn't anything special about the 'y' axis as opposed to
>> the 'x' axis, I think a simpler way to handle this would be to make plots
>> along the 'x' axis instead of the 'y' axis. Here's an example script that
>> illustrates how the issues you're running into go away when you do that:
>>
>> http://paste.yt-project.org/show/6590/
>>
>> If you *need* to slice along 'y', *and* for the coordinate systems in the
>> two plots to have identical orientations, then we would need to modify
>> OffAxisProjectionPlot to add an API hook that causes the plot orientation
>> to be flipped. I think this is a totally reasonable thing to request as a
>> feature - it's pretty common that people want to do this for SlicePlot and
>> ProjectionPlot along the 'y' axis. Having a general interface for this for
>> all plots would be very useful.
>>
>> -Nathan
>>
>>
>> On Mon, Jun 6, 2016 at 4:12 PM, Stephanie Tonnesen <stonnes at gmail.com>
>> wrote:
>>
>>> Hi Nathan (and anyone reading this string!),
>>>
>>> Sorry it took a little while, but I wrote a short version of the code
>>> that shows the same problem/difference between the y slice and
>>> OffAxisProjection.  The difference is most easily seen comparing the
>>> velocity_x panels it writes out.  You will probably have to change the
>>> exact file path to wherever you keep your IsolatedGalaxy data, but
>>> otherwise it should happily run!  Also, just a note that the zoom is a bit
>>> extreme in the OffAxisProjection, but you still see the problem.
>>>
>>> Thanks,
>>> Stephanie
>>>
>>>
>>> --
>>> Dr. Stephanie Tonnesen
>>> Alvin E. Nashman Postdoctoral Fellow
>>> Carnegie Observatories, Pasadena, CA
>>> stonnes at gmail.com
>>>
>>> On Fri, Jun 3, 2016 at 3:44 PM, Nathan Goldbaum <nathan12343 at gmail.com>
>>> wrote:
>>>
>>>> Is there any chance you can make a self-contained example using one of
>>>> the test datasets on yt-project.org/data? That will make it easier for
>>>> one of us to take a shot at figuring out what's going wrong. I usually use
>>>> "IsolatedGalaxy" - it has a disk in the center of the simulation box with
>>>> an angular momentum vector aligned with the z axis.
>>>>
>>>> On Fri, Jun 3, 2016 at 5:10 PM, Stephanie Tonnesen <stonnes at gmail.com>
>>>> wrote:
>>>>
>>>>> Right, I have my north vector, which I *think* is why my z-axis (Image
>>>>> y) looks correct.  Unfortunately I can't specify an east_vector.  I will
>>>>> keep playing and if I come up with something clever I will let ppl know.
>>>>>
>>>>> Thanks for thinking about this with me!
>>>>>
>>>>> Stephanie
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Dr. Stephanie Tonnesen
>>>>> Alvin E. Nashman Postdoctoral Fellow
>>>>> Carnegie Observatories, Pasadena, CA
>>>>> stonnes at gmail.com
>>>>>
>>>>> On Fri, Jun 3, 2016 at 2:10 PM, Nathan Goldbaum <nathan12343 at gmail.com
>>>>> > wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On Fri, Jun 3, 2016 at 4:08 PM, Stephanie Tonnesen <stonnes at gmail.com
>>>>>> > wrote:
>>>>>>
>>>>>>> Hi Nathan,
>>>>>>>
>>>>>>>
>>>>>>> So I tried two of your ideas, and don't get the last one.
>>>>>>>
>>>>>>> ds.coordinates.x_axis[1] = 0
>>>>>>>>     ds.coordinates.x_axis['y'] = 0
>>>>>>>>     ds.coordinates.y_axis[1] = 2
>>>>>>>>     ds.coordinates.y_axis['y'] = 2
>>>>>>>>
>>>>>>>
>>>>>>> Is the orientation correct (albeit with z along the horizontal axis
>>>>>>> and x along the vertical axis) if you don't do this ^ ?
>>>>>>>
>>>>>>> If I don't do that but still have the same L and north_vector, I get
>>>>>>> the same results.
>>>>>>>
>>>>>>> If I change L = [0,1,0] and north_vector=[0,0,1], I get the same
>>>>>>> results as well.
>>>>>>>
>>>>>>> Ugh!
>>>>>>>
>>>>>>> I am not sure what "x" and "z" fields you think I should be making
>>>>>>> OffAxisProjection s for?  Do you mean have L = [1,0,0] and [0,0,1], or have
>>>>>>> it project an "x" and "z" field onto my off-axis projection?
>>>>>>>
>>>>>>
>>>>>> 'x' and 'z' don't really have a meaning for OffAxisProjectionPlot,
>>>>>> that's why they're dispalyed as "image x" and "image y". However, if you
>>>>>> specify a north_vector, that should disambiguate things.
>>>>>>
>>>>>> It's entirely possible there's a bug here.
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Stephanie
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Dr. Stephanie Tonnesen
>>>>>>> Alvin E. Nashman Postdoctoral Fellow
>>>>>>> Carnegie Observatories, Pasadena, CA
>>>>>>> stonnes at gmail.com
>>>>>>>
>>>>>>> On Thu, Jun 2, 2016 at 5:14 PM, Nathan Goldbaum <
>>>>>>> nathan12343 at gmail.com> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Thu, Jun 2, 2016 at 6:45 PM, Stephanie Tonnesen <
>>>>>>>> stonnes at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hi all,
>>>>>>>>>
>>>>>>>>> The quick summary of what I want to do is switch the coordinates
>>>>>>>>> of the x-axis on a OffAxisProjection plot.  Basically, what I am trying to
>>>>>>>>> do is get a LOS look at a galaxy , so I need a 20 degree tilt in the y-z
>>>>>>>>> plane.  For some reason this is swapping the x-axis direction from my plain
>>>>>>>>> old y slice.  The relevant parts of my code look like this:
>>>>>>>>>
>>>>>>>>> ds.coordinates.x_axis[1] = 0
>>>>>>>>>     ds.coordinates.x_axis['y'] = 0
>>>>>>>>>     ds.coordinates.y_axis[1] = 2
>>>>>>>>>     ds.coordinates.y_axis['y'] = 2
>>>>>>>>>
>>>>>>>>
>>>>>>>> Is the orientation correct (albeit with z along the horizontal axis
>>>>>>>> and x along the vertical axis) if you don't do this ^ ?
>>>>>>>>
>>>>>>>> What happens if you make an off-axis projection aligned with the y
>>>>>>>> axis, i.e. L = [0, 1, 0], north_vector = [0, 0, 1]?
>>>>>>>>
>>>>>>>> Can you try making an off-axis projection of the 'x' and 'z' fields?
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>>     plot6=yt.SlicePlot(ds,"y","density")
>>>>>>>>>     plot6.save()
>>>>>>>>>
>>>>>>>>>     plot8=yt.SlicePlot(ds,"y","velocity_z")
>>>>>>>>>     plot8.save()
>>>>>>>>>
>>>>>>>>>     plot9 = yt.SlicePlot(ds,"y","velocity_y")
>>>>>>>>>     plot9.save()
>>>>>>>>>
>>>>>>>>>     plot10 = yt.SlicePlot(ds,"y","velocity_x")
>>>>>>>>>     plot10.save()
>>>>>>>>>
>>>>>>>>>     ds.periodicity=(True,True,True)
>>>>>>>>>
>>>>>>>>>     L = [0.0,0.93969,-0.342]
>>>>>>>>>     #W = [0.5,0.5,0.5]
>>>>>>>>>     #c = [0.5,0.5,0.5]
>>>>>>>>>     #N = 1028
>>>>>>>>>     north_vector = [0,0.342,0.93969]
>>>>>>>>>     plot12 =
>>>>>>>>> yt.OffAxisProjectionPlot(ds,L,'density',width=(100,'kpc'),north_vector=north_vector)
>>>>>>>>>     plot12.save()
>>>>>>>>>
>>>>>>>>>     plot13 =
>>>>>>>>> yt.OffAxisProjectionPlot(ds,L,'velocity_x',width=(100,'kpc'),north_vector=north_vector)
>>>>>>>>>     plot13.save()
>>>>>>>>>     plot14 =
>>>>>>>>> yt.OffAxisProjectionPlot(ds,L,'velocity_y',width=(100,'kpc'),north_vector=north_vector)
>>>>>>>>>     plot14.save()
>>>>>>>>>     plot15 =
>>>>>>>>> yt.OffAxisProjectionPlot(ds,L,'velocity_z',width=(100,'kpc'),north_vector=north_vector)
>>>>>>>>>     plot15.save()
>>>>>>>>>
>>>>>>>>> I have attached four files:  the slices of velocity_y and
>>>>>>>>> velocity_x and the OffAxisProjections of the same.  You can see that the
>>>>>>>>> x-axis seems to be flipped.  You will also notice that the
>>>>>>>>> OffAxisProjection is more zoomed than the Slice, but don't let this
>>>>>>>>> distract you :)
>>>>>>>>>
>>>>>>>>> I have no idea what has gone wrong here.  Any help, as always, is
>>>>>>>>> really appreciated.
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> Stephanie
>>>>>>>>> --
>>>>>>>>> Dr. Stephanie Tonnesen
>>>>>>>>> Alvin E. Nashman Postdoctoral Fellow
>>>>>>>>> Carnegie Observatories, Pasadena, CA
>>>>>>>>> stonnes at gmail.com
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> yt-users mailing list
>>>>>>>>> yt-users at lists.spacepope.org
>>>>>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> yt-users mailing list
>>>>>>>> yt-users at lists.spacepope.org
>>>>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> yt-users mailing list
>>>>>>> yt-users at lists.spacepope.org
>>>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> yt-users mailing list
>>>>>> yt-users at lists.spacepope.org
>>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> yt-users mailing list
>>>>> yt-users at lists.spacepope.org
>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> yt-users mailing list
>>>> yt-users at lists.spacepope.org
>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>
>>>>
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20160606/3b7e2cc7/attachment-0001.htm>


More information about the yt-users mailing list