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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Jul 19 06:37:43 PDT 2013


3 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/16973ce6a078/
Changeset:   16973ce6a078
Branch:      yt
User:        ngoldbaum
Date:        2013-07-16 02:32:08
Summary:     Fixing imports for IPython 1.0.
Affected #:  3 files

diff -r 2303e938a22ace1beb284d56b4ab719472cabcb5 -r 16973ce6a0786ec30009c7ba6c4aa879c8e6a088 scripts/iyt
--- a/scripts/iyt
+++ b/scripts/iyt
@@ -1,6 +1,6 @@
 #!python
 import os, re
-from distutils import version
+from distutils.version import LooseVersion
 from yt.mods import *
 from yt.data_objects.data_containers import AMRData
 namespace = locals().copy()
@@ -23,10 +23,12 @@
     code.interact(doc, None, namespace)
     sys.exit()
 
-if version.LooseVersion(IPython.__version__) <= version.LooseVersion('0.10'):
+if LooseVersion(IPython.__version__) <= LooseVersion('0.10'):
     api_version = '0.10'
+elif LooseVersion(IPython.__version__) <= LooseVersion('1.0'):
+    api_version = '0.11'
 else:
-    api_version = '0.11'
+    api_version = '1.0'
 
 if api_version == "0.10" and "DISPLAY" in os.environ:
     from matplotlib import rcParams
@@ -42,13 +44,18 @@
         ip_shell = IPython.Shell.IPShellMatplotlib(user_ns=namespace)
 elif api_version == "0.10":
     ip_shell = IPython.Shell.IPShellMatplotlib(user_ns=namespace)
-elif api_version == "0.11":
-    from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
+else:
+    if api_version == "0.11":
+        from IPython.frontend.terminal.interactiveshell import \
+            TerminalInteractiveShell
+    elif api_version == "1.0":
+        from IPython.terminal.interactiveshell import TerminalInteractiveShell
+    else:
+        raise RuntimeError
     ip_shell = TerminalInteractiveShell(user_ns=namespace, banner1 = doc,
                     display_banner = True)
     if "DISPLAY" in os.environ: ip_shell.enable_pylab(import_all=False)
-else:
-    raise RuntimeError
+
 
 # The rest is a modified version of the IPython default profile code
 
@@ -77,7 +84,7 @@
     ip = ip_shell.IP.getapi()
     try_next = IPython.ipapi.TryNext
     kwargs = dict(sys_exit=1, banner=doc)
-elif api_version == "0.11":
+elif api_version in ("0.11", "1.0"):
     ip = ip_shell
     try_next = IPython.core.error.TryNext
     kwargs = dict()

diff -r 2303e938a22ace1beb284d56b4ab719472cabcb5 -r 16973ce6a0786ec30009c7ba6c4aa879c8e6a088 yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -28,7 +28,7 @@
 import contextlib
 import warnings, struct, subprocess
 import numpy as np
-from distutils import version
+from distutils.version import LooseVersion
 from math import floor, ceil
 
 from yt.utilities.exceptions import *
@@ -260,10 +260,12 @@
     """
 
     import IPython
-    if version.LooseVersion(IPython.__version__) <= version.LooseVersion('0.10'):
+    if LooseVersion(IPython.__version__) <= LooseVersion('0.10'):
         api_version = '0.10'
+    elif LooseVersion(IPython.__version__) <= LooseVersion('1.0'):
+        api_version = '0.11'
     else:
-        api_version = '0.11'
+        api_version = '1.0'
 
     stack = inspect.stack()
     frame = inspect.stack()[num_up]
@@ -281,7 +283,10 @@
         cfg.InteractiveShellEmbed.local_ns = loc
         cfg.InteractiveShellEmbed.global_ns = glo
         IPython.embed(config=cfg, banner2 = __header % dd)
-        from IPython.frontend.terminal.embed import InteractiveShellEmbed
+        if api_version == '0.11':
+            from IPython.frontend.terminal.embed import InteractiveShellEmbed
+        else:
+            from IPython.terminal.embed import InteractiveShellEmbed
         ipshell = InteractiveShellEmbed(config=cfg)
 
     del ipshell

diff -r 2303e938a22ace1beb284d56b4ab719472cabcb5 -r 16973ce6a0786ec30009c7ba6c4aa879c8e6a088 yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -1456,7 +1456,12 @@
         """
     def __call__(self, args):
         kwargs = {}
-        from IPython.frontend.html.notebook.notebookapp import NotebookApp
+        try:
+            # IPython 1.0+
+            from IPython.html.notebookapp import NotebookApp
+        except ImportError:
+            # pre-IPython v1.0
+            from IPython.frontend.html.notebook.notebookapp import NotebookApp
         pw = ytcfg.get("yt", "notebook_password")
         if len(pw) == 0 and not args.no_password:
             import IPython.lib


https://bitbucket.org/yt_analysis/yt/commits/c8ce7b6481b2/
Changeset:   c8ce7b6481b2
Branch:      yt
User:        ngoldbaum
Date:        2013-07-16 02:34:23
Summary:     Modifying PWViewrMPL.__repr__ so things work more nicele in the notebook.
Affected #:  1 file

diff -r 16973ce6a0786ec30009c7ba6c4aa879c8e6a088 -r c8ce7b6481b2aac4f43a0986da59f00caaebaab6 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -394,7 +394,7 @@
         nWx, nWy = Wx/factor, Wy/factor
         self.xlim = (centerx - nWx*0.5, centerx + nWx*0.5)
         self.ylim = (centery - nWy*0.5, centery + nWy*0.5)
-
+        return self
 
     @invalidate_data
     def pan(self, deltas):
@@ -408,6 +408,7 @@
         """
         self.xlim = (self.xlim[0] + deltas[0], self.xlim[1] + deltas[0])
         self.ylim = (self.ylim[0] + deltas[1], self.ylim[1] + deltas[1])
+        return self
 
     @invalidate_data
     def pan_rel(self, deltas):
@@ -422,6 +423,7 @@
         Wx, Wy = self.width
         self.xlim = (self.xlim[0] + Wx*deltas[0], self.xlim[1] + Wx*deltas[0])
         self.ylim = (self.ylim[0] + Wy*deltas[1], self.ylim[1] + Wy*deltas[1])
+        return self
 
     @invalidate_data
     def set_window(self, bounds):
@@ -1110,6 +1112,11 @@
         except YTNotInsideNotebook:
             return self.save(name=name, mpl_kwargs=mpl_kwargs)
 
+    def __repr__(self):
+        if "__IPYTHON__" in dir(__builtin__):
+            self.show()
+        return super(PWViewerMPL, self).__repr__()
+
 class SlicePlot(PWViewerMPL):
     r"""Creates a slice plot from a parameter file
 


https://bitbucket.org/yt_analysis/yt/commits/e3e4f4578504/
Changeset:   e3e4f4578504
Branch:      yt
User:        MatthewTurk
Date:        2013-07-19 15:37:39
Summary:     Merged in ngoldbaum/yt (pull request #555)

IPython 1.0 support and improved plotting inside the notebook.
Affected #:  4 files

diff -r fe5d507ced3db8b97fe29249b1f3ff2f0055fc3c -r e3e4f4578504b7eb2e929275ad8441ef3900572c scripts/iyt
--- a/scripts/iyt
+++ b/scripts/iyt
@@ -1,6 +1,6 @@
 #!python
 import os, re
-from distutils import version
+from distutils.version import LooseVersion
 from yt.mods import *
 from yt.data_objects.data_containers import AMRData
 namespace = locals().copy()
@@ -23,10 +23,12 @@
     code.interact(doc, None, namespace)
     sys.exit()
 
-if version.LooseVersion(IPython.__version__) <= version.LooseVersion('0.10'):
+if LooseVersion(IPython.__version__) <= LooseVersion('0.10'):
     api_version = '0.10'
+elif LooseVersion(IPython.__version__) <= LooseVersion('1.0'):
+    api_version = '0.11'
 else:
-    api_version = '0.11'
+    api_version = '1.0'
 
 if api_version == "0.10" and "DISPLAY" in os.environ:
     from matplotlib import rcParams
@@ -42,13 +44,18 @@
         ip_shell = IPython.Shell.IPShellMatplotlib(user_ns=namespace)
 elif api_version == "0.10":
     ip_shell = IPython.Shell.IPShellMatplotlib(user_ns=namespace)
-elif api_version == "0.11":
-    from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
+else:
+    if api_version == "0.11":
+        from IPython.frontend.terminal.interactiveshell import \
+            TerminalInteractiveShell
+    elif api_version == "1.0":
+        from IPython.terminal.interactiveshell import TerminalInteractiveShell
+    else:
+        raise RuntimeError
     ip_shell = TerminalInteractiveShell(user_ns=namespace, banner1 = doc,
                     display_banner = True)
     if "DISPLAY" in os.environ: ip_shell.enable_pylab(import_all=False)
-else:
-    raise RuntimeError
+
 
 # The rest is a modified version of the IPython default profile code
 
@@ -77,7 +84,7 @@
     ip = ip_shell.IP.getapi()
     try_next = IPython.ipapi.TryNext
     kwargs = dict(sys_exit=1, banner=doc)
-elif api_version == "0.11":
+elif api_version in ("0.11", "1.0"):
     ip = ip_shell
     try_next = IPython.core.error.TryNext
     kwargs = dict()

diff -r fe5d507ced3db8b97fe29249b1f3ff2f0055fc3c -r e3e4f4578504b7eb2e929275ad8441ef3900572c yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -28,7 +28,7 @@
 import contextlib
 import warnings, struct, subprocess
 import numpy as np
-from distutils import version
+from distutils.version import LooseVersion
 from math import floor, ceil
 
 from yt.utilities.exceptions import *
@@ -260,10 +260,12 @@
     """
 
     import IPython
-    if version.LooseVersion(IPython.__version__) <= version.LooseVersion('0.10'):
+    if LooseVersion(IPython.__version__) <= LooseVersion('0.10'):
         api_version = '0.10'
+    elif LooseVersion(IPython.__version__) <= LooseVersion('1.0'):
+        api_version = '0.11'
     else:
-        api_version = '0.11'
+        api_version = '1.0'
 
     stack = inspect.stack()
     frame = inspect.stack()[num_up]
@@ -281,7 +283,10 @@
         cfg.InteractiveShellEmbed.local_ns = loc
         cfg.InteractiveShellEmbed.global_ns = glo
         IPython.embed(config=cfg, banner2 = __header % dd)
-        from IPython.frontend.terminal.embed import InteractiveShellEmbed
+        if api_version == '0.11':
+            from IPython.frontend.terminal.embed import InteractiveShellEmbed
+        else:
+            from IPython.terminal.embed import InteractiveShellEmbed
         ipshell = InteractiveShellEmbed(config=cfg)
 
     del ipshell

diff -r fe5d507ced3db8b97fe29249b1f3ff2f0055fc3c -r e3e4f4578504b7eb2e929275ad8441ef3900572c yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -1456,7 +1456,12 @@
         """
     def __call__(self, args):
         kwargs = {}
-        from IPython.frontend.html.notebook.notebookapp import NotebookApp
+        try:
+            # IPython 1.0+
+            from IPython.html.notebookapp import NotebookApp
+        except ImportError:
+            # pre-IPython v1.0
+            from IPython.frontend.html.notebook.notebookapp import NotebookApp
         pw = ytcfg.get("yt", "notebook_password")
         if len(pw) == 0 and not args.no_password:
             import IPython.lib

diff -r fe5d507ced3db8b97fe29249b1f3ff2f0055fc3c -r e3e4f4578504b7eb2e929275ad8441ef3900572c yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -394,7 +394,7 @@
         nWx, nWy = Wx/factor, Wy/factor
         self.xlim = (centerx - nWx*0.5, centerx + nWx*0.5)
         self.ylim = (centery - nWy*0.5, centery + nWy*0.5)
-
+        return self
 
     @invalidate_data
     def pan(self, deltas):
@@ -408,6 +408,7 @@
         """
         self.xlim = (self.xlim[0] + deltas[0], self.xlim[1] + deltas[0])
         self.ylim = (self.ylim[0] + deltas[1], self.ylim[1] + deltas[1])
+        return self
 
     @invalidate_data
     def pan_rel(self, deltas):
@@ -422,6 +423,7 @@
         Wx, Wy = self.width
         self.xlim = (self.xlim[0] + Wx*deltas[0], self.xlim[1] + Wx*deltas[0])
         self.ylim = (self.ylim[0] + Wy*deltas[1], self.ylim[1] + Wy*deltas[1])
+        return self
 
     @invalidate_data
     def set_window(self, bounds):
@@ -1110,6 +1112,11 @@
         except YTNotInsideNotebook:
             return self.save(name=name, mpl_kwargs=mpl_kwargs)
 
+    def __repr__(self):
+        if "__IPYTHON__" in dir(__builtin__):
+            self.show()
+        return super(PWViewerMPL, self).__repr__()
+
 class SlicePlot(PWViewerMPL):
     r"""Creates a slice plot from a parameter file

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