<div dir="ltr">The issue (as you may have guessed) is that the units aren't agreeing in this example.  Try this:<div><br></div><div>L = ds.arr([-1, 1, 0], 'code_length') # this explicltly sets the projection vector to be in code length instead of unitary</div><div><span style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">yt.OffAxisProjectionPlot(ds, L, 'dens')</span><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 11, 2015 at 10:39 AM, Jeffrey Alan Gritton <span dir="ltr"><<a href="mailto:jgritton@uga.edu" target="_blank">jgritton@uga.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Thank you John,</p>
<p><br>
</p>
<p>I'm using the second example here, <a href="http://yt-project.org/doc/visualizing/plots.html#off-axis-projections" target="_blank">
http://yt-project.org/doc/visualizing/plots.html#off-axis-projections</a>. I'm also using version 3.1 of YT.
<br>
</p>
<p><br>
</p>
<p>My FLASH domain is set up as follows,<br>
</p>
<p>nblockx        = 2 <br>
nblocky        = 1<br>
nblockz        = 5<br>
</p>
<p><br>
</p>
<p>lrefine_min     = 5<br>
lrefine_max     = 5<br>
</p>
<p><br>
</p>
<p>xl_boundary_type = "outflow" <br>
xr_boundary_type = "outflow" <br>
yl_boundary_type = "reflect" <br>
yr_boundary_type = "outflow" <br>
zl_boundary_type = "user" #For wind tunnel<br>
zr_boundary_type = "outflow"</p>
<p><br>
</p>
<p>This generates a 3D array of [x,y,z]=[256,128,640] cells (20971520 cells in total).
</p>
<p><br>
</p>
<p><br>
</p>
<p>Doing everything from the prompt all I use is: <br><span class="">
<br>
ds = yt.load("4.2.1_hdf5_plt_cnt_0150") </span></p><span class="">
<p>prj = yt.OffAxisProjectionPlot(ds, [-1,1,0], 'dens')<br>
</p>
<p><br>
</p>
</span><p>The "..." from before was just the traceback output which I'll add to the end of this.
</p>
<p><br>
By adding a few things to yt.OffAxisProjectionPlot I've generated a few separate errors:<br>
<br>
Adding "depth=(0.5,"unitary")" generates the YTUnitOperationError again.<br>
<br>
Adding "width=(0.5,"unitary")", similar to the example in the cookbook, generates the periodic boundary error.</p>
<p><br>
</p>
<p>Adding both depth and width generates the periodic boundary error as well.   <br>
<br>
Fooling yt using ds.perodicity = (True,True,True) and using a "width" or "width" and "depth" causes YT to suffer a segmentation fault.<br>
</p>
<p><br>
</p>
<p>and using ds.perodicity and just "depth" generates the YTUnitOperationError again.
</p>
<p><br>
</p>
<p>-Jeff<br>
<br>
<br>
<br>
<br>
In [8]: prj = yt.OffAxisProjectionPlot(ds, [-1,1,0], 'dens')<br>
---------------------------------------------------------------------------<br>
YTUnitOperationError                      Traceback (most recent call last)<br>
/usr/local/bin/iyt in <module>()<br>
----> 1 prj = yt.OffAxisProjectionPlot(ds, [-1,1,0], 'dens')<br>
<br>
/usr/local/lib/python2.7/dist-packages/yt/visualization/plot_window.pyc in __init__(self, ds, normal, fields, center, width, depth, axes_unit, weight_field, max_level, north_vector, volume, no_ghost, le, re, interpolated, fontsize, method)<br>
   1442                  le=None, re=None, interpolated=False, fontsize=18, method="integrate"):<br>
   1443         (bounds, center_rot) = \<br>
-> 1444           get_oblique_window_parameters(normal,center,width,ds,depth=depth)<br>
   1445         fields = ensure_list(fields)[:]<br>
   1446         oap_width = ds.arr((bounds[1] - bounds[0],<br>
<br>
/usr/local/lib/python2.7/dist-packages/yt/visualization/plot_window.pyc in get_oblique_window_parameters(normal, center, width, ds, depth)<br>
    129 def get_oblique_window_parameters(normal, center, width, ds, depth=None):<br>
    130     display_center, center = ds.coordinates.sanitize_center(center, 4)<br>
--> 131     width = ds.coordinates.sanitize_width(normal, width, depth)<br>
    132 <br>
    133     if len(width) == 2:<br>
<br>
/usr/local/lib/python2.7/dist-packages/yt/geometry/coordinates/coordinate_handler.pyc in sanitize_width(self, axis, width, depth)<br>
    146                 # axis is actually the normal vector<br>
    147                 # for an off-axis data object.<br>
--> 148                 mi = np.argmin(self.ds.domain_width)<br>
    149                 w = self.ds.domain_width[[mi,mi]]<br>
    150             width = (w[0], w[1])<br>
<br>
/usr/lib/python2.7/dist-packages/numpy/core/fromnumeric.pyc in argmin(a, axis)<br>
    752     except AttributeError:<br>
    753         return _wrapit(a, 'argmin', axis)<br>
--> 754     return argmin(axis)<br>
    755 <br>
    756 <br>
<br>
/usr/local/lib/python2.7/dist-packages/yt/units/yt_array.pyc in __rsub__(self, left_object)<br>
    714     def __rsub__(self, left_object):<br>
    715         """ See __sub__. """<br>
--> 716         lo = sanitize_units_add(self, left_object, "subtraction")<br>
    717         return YTArray(super(YTArray, self).__rsub__(lo))<br>
    718 <br>
<br>
/usr/local/lib/python2.7/dist-packages/yt/units/yt_array.pyc in sanitize_units_add(this_object, other_object, op_string)<br>
    132     else:<br>
    133         if not inp.units.is_dimensionless:<br>
--> 134             raise YTUnitOperationError(op_string, inp.units, dimensionless)<br>
    135     return ret<br>
    136 <br><span class="">
<br>
YTUnitOperationError: The subtraction operator for YTArrays with units (code_length) and (1) is not well defined.<br>
</span></p>
<div style="word-wrap:break-word;color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> yt-users <<a href="mailto:yt-users-bounces@lists.spacepope.org" target="_blank">yt-users-bounces@lists.spacepope.org</a>> on behalf of John Zuhone <<a href="mailto:jzuhone@gmail.com" target="_blank">jzuhone@gmail.com</a>><br>
<b>Sent:</b> Thursday, June 11, 2015 12:10 PM<br>
<b>To:</b> Discussion of the yt analysis package<br>
<b>Subject:</b> Re: [yt-users] FLASH and Off Axis Projections</font>
<div> </div>
</div><div><div class="h5">
<div>Hi Jeff,
<div><br>
</div>
<div>Which cookbook example are you using? I think you might have to paste the script in full that shows the YTUnitOperationError, because I can’t produce that one over here with a FLASH dataset I have using the two lines you posted. </div>
<div><br>
</div>
<div>As far as the indices/periodic boundaries error, I have seen this one before, and it has to do with the fact that when you project along the whole depth of the domain, to do the off-axis projection it wants to create guard cells that are outside
 the domain, and it doesn’t know how to do that unless the boundary is periodic. This is something we probably need to fix for non-periodic datasets. You can do two things here:</div>
<div><br>
</div>
<div>1) You can adjust the depth of the projection so it doesn’t span the entire domain, by changing the “depth” of the projection. This example only projects through half the domain size:</div>
<div><br>
</div>
<div>prj = yt.OffAxisProjectionPlot(ds, [-1,1,0], 'dens', depth=(0.5,"unitary”))</div>
<div><br>
</div>
<div>where “unitary” refers to the size of the domain. </div>
<div><br>
</div>
<div>2) You can override the periodicity for the dataset by doing this:</div>
<div><br>
</div>
<div>ds.periodicity = (True, True, True)</div>
<div><br>
</div>
<div>which will fool yt into thinking the domain is periodic. Depending on what your data is like, the resulting image would probably be fine, especially if the stuff on the edges is of low significance. </div>
<div><br>
</div>
<div>Best,</div>
<div><br>
</div>
<div>John Z</div>
<div><br>
</div>
<div>
<div>
<blockquote type="cite">
<div>On Jun 11, 2015, at 11:56 AM, Jeffrey Alan Gritton <<a href="mailto:jgritton@uga.edu" target="_blank">jgritton@uga.edu</a>> wrote:</div>
<br>
<div>
<div style="font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:12pt;background-color:rgb(255,255,255);font-family:Calibri,Arial,Helvetica,sans-serif">
<div style="margin-top:0px;margin-bottom:0px">Hi all,</div>
<div style="margin-top:0px;margin-bottom:0px"><br>
</div>
<div style="margin-top:0px;margin-bottom:0px">I'm having a bit of a problem with off axis projections and my FLASH domains. I want to create an off axis projection for the entire domain. However, I try to follow the Cookbook I run into one of two
 errors. The first being:</div>
<div style="margin-top:0px;margin-bottom:0px"><br>
</div>
<div style="margin-top:0px;margin-bottom:0px">ds = yt.load("4.2.1_hdf5_plt_cnt_0150")</div>
<div style="margin-top:0px;margin-bottom:0px">prj = yt.OffAxisProjectionPlot(ds, [-1,1,0], 'dens')<br>
...</div>
<div style="margin-top:0px;margin-bottom:0px">...<br>
</div>
<div style="margin-top:0px;margin-bottom:0px">YTUnitOperationError: The subtraction operator for YTArrays with units (code_length) and (1) is not well defined.<br>
<br>
<br>
The second I can't recreate at the moment but yt throws an error back complaining about accessing indicies outside of the array and suggests overriding periodic boundaries. My domain has no periodic boundaries. Has anyone ever run into this?</div>
<div style="margin-top:0px;margin-bottom:0px"><br>
</div>
<div style="margin-top:0px;margin-bottom:0px"><br>
</div>
<div style="margin-top:0px;margin-bottom:0px">Thank you for your help,</div>
<div style="margin-top:0px;margin-bottom:0px"><br>
</div>
<div style="margin-top:0px;margin-bottom:0px">Jeff<br>
</div>
</div>
<span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">_______________________________________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">yt-users
 mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<a href="mailto:yt-users@lists.spacepope.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">yt-users@lists.spacepope.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a></div>
</blockquote>
</div>
<br>
</div>
</div>
</div></div></div>
</div>
</div>

<br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Cameron Hummels<div>Postdoctoral Researcher</div><div>Steward Observatory</div><div>University of Arizona</div><div><a href="http://chummels.org" target="_blank">http://chummels.org</a></div></div>
</div>