[yt-svn] commit/yt: 5 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Oct 13 18:19:13 PDT 2017


5 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/cb05272969a4/
Changeset:   cb05272969a4
User:        jzuhone
Date:        2017-10-02 16:42:53+00:00
Summary:     Use AstroPy's implementation of WCSAxes
Affected #:  2 files

diff -r 0231a9c04ac1101ef070028c7af3f71684643597 -r cb05272969a49da9a51f5f06d9850b3d574469a4 yt/frontends/fits/misc.py
--- a/yt/frontends/fits/misc.py
+++ b/yt/frontends/fits/misc.py
@@ -192,8 +192,10 @@
 
 class PlotWindowWCS(object):
     r"""
-    Use the wcsaxes library to plot celestial coordinates on the axes of a
-    on-axis PlotWindow plot. See http://wcsaxes.readthedocs.org for details.
+    Use AstroPy's WCSAxes class to plot celestial coordinates on the axes of a
+    on-axis PlotWindow plot. See 
+    http://docs.astropy.org/en/stable/visualization/wcsaxes/ for more details
+    on how it works under the hood.
 
     Parameters
     ----------
@@ -201,7 +203,13 @@
         The PlotWindow instance to add celestial axes to.
     """
     def __init__(self, pw):
-        from wcsaxes import WCSAxes
+        try:
+            # Attempt import from the old WCSAxes package first
+            from wcsaxes import WCSAxes
+        except ImportError:
+            # Try to use the AstroPy version
+            WCSAxes = _astropy.visualization.wcsaxes.WCSAxes
+
         if pw.oblique:
             raise NotImplementedError("WCS axes are not implemented for oblique plots.")
         if not hasattr(pw.ds, "wcs_2d"):

diff -r 0231a9c04ac1101ef070028c7af3f71684643597 -r cb05272969a49da9a51f5f06d9850b3d574469a4 yt/utilities/on_demand_imports.py
--- a/yt/utilities/on_demand_imports.py
+++ b/yt/utilities/on_demand_imports.py
@@ -122,6 +122,18 @@
             self._time = time
         return self._time
 
+    _visualization = None
+    @property
+    def visualization(self):
+        if self._visualization is None:
+            try:
+                import astropy.visualization as visualization
+                self.log
+            except ImportError:
+                visualization = NotAModule(self._name)
+            self._visualization = visualization
+        return self._visualization
+
 _astropy = astropy_imports()
 
 class scipy_imports(object):


https://bitbucket.org/yt_analysis/yt/commits/a5786d1143fb/
Changeset:   a5786d1143fb
User:        jzuhone
Date:        2017-10-02 17:14:43+00:00
Summary:     Import the wcsaxes attribute directly, or it doesn't work
Affected #:  2 files

diff -r cb05272969a49da9a51f5f06d9850b3d574469a4 -r a5786d1143fb23d1c9337aa8df7059ca57e3d5e0 yt/frontends/fits/misc.py
--- a/yt/frontends/fits/misc.py
+++ b/yt/frontends/fits/misc.py
@@ -208,7 +208,7 @@
             from wcsaxes import WCSAxes
         except ImportError:
             # Try to use the AstroPy version
-            WCSAxes = _astropy.visualization.wcsaxes.WCSAxes
+            WCSAxes = _astropy.wcsaxes.WCSAxes
 
         if pw.oblique:
             raise NotImplementedError("WCS axes are not implemented for oblique plots.")

diff -r cb05272969a49da9a51f5f06d9850b3d574469a4 -r a5786d1143fb23d1c9337aa8df7059ca57e3d5e0 yt/utilities/on_demand_imports.py
--- a/yt/utilities/on_demand_imports.py
+++ b/yt/utilities/on_demand_imports.py
@@ -122,17 +122,17 @@
             self._time = time
         return self._time
 
-    _visualization = None
+    _wcsaxes = None
     @property
-    def visualization(self):
-        if self._visualization is None:
+    def wcsaxes(self):
+        if self._wcsaxes is None:
             try:
-                import astropy.visualization as visualization
+                import astropy.visualization.wcsaxes as wcsaxes
                 self.log
             except ImportError:
-                visualization = NotAModule(self._name)
-            self._visualization = visualization
-        return self._visualization
+                wcsaxes = NotAModule(self._name)
+            self._wcsaxes = wcsaxes
+        return self._wcsaxes
 
 _astropy = astropy_imports()
 


https://bitbucket.org/yt_analysis/yt/commits/8b1a99733db8/
Changeset:   8b1a99733db8
User:        jzuhone
Date:        2017-10-02 17:16:46+00:00
Summary:     Update docs
Affected #:  4 files

diff -r a5786d1143fb23d1c9337aa8df7059ca57e3d5e0 -r 8b1a99733db8ea01bcc12f8f549b709feb94ee60 doc/source/cookbook/fits_radio_cubes.ipynb
--- a/doc/source/cookbook/fits_radio_cubes.ipynb
+++ b/doc/source/cookbook/fits_radio_cubes.ipynb
@@ -18,7 +18,7 @@
    "source": [
     "This notebook demonstrates some of the capabilties of yt on some FITS \"position-position-spectrum\" cubes of radio data.\n",
     "\n",
-    "Note that it depends on some external dependencies, including `astropy`, `wcsaxes`, and `pyregion`."
+    "Note that it depends on some external dependencies, including `astropy` and `pyregion`."
    ]
   },
   {
@@ -69,7 +69,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "The x and y axes are in units of the image pixel. When making plots of FITS data, to see the image coordinates as they are in the file, it is helpful to set the keyword `origin = \"native\"`. If you want to see the celestial coordinates along the axes, you can import the `PlotWindowWCS` class and feed it the `SlicePlot`. For this to work, the [WCSAxes](http://wcsaxes.readthedocs.org/en/latest/) package needs to be installed."
+    "The x and y axes are in units of the image pixel. When making plots of FITS data, to see the image coordinates as they are in the file, it is helpful to set the keyword `origin = \"native\"`. If you want to see the celestial coordinates along the axes, you can import the `PlotWindowWCS` class and feed it the `SlicePlot`. For this to work, a version of AstroPy >= 1.3 needs to be installed."
    ]
   },
   {

diff -r a5786d1143fb23d1c9337aa8df7059ca57e3d5e0 -r 8b1a99733db8ea01bcc12f8f549b709feb94ee60 doc/source/cookbook/fits_xray_images.ipynb
--- a/doc/source/cookbook/fits_xray_images.ipynb
+++ b/doc/source/cookbook/fits_xray_images.ipynb
@@ -71,15 +71,15 @@
     "def _counts(field, data):\n",
     "    exposure_time = data.get_field_parameter(\"exposure_time\")\n",
     "    return data[\"flux\"]*data[\"pixel\"]*exposure_time\n",
-    "ds.add_field((\"gas\",\"counts\"), function=_counts, units=\"counts\", take_log=False)\n",
+    "ds.add_field((\"gas\",\"counts\"), function=_counts, sampling_type=\"cell\", units=\"counts\", take_log=False)\n",
     "\n",
     "def _pp(field, data):\n",
     "    return np.sqrt(data[\"counts\"])*data[\"projected_temperature\"]\n",
-    "ds.add_field((\"gas\",\"pseudo_pressure\"), function=_pp, units=\"sqrt(counts)*keV\", take_log=False)\n",
+    "ds.add_field((\"gas\",\"pseudo_pressure\"), function=_pp, sampling_type=\"cell\", units=\"sqrt(counts)*keV\", take_log=False)\n",
     "\n",
     "def _pe(field, data):\n",
     "    return data[\"projected_temperature\"]*data[\"counts\"]**(-1./3.)\n",
-    "ds.add_field((\"gas\",\"pseudo_entropy\"), function=_pe, units=\"keV*(counts)**(-1/3)\", take_log=False)"
+    "ds.add_field((\"gas\",\"pseudo_entropy\"), function=_pe, sampling_type=\"cell\", units=\"keV*(counts)**(-1/3)\", take_log=False)"
    ]
   },
   {
@@ -129,7 +129,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "To add the celestial coordinates to the image, we can use `PlotWindowWCS`, if you have the [WCSAxes](http://wcsaxes.readthedocs.org/en/latest/) package installed:"
+    "To add the celestial coordinates to the image, we can use `PlotWindowWCS`, if you have a recent version of AstroPy (>= 1.3) installed:"
    ]
   },
   {

diff -r a5786d1143fb23d1c9337aa8df7059ca57e3d5e0 -r 8b1a99733db8ea01bcc12f8f549b709feb94ee60 doc/source/examining/loading_data.rst
--- a/doc/source/examining/loading_data.rst
+++ b/doc/source/examining/loading_data.rst
@@ -687,14 +687,6 @@
 yt can read two kinds of FITS files: FITS image files and FITS binary table files containing
 positions, times, and energies of X-ray events.
 
-.. note::
-
-  AstroPy is necessary due to the requirements of both FITS file reading and
-  WCS coordinates. Since new releases of `PyFITS <http://www.stsci
-  .edu/institute/software_hardware/pyfits>`_ are to be discontinued, individual
-  installations of this package and the `PyWCS <http://stsdas.stsci
-  .edu/astrolib/pywcs/>`_ package are not supported.
-
 Though a FITS image is composed of a single array in the FITS file,
 upon being loaded into yt it is automatically decomposed into grids:
 
@@ -908,8 +900,7 @@
 """""""""""""""""
 
 This class takes a on-axis ``SlicePlot`` or ``ProjectionPlot`` of FITS data and adds celestial
-coordinates to the plot axes. To use it, the `WCSAxes <http://wcsaxes.readthedocs.org>`_
-package must be installed.
+coordinates to the plot axes. To use it, a version of AstroPy >= 1.3 must be installed.
 
 .. code-block:: python
 

diff -r a5786d1143fb23d1c9337aa8df7059ca57e3d5e0 -r 8b1a99733db8ea01bcc12f8f549b709feb94ee60 yt/frontends/fits/misc.py
--- a/yt/frontends/fits/misc.py
+++ b/yt/frontends/fits/misc.py
@@ -195,7 +195,8 @@
     Use AstroPy's WCSAxes class to plot celestial coordinates on the axes of a
     on-axis PlotWindow plot. See 
     http://docs.astropy.org/en/stable/visualization/wcsaxes/ for more details
-    on how it works under the hood.
+    on how it works under the hood. This functionality requires a version of 
+    AstroPy >= 1.3. 
 
     Parameters
     ----------


https://bitbucket.org/yt_analysis/yt/commits/7365abf84e55/
Changeset:   7365abf84e55
User:        jzuhone
Date:        2017-10-04 18:06:45+00:00
Summary:     Issue a deprecation warning here
Affected #:  1 file

diff -r 8b1a99733db8ea01bcc12f8f549b709feb94ee60 -r 7365abf84e550fa06259d4655e54dde375f0007b yt/frontends/fits/misc.py
--- a/yt/frontends/fits/misc.py
+++ b/yt/frontends/fits/misc.py
@@ -14,7 +14,7 @@
 import base64
 from yt.extern.six import PY3
 from yt.fields.derived_field import ValidateSpatial
-from yt.funcs import mylog
+from yt.funcs import mylog, issue_deprecation_warning
 from yt.utilities.on_demand_imports import _astropy
 from yt.units.yt_array import YTQuantity, YTArray
 if PY3:
@@ -207,6 +207,13 @@
         try:
             # Attempt import from the old WCSAxes package first
             from wcsaxes import WCSAxes
+            issue_deprecation_warning("Support for the standalone 'wcsaxes' "
+                                      "package is deprecated since its"
+                                      "functionality has been merged into"
+                                      "AstroPy, and will be removed in a "
+                                      "future release. It is recommended to "
+                                      "use the version bundled with AstroPy "
+                                      ">= 1.3.") 
         except ImportError:
             # Try to use the AstroPy version
             WCSAxes = _astropy.wcsaxes.WCSAxes


https://bitbucket.org/yt_analysis/yt/commits/9f471ff74ee1/
Changeset:   9f471ff74ee1
User:        ngoldbaum
Date:        2017-10-14 01:19:00+00:00
Summary:     Merge pull request #1577 from jzuhone/wcsaxes

Use AstroPy version of WCSAxes for plotting FITS datasets
Affected #:  5 files

diff -r 3474511821829347817936947982b7bd434d3f85 -r 9f471ff74ee1af7c128169c9887f22b8f098c76c doc/source/cookbook/fits_radio_cubes.ipynb
--- a/doc/source/cookbook/fits_radio_cubes.ipynb
+++ b/doc/source/cookbook/fits_radio_cubes.ipynb
@@ -18,7 +18,7 @@
    "source": [
     "This notebook demonstrates some of the capabilties of yt on some FITS \"position-position-spectrum\" cubes of radio data.\n",
     "\n",
-    "Note that it depends on some external dependencies, including `astropy`, `wcsaxes`, and `pyregion`."
+    "Note that it depends on some external dependencies, including `astropy` and `pyregion`."
    ]
   },
   {
@@ -69,7 +69,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "The x and y axes are in units of the image pixel. When making plots of FITS data, to see the image coordinates as they are in the file, it is helpful to set the keyword `origin = \"native\"`. If you want to see the celestial coordinates along the axes, you can import the `PlotWindowWCS` class and feed it the `SlicePlot`. For this to work, the [WCSAxes](http://wcsaxes.readthedocs.org/en/latest/) package needs to be installed."
+    "The x and y axes are in units of the image pixel. When making plots of FITS data, to see the image coordinates as they are in the file, it is helpful to set the keyword `origin = \"native\"`. If you want to see the celestial coordinates along the axes, you can import the `PlotWindowWCS` class and feed it the `SlicePlot`. For this to work, a version of AstroPy >= 1.3 needs to be installed."
    ]
   },
   {

diff -r 3474511821829347817936947982b7bd434d3f85 -r 9f471ff74ee1af7c128169c9887f22b8f098c76c doc/source/cookbook/fits_xray_images.ipynb
--- a/doc/source/cookbook/fits_xray_images.ipynb
+++ b/doc/source/cookbook/fits_xray_images.ipynb
@@ -71,15 +71,15 @@
     "def _counts(field, data):\n",
     "    exposure_time = data.get_field_parameter(\"exposure_time\")\n",
     "    return data[\"flux\"]*data[\"pixel\"]*exposure_time\n",
-    "ds.add_field((\"gas\",\"counts\"), function=_counts, units=\"counts\", take_log=False)\n",
+    "ds.add_field((\"gas\",\"counts\"), function=_counts, sampling_type=\"cell\", units=\"counts\", take_log=False)\n",
     "\n",
     "def _pp(field, data):\n",
     "    return np.sqrt(data[\"counts\"])*data[\"projected_temperature\"]\n",
-    "ds.add_field((\"gas\",\"pseudo_pressure\"), function=_pp, units=\"sqrt(counts)*keV\", take_log=False)\n",
+    "ds.add_field((\"gas\",\"pseudo_pressure\"), function=_pp, sampling_type=\"cell\", units=\"sqrt(counts)*keV\", take_log=False)\n",
     "\n",
     "def _pe(field, data):\n",
     "    return data[\"projected_temperature\"]*data[\"counts\"]**(-1./3.)\n",
-    "ds.add_field((\"gas\",\"pseudo_entropy\"), function=_pe, units=\"keV*(counts)**(-1/3)\", take_log=False)"
+    "ds.add_field((\"gas\",\"pseudo_entropy\"), function=_pe, sampling_type=\"cell\", units=\"keV*(counts)**(-1/3)\", take_log=False)"
    ]
   },
   {
@@ -129,7 +129,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "To add the celestial coordinates to the image, we can use `PlotWindowWCS`, if you have the [WCSAxes](http://wcsaxes.readthedocs.org/en/latest/) package installed:"
+    "To add the celestial coordinates to the image, we can use `PlotWindowWCS`, if you have a recent version of AstroPy (>= 1.3) installed:"
    ]
   },
   {

diff -r 3474511821829347817936947982b7bd434d3f85 -r 9f471ff74ee1af7c128169c9887f22b8f098c76c doc/source/examining/loading_data.rst
--- a/doc/source/examining/loading_data.rst
+++ b/doc/source/examining/loading_data.rst
@@ -687,14 +687,6 @@
 yt can read two kinds of FITS files: FITS image files and FITS binary table files containing
 positions, times, and energies of X-ray events.
 
-.. note::
-
-  AstroPy is necessary due to the requirements of both FITS file reading and
-  WCS coordinates. Since new releases of `PyFITS <http://www.stsci
-  .edu/institute/software_hardware/pyfits>`_ are to be discontinued, individual
-  installations of this package and the `PyWCS <http://stsdas.stsci
-  .edu/astrolib/pywcs/>`_ package are not supported.
-
 Though a FITS image is composed of a single array in the FITS file,
 upon being loaded into yt it is automatically decomposed into grids:
 
@@ -908,8 +900,7 @@
 """""""""""""""""
 
 This class takes a on-axis ``SlicePlot`` or ``ProjectionPlot`` of FITS data and adds celestial
-coordinates to the plot axes. To use it, the `WCSAxes <http://wcsaxes.readthedocs.org>`_
-package must be installed.
+coordinates to the plot axes. To use it, a version of AstroPy >= 1.3 must be installed.
 
 .. code-block:: python
 

diff -r 3474511821829347817936947982b7bd434d3f85 -r 9f471ff74ee1af7c128169c9887f22b8f098c76c yt/frontends/fits/misc.py
--- a/yt/frontends/fits/misc.py
+++ b/yt/frontends/fits/misc.py
@@ -14,7 +14,7 @@
 import base64
 from yt.extern.six import PY3
 from yt.fields.derived_field import ValidateSpatial
-from yt.funcs import mylog
+from yt.funcs import mylog, issue_deprecation_warning
 from yt.utilities.on_demand_imports import _astropy
 from yt.units.yt_array import YTQuantity, YTArray
 if PY3:
@@ -192,8 +192,11 @@
 
 class PlotWindowWCS(object):
     r"""
-    Use the wcsaxes library to plot celestial coordinates on the axes of a
-    on-axis PlotWindow plot. See http://wcsaxes.readthedocs.org for details.
+    Use AstroPy's WCSAxes class to plot celestial coordinates on the axes of a
+    on-axis PlotWindow plot. See 
+    http://docs.astropy.org/en/stable/visualization/wcsaxes/ for more details
+    on how it works under the hood. This functionality requires a version of 
+    AstroPy >= 1.3. 
 
     Parameters
     ----------
@@ -201,7 +204,20 @@
         The PlotWindow instance to add celestial axes to.
     """
     def __init__(self, pw):
-        from wcsaxes import WCSAxes
+        try:
+            # Attempt import from the old WCSAxes package first
+            from wcsaxes import WCSAxes
+            issue_deprecation_warning("Support for the standalone 'wcsaxes' "
+                                      "package is deprecated since its"
+                                      "functionality has been merged into"
+                                      "AstroPy, and will be removed in a "
+                                      "future release. It is recommended to "
+                                      "use the version bundled with AstroPy "
+                                      ">= 1.3.") 
+        except ImportError:
+            # Try to use the AstroPy version
+            WCSAxes = _astropy.wcsaxes.WCSAxes
+
         if pw.oblique:
             raise NotImplementedError("WCS axes are not implemented for oblique plots.")
         if not hasattr(pw.ds, "wcs_2d"):

diff -r 3474511821829347817936947982b7bd434d3f85 -r 9f471ff74ee1af7c128169c9887f22b8f098c76c yt/utilities/on_demand_imports.py
--- a/yt/utilities/on_demand_imports.py
+++ b/yt/utilities/on_demand_imports.py
@@ -122,6 +122,18 @@
             self._time = time
         return self._time
 
+    _wcsaxes = None
+    @property
+    def wcsaxes(self):
+        if self._wcsaxes is None:
+            try:
+                import astropy.visualization.wcsaxes as wcsaxes
+                self.log
+            except ImportError:
+                wcsaxes = NotAModule(self._name)
+            self._wcsaxes = wcsaxes
+        return self._wcsaxes
+
 _astropy = astropy_imports()
 
 class scipy_imports(object):

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