[yt-users] FLASH and Off Axis Projections

Jeffrey Alan Gritton jgritton at uga.edu
Thu Jun 11 10:39:11 PDT 2015


Thank you John,


I'm using the second example here, http://yt-project.org/doc/visualizing/plots.html#off-axis-projections. I'm also using version 3.1 of YT.


My FLASH domain is set up as follows,

nblockx        = 2
nblocky        = 1
nblockz        = 5


lrefine_min     = 5
lrefine_max     = 5


xl_boundary_type = "outflow"
xr_boundary_type = "outflow"
yl_boundary_type = "reflect"
yr_boundary_type = "outflow"
zl_boundary_type = "user" #For wind tunnel
zr_boundary_type = "outflow"


This generates a 3D array of [x,y,z]=[256,128,640] cells (20971520 cells in total).



Doing everything from the prompt all I use is:

ds = yt.load("4.2.1_hdf5_plt_cnt_0150")

prj = yt.OffAxisProjectionPlot(ds, [-1,1,0], 'dens')


The "..." from before was just the traceback output which I'll add to the end of this.

By adding a few things to yt.OffAxisProjectionPlot I've generated a few separate errors:

Adding "depth=(0.5,"unitary")" generates the YTUnitOperationError again.

Adding "width=(0.5,"unitary")", similar to the example in the cookbook, generates the periodic boundary error.


Adding both depth and width generates the periodic boundary error as well.

Fooling yt using ds.perodicity = (True,True,True) and using a "width" or "width" and "depth" causes YT to suffer a segmentation fault.


and using ds.perodicity and just "depth" generates the YTUnitOperationError again.


-Jeff




In [8]: prj = yt.OffAxisProjectionPlot(ds, [-1,1,0], 'dens')
---------------------------------------------------------------------------
YTUnitOperationError                      Traceback (most recent call last)
/usr/local/bin/iyt in <module>()
----> 1 prj = yt.OffAxisProjectionPlot(ds, [-1,1,0], 'dens')

/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)
   1442                  le=None, re=None, interpolated=False, fontsize=18, method="integrate"):
   1443         (bounds, center_rot) = \
-> 1444           get_oblique_window_parameters(normal,center,width,ds,depth=depth)
   1445         fields = ensure_list(fields)[:]
   1446         oap_width = ds.arr((bounds[1] - bounds[0],

/usr/local/lib/python2.7/dist-packages/yt/visualization/plot_window.pyc in get_oblique_window_parameters(normal, center, width, ds, depth)
    129 def get_oblique_window_parameters(normal, center, width, ds, depth=None):
    130     display_center, center = ds.coordinates.sanitize_center(center, 4)
--> 131     width = ds.coordinates.sanitize_width(normal, width, depth)
    132
    133     if len(width) == 2:

/usr/local/lib/python2.7/dist-packages/yt/geometry/coordinates/coordinate_handler.pyc in sanitize_width(self, axis, width, depth)
    146                 # axis is actually the normal vector
    147                 # for an off-axis data object.
--> 148                 mi = np.argmin(self.ds.domain_width)
    149                 w = self.ds.domain_width[[mi,mi]]
    150             width = (w[0], w[1])

/usr/lib/python2.7/dist-packages/numpy/core/fromnumeric.pyc in argmin(a, axis)
    752     except AttributeError:
    753         return _wrapit(a, 'argmin', axis)
--> 754     return argmin(axis)
    755
    756

/usr/local/lib/python2.7/dist-packages/yt/units/yt_array.pyc in __rsub__(self, left_object)
    714     def __rsub__(self, left_object):
    715         """ See __sub__. """
--> 716         lo = sanitize_units_add(self, left_object, "subtraction")
    717         return YTArray(super(YTArray, self).__rsub__(lo))
    718

/usr/local/lib/python2.7/dist-packages/yt/units/yt_array.pyc in sanitize_units_add(this_object, other_object, op_string)
    132     else:
    133         if not inp.units.is_dimensionless:
--> 134             raise YTUnitOperationError(op_string, inp.units, dimensionless)
    135     return ret
    136

YTUnitOperationError: The subtraction operator for YTArrays with units (code_length) and (1) is not well defined.

________________________________
From: yt-users <yt-users-bounces at lists.spacepope.org> on behalf of John Zuhone <jzuhone at gmail.com>
Sent: Thursday, June 11, 2015 12:10 PM
To: Discussion of the yt analysis package
Subject: Re: [yt-users] FLASH and Off Axis Projections

Hi Jeff,

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.

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:

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:

prj = yt.OffAxisProjectionPlot(ds, [-1,1,0], 'dens', depth=(0.5,"unitary"))

where "unitary" refers to the size of the domain.

2) You can override the periodicity for the dataset by doing this:

ds.periodicity = (True, True, True)

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.

Best,

John Z

On Jun 11, 2015, at 11:56 AM, Jeffrey Alan Gritton <jgritton at uga.edu<mailto:jgritton at uga.edu>> wrote:

Hi all,

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:

ds = yt.load("4.2.1_hdf5_plt_cnt_0150")
prj = yt.OffAxisProjectionPlot(ds, [-1,1,0], 'dens')
...
...
YTUnitOperationError: The subtraction operator for YTArrays with units (code_length) and (1) is not well defined.


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?


Thank you for your help,

Jeff
_______________________________________________
yt-users mailing list
yt-users at lists.spacepope.org<mailto: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/20150611/54ed8919/attachment.html>


More information about the yt-users mailing list