[yt-svn] commit/yt: MatthewTurk: Merged in jzuhone/yt-3.x/yt-3.0 (pull request #1028)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sat Jul 19 06:42:18 PDT 2014


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/79d45a527246/
Changeset:   79d45a527246
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-07-19 15:42:10
Summary:     Merged in jzuhone/yt-3.x/yt-3.0 (pull request #1028)

Default coordinate for FITSSlice
Affected #:  1 file

diff -r 65543888bc8332f02187bfbf40670bef25e5638b -r 79d45a527246e68113025966a6c35a1a2f97b54d yt/utilities/fits_image.py
--- a/yt/utilities/fits_image.py
+++ b/yt/utilities/fits_image.py
@@ -13,6 +13,7 @@
 import numpy as np
 from yt.funcs import mylog, iterable, fix_axis, ensure_list
 from yt.visualization.fixed_resolution import FixedResolutionBuffer
+from yt.visualization.plot_window import get_sanitized_center
 from yt.data_objects.construction_data_containers import YTCoveringGridBase
 from yt.utilities.on_demand_imports import _astropy
 from yt.units.yt_array import YTQuantity
@@ -293,19 +294,20 @@
         The axis of the slice. One of "x","y","z", or 0,1,2.
     fields : string or list of strings
         The fields to slice
-    coord : float, tuple, or YTQuantity
-        The coordinate of the slice along *axis*. Can be a (value,
-        unit) tuple, a YTQuantity, or a float. If a float, it will be
-        interpreted as in units of code_length.
+    center : A sequence floats, a string, or a tuple.
+         The coordinate of the center of the image. If set to 'c', 'center' or
+         left blank, the plot is centered on the middle of the domain. If set to
+         'max' or 'm', the center will be located at the maximum of the
+         ('gas', 'density') field. Units can be specified by passing in center
+         as a tuple containing a coordinate and string unit name or by passing
+         in a YTArray.  If a list or unitless array is supplied, code units are
+         assumed.
     """
-    def __init__(self, ds, axis, fields, coord, **kwargs):
+    def __init__(self, ds, axis, fields, center="c", **kwargs):
         fields = ensure_list(fields)
         axis = fix_axis(axis, ds)
-        if isinstance(coord, tuple):
-            coord = ds.quan(coord[0], coord[1]).in_units("code_length").value
-        elif isinstance(coord, YTQuantity):
-            coord = coord.in_units("code_length").value
-        slc = ds.slice(axis, coord, **kwargs)
+        center = get_sanitized_center(center, ds)
+        slc = ds.slice(axis, center[axis], **kwargs)
         w, frb = construct_image(slc)
         super(FITSSlice, self).__init__(frb, fields=fields, wcs=w)
         for i, field in enumerate(fields):

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list