<html><body>
<p>2 new commits in yt:</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/f161eabb0594/">https://bitbucket.org/yt_analysis/yt/commits/f161eabb0594/</a> Changeset:   f161eabb0594 Branch:      yt User:        jzuhone Date:        2016-04-08 13:54:49+00:00 Summary:     Hacky way to “inherit” from satrapy's HDUList class Affected #:  2 files</p>
<p>diff -r c7470f10bdc0a7851036a0baa30d88f1d65e4c9c -r f161eabb059434279cc5bfa43030d3b1acc1ad5f doc/source/visualizing/FITSImageData.ipynb --- a/doc/source/visualizing/FITSImageData.ipynb +++ b/doc/source/visualizing/FITSImageData.ipynb @@ -87,7 +87,7 @@</p>
<pre>"cell_type": "markdown",
"metadata": {},
"source": [</pre>
<ul><li><p>"Because `FITSImageData` inherits from the [AstroPy `HDUList`](<a href="http://astropy.readthedocs.org/en/latest/io/fits/api/hdulists.html">http://astropy.readthedocs.org/en/latest/io/fits/api/hdulists.html</a>) class, we can call its methods. For example, `info` shows us the contents of the virtual FITS <a href="file://">file:</a>"</p></li></ul>
<p>+    "We can call a number of the [AstroPy `HDUList`](<a href="http://astropy.readthedocs.org/en/latest/io/fits/api/hdulists.html">http://astropy.readthedocs.org/en/latest/io/fits/api/hdulists.html</a>) class's methods from a `FITSImageData` object. For example, `info` shows us the contents of the virtual FITS <a href="file://">file:</a>"</p>
<pre> ]
},
{</pre>
<p>@@ -416,21 +416,21 @@</p>
<pre>],
"metadata": {
 "kernelspec": {</pre>
<ul><li><p>“display_name”: “Python 3”,</p></li></ul>
<p>+   “display_name”: “Python 2”,</p>
<pre>"language": "python",</pre>
<ul><li><p>“name”: “python3”</p></li></ul>
<p>+   “name”: “python2”</p>
<pre>},
"language_info": {
 "codemirror_mode": {
  "name": "ipython",</pre>
<ul><li><p>“version”: 3</p></li></ul>
<p>+    “version”: 2</p>
<pre>},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",</pre>
<ul><li><p>“pygments_lexer”: “ipython3”,</p></li>
<li><p>“version”: “3.5.1”</p></li></ul>
<p>+   “pygments_lexer”: “ipython2”, +   “version”: “2.7.11”</p>
<pre> }
},
"nbformat": 4,</pre>
<p>diff -r c7470f10bdc0a7851036a0baa30d88f1d65e4c9c -r f161eabb059434279cc5bfa43030d3b1acc1ad5f yt/utilities/fits_image.py --- a/yt/utilities/fits_image.py +++ b/yt/utilities/fits_image.py @@ -22,15 +22,7 @@</p>
<pre>from yt.visualization.volume_rendering.off_axis_projection import off_axis_projection
import re
</pre>
<p>-pyfits = _astropy.pyfits -pywcs = _astropy.pywcs – -if isinstance(pyfits, NotAModule):</p>
<ul><li><p>HDUList = object</p></li></ul>
<p>-else:</p>
<ul><li><p>HDUList = pyfits.HDUList</p></li></ul>
<p>– -class FITSImageData(HDUList): +class FITSImageData(object):</p>
<pre>def __init__(self, data, fields=None, units=None, width=None, wcs=None):
    r""" Initialize a FITSImageData object.</pre>
<p>@@ -92,7 +84,7 @@</p>
<pre>        exclude_fields = ['x','y','z','px','py','pz',
                          'pdx','pdy','pdz','weight_field']
</pre>
<ul><li><p>super(FITSImageData, self).__init__()</p></li></ul>
<p>+        self.hdulist = _astropy.pyfits.HDUList()</p>
<pre>         if isinstance(fields, string_types):
fields = [fields]</pre>
<p>@@ -127,21 +119,21 @@</p>
<pre>    self.field_units[key] = "dimensionless"
mylog.info("Making a FITS image of field %s" % key)
if first:</pre>
<ul><li><p>hdu = pyfits.PrimaryHDU(np.array(img_data[key]))</p></li></ul>
<p>+                    hdu = _astropy.pyfits.PrimaryHDU(np.array(img_data[key]))</p>
<pre>    first = False
else:</pre>
<ul><li><p>hdu = pyfits.ImageHDU(np.array(img_data[key]))</p></li></ul>
<p>+                    hdu = _astropy.pyfits.ImageHDU(np.array(img_data[key]))</p>
<pre>hdu.name = key
hdu.header["btype"] = key
if hasattr(img_data[key], "units"):
    hdu.header["bunit"] = re.sub('()', '', str(img_data[key].units))</pre>
<ul><li><p>self.append(hdu)</p></li></ul>
<p>+                self.hdulist.append(hdu)</p>
<ul><li><p>self.shape = self[0].shape</p></li></ul>
<p>+        self.shape = self.hdulist[0].shape</p>
<pre>        self.dimensionality = len(self.shape)

        if wcs is None:</pre>
<ul><li><p>w = pywcs.WCS(header=self[0].header, naxis=self.dimensionality)</p></li></ul>
<p>+            w = _astropy.pywcs.WCS(header=self.hdulist[0].header, naxis=self.dimensionality)</p>
<pre>if isinstance(img_data, FixedResolutionBuffer):
    # FRBs are a special case where we have coordinate
    # information, so we take advantage of this and</pre>
<p>@@ -181,7 +173,7 @@</p>
<pre>"""
self.wcs = wcs
h = self.wcs.to_header()</pre>
<ul><li><p>for img in self:</p></li></ul>
<p>+        for img in self.hdulist:</p>
<pre>            for k, v in h.items():
                img.header[k] = v
</pre>
<p>@@ -192,13 +184,13 @@</p>
<pre>headers will be updated.
"""
if field == "all":</pre>
<ul><li><p>for img in self:</p></li></ul>
<p>+            for img in self.hdulist:</p>
<pre>    img.header[key] = value
         else:
if field not in self.keys():
    raise KeyError("%s not an image!" % field)
idx = self.fields.index(field)</pre>
<ul><li><p>self[idx].header[key] = value</p></li></ul>
<p>+            self.hdulist[idx].header[key] = value</p>
<pre>def update_all_headers(self, key, value):
    mylog.warning("update_all_headers is deprecated. "+</pre>
<p>@@ -212,10 +204,16 @@</p>
<pre>        return key in self.fields

    def values(self):</pre>
<ul><li><p>return [self[k] for k in self.fields]</p></li></ul>
<p>+        return [self.hdulist[k] for k in self.fields]</p>
<pre>def items(self):</pre>
<ul><li><p>return [(k, self[k]) for k in self.fields]</p></li></ul>
<p>+        return [(k, self.hdulist[k]) for k in self.fields] + +    def __getitem__(self, item): +        return self.hdulist[item] + +    def info(self): +        return self.hdulist.info()</p>
<pre>@parallel_root_only
def writeto(self, fileobj, fields=None, clobber=False, **kwargs):</pre>
<p>@@ -236,11 +234,11 @@</p>
<pre>method of `astropy.io.fits.HDUList`.
"""
if fields is None:</pre>
<ul><li><p>hdus = pyfits.HDUList(self)</p></li></ul>
<p>+            hdus = self.hdulist</p>
<pre>else:</pre>
<ul><li><p>hdus = pyfits.HDUList()</p></li></ul>
<p>+            hdus = _astropy.pyfits.HDUList()</p>
<pre>for field in fields:</pre>
<ul><li><p>hdus.append(self[field])</p></li></ul>
<p>+                hdus.append(self.hdulist[field])</p>
<pre>        hdus.writeto(fileobj, clobber=clobber, **kwargs)

    def to_glue(self, label="yt", data_collection=None):</pre>
<p>@@ -256,7 +254,7 @@</p>
<pre>image = Data(label=label)
image.coords = coordinates_from_header(self.wcs.to_header())</pre>
<ul><li><p>for k,f in self.items():</p></li></ul>
<p>+        for k,f in self.hdulist.items():</p>
<pre>image.add_component(f.data, k)
         if data_collection is None:
dc = DataCollection([image])</pre>
<p>@@ -272,14 +270,14 @@</p>
<pre>`aplpy.FITSFigure` constructor.
"""
import aplpy</pre>
<ul><li><p>return aplpy.FITSFigure(self, **kwargs)</p></li></ul>
<p>+        return aplpy.FITSFigure(self.hdulist, **kwargs)</p>
<pre>def get_data(self, field):
    """
    Return the data array of the image corresponding to *field*
    with units attached.
    """</pre>
<ul><li><p>return YTArray(self[field].data, self.field_units[field])</p></li></ul>
<p>+        return YTArray(self.hdulist[field].data, self.field_units[field])</p>
<pre>def set_unit(self, field, units):
    """</pre>
<p>@@ -288,9 +286,9 @@</p>
<pre>         if field not in self.keys():
raise KeyError("%s not an image!" % field)
         idx = self.fields.index(field)</pre>
<ul><li><p>new_data = YTArray(self[idx].data, self.field_units[field]).in_units(units)</p></li>
<li><p>self[idx].data = new_data.v</p></li>
<li><p>self[idx].header["bunit"] = units</p></li></ul>
<p>+        new_data = YTArray(self.hdulist[idx].data, self.field_units[field]).in_units(units) +        self.hdulist[idx].data = new_data.v +        self.hdulist[idx].header["bunit"] = units</p>
<pre>        self.field_units[field] = units

    def pop(self, key):</pre>
<p>@@ -302,7 +300,7 @@</p>
<pre>         if key not in self.keys():
raise KeyError("%s not an image!" % key)
         idx = self.fields.index(key)</pre>
<ul><li><p>im = super(FITSImageData, self).pop(idx)</p></li></ul>
<p>+        im = self.hdulist.pop(idx)</p>
<pre>data = YTArray(im.data, self.field_units[key])
self.field_units.pop(key)
self.fields.remove(key)</pre>
<p>@@ -319,12 +317,12 @@</p>
<pre>         filename : string
The name of the file to open.
         """</pre>
<ul><li><p>f = pyfits.open(filename)</p></li></ul>
<p>+        f = _astropy.pyfits.open(filename)</p>
<pre>         data = {}
         for hdu in f:
data[hdu.header["btype"]] = YTArray(hdu.data, hdu.header["bunit"])
         f.close()</pre>
<ul><li><p>return cls(data, wcs=pywcs.WCS(header=hdu.header))</p></li></ul>
<p>+        return cls(data, wcs=_astropy.pywcs.WCS(header=hdu.header))</p>
<pre>@classmethod
def from_images(cls, image_list):</pre>
<p>@@ -385,7 +383,7 @@</p>
<pre>units = [str(unit) for unit in old_wcs.wcs.cunit]
new_dx = (YTQuantity(-deltas[0], units[0])*scaleq).in_units("deg")
new_dy = (YTQuantity(deltas[1], units[1])*scaleq).in_units("deg")</pre>
<ul><li><p>new_wcs = pywcs.WCS(naxis=naxis)</p></li></ul>
<p>+        new_wcs = _astropy.pywcs.WCS(naxis=naxis)</p>
<pre>cdelt = [new_dx.v, new_dy.v]
cunit = ["deg"]*2
if naxis == 3:</pre>
<p>@@ -470,7 +468,7 @@</p>
<pre>frb = data_source.to_frb(width[0], (nx, ny), center=center, height=width[1])
     else:
         frb = None</pre>
<ul><li><p>w = pywcs.WCS(naxis=2)</p></li></ul>
<p>+    w = _astropy.pywcs.WCS(naxis=2)</p>
<pre>w.wcs.crpix = crpix
w.wcs.cdelt = cdelt
w.wcs.crval = crval</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/74a90987f18b/">https://bitbucket.org/yt_analysis/yt/commits/74a90987f18b/</a> Changeset:   74a90987f18b Branch:      yt User:        jzuhone Date:        2016-04-08 23:42:32+00:00 Summary:     Fix unwanted notebook changes. Fix flake8 error. Affected #:  2 files</p>
<p>diff -r f161eabb059434279cc5bfa43030d3b1acc1ad5f -r 74a90987f18bddc2d00a080aaed6aab7036d77ed doc/source/visualizing/FITSImageData.ipynb --- a/doc/source/visualizing/FITSImageData.ipynb +++ b/doc/source/visualizing/FITSImageData.ipynb @@ -416,21 +416,21 @@</p>
<pre>],
"metadata": {
 "kernelspec": {</pre>
<ul><li><p>“display_name”: “Python 2”,</p></li></ul>
<p>+   “display_name”: “Python 3”,</p>
<pre>"language": "python",</pre>
<ul><li><p>“name”: “python2”</p></li></ul>
<p>+   “name”: “python3”</p>
<pre>},
"language_info": {
 "codemirror_mode": {
  "name": "ipython",</pre>
<ul><li><p>“version”: 2</p></li></ul>
<p>+    “version”: 3</p>
<pre>},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",</pre>
<ul><li><p>“pygments_lexer”: “ipython2”,</p></li>
<li><p>“version”: “2.7.11”</p></li></ul>
<p>+   “pygments_lexer”: “ipython3”, +   “version”: “3.5.1”</p>
<pre> }
},
"nbformat": 4,</pre>
<p>diff -r f161eabb059434279cc5bfa43030d3b1acc1ad5f -r 74a90987f18bddc2d00a080aaed6aab7036d77ed yt/utilities/fits_image.py --- a/yt/utilities/fits_image.py +++ b/yt/utilities/fits_image.py @@ -14,7 +14,7 @@</p>
<pre>from yt.funcs import mylog, iterable, fix_axis, ensure_list
from yt.visualization.fixed_resolution import FixedResolutionBuffer
from yt.data_objects.construction_data_containers import YTCoveringGrid</pre>
<p>-from yt.utilities.on_demand_imports import _astropy, NotAModule +from yt.utilities.on_demand_imports import _astropy</p>
<pre>from yt.units.yt_array import YTQuantity, YTArray
from yt.units import dimensions
from yt.utilities.parallel_tools.parallel_analysis_interface import \</pre>
<p>Repository URL: <a href="https://bitbucket.org/yt_analysis/yt/">https://bitbucket.org/yt_analysis/yt/</a></p>
<p>—</p>
<p>This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.</p>

<img src="http://link.bitbucket.org/wf/open?upn=ll4ctv0L-2ByeRZFC1LslHcg6aJmnQ70VruLbmeLQr27BXyYKmrwtUqpLND-2FQLb3qo-2BjxvgEFzn1qj2Gjdrare-2FaS2U6-2FBK-2Fd7Lm9F2rxO-2B1YhgDZQHvLRdT9q0ppHo3TS7-2BLP5-2BI2mkCnqof9W7Kyw1ALjKvqndPTv9oQY4Q57W3o4Ej4EzgtLhW2hBzBI5Z1Yknsig0-2BE2pr1-2FyjjiEUyOBoYS5Riy1orA4JK420E6s-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;"/>
</body></html>