[SciPy-Dev] Cookbook update

Warren Weckesser warren.weckesser at gmail.com
Thu Dec 11 13:56:26 EST 2014


On Thu, Dec 11, 2014 at 1:29 PM, Ryan Nelson <rnelsonchem at gmail.com> wrote:

> Hello Scipy-devs:
>
> The link below on building a Qt app with a Matplotlib widget is very dated.
> http://wiki.scipy.org/Cookbook/Matplotlib/Qt_with_IPython_and_Designer
>
> After several research/trial/error cycles, I reproduced the Qt4 plot
> window that you using the relevant pyplot commands. I suppose I could
> update the Cookbook page above, but I need editing rights. Is this still
> possible, or are we trying to point users to a new location?
>
> Ryan
>
>

This is a timely question.  In the last few weeks, I've run into a couple
things I'd like to update:

* At http://wiki.scipy.org/Cookbook/LASReader, I want to add a link to the
latest version, which is now on github:
https://github.com/WarrenWeckesser/las

* I've seen at least three occurrences (a couple on stackoverflow, and one
private email) of someone using the argument 'order=15' in a call to the
'set_integrator' method of 'scipy.integrate.ode'.  Presumably this is
because of the suggestion in the "NumPy for Matlab Users" page on the wiki (
http://wiki.scipy.org/NumPy_for_Matlab_Users) to replace 'ode15s' with '
scipy.integrate.ode(f).set_integrator('vode', method='bdf', order=15)'.
This is pointless, because the stiff solver in 'vode'--presumably the
solver of interest for someone using 'ode15s'--has a maximum order of 5,
and the non-stiff solver has maximum order of 12.  (The maximum order of
'ode15s' is also 5; the '15' in the name refers to the variable order
ranging from 1 to 5.)

I can log in, but I can't edit either of those pages.

Warren


P.S. Here's the relevant code, in case it matters.
>
> File = run.py
> -------------------------------------------------------------------------
> from test import Ui_MainWindow
>
> from matplotlib.figure import Figure
> from matplotlib.backends.backend_qt4agg import (
>     FigureCanvasQTAgg as FigureCanvas,
>     NavigationToolbar2QT as NavigationToolbar)
>
> from PyQt4 import QtGui
>
> class Main(QtGui.QMainWindow, Ui_MainWindow):
>     def __init__(self, ):
>         super(Main, self).__init__()
>         self.setupUi(self)
>
>         self.populatefigure()
>         self.addtoolbar()
>         self.plotdata()
>
>     def populatefigure(self,):
>         self.fig = Figure()
>         self.canvas = FigureCanvas(self.fig)
>         self.canvas.setParent(self.MplFigure)
>
>         self.mplvbox = QtGui.QVBoxLayout()
>         self.mplvbox.addWidget(self.canvas)
>         self.MplFigure.setLayout(self.mplvbox)
>
>     def addtoolbar(self,):
>         self.toolbar = NavigationToolbar(self.canvas, self,
>                 coordinates=True)
>         self.addToolBar(self.toolbar)
>
>     def addtoolbar2(self,):
>         self.toolbar = NavigationToolbar(self.canvas, self.MplFigure,
>                 coordinates=True)
>         self.mplvbox.addWidget(self.toolbar)
>
>     def plotdata(self,):
>         self.axes = self.fig.add_subplot(111)
>         self.axes.plot([1,3,2])
>         self.canvas.draw()
>
> if __name__ == "__main__":
>     '''
>     Run IPython as follows:
>     $ ipython --gui='qt'
>     [In 1]: %run run.py
>     If running this file directly from the command line, remove the
> comments
>     below and do the following:
>     $ python run.py
>     '''
>
>     #import sys
>     #app = QtGui.QApplication([])
>     main = Main()
>     main.show()
>     #sys.exit(app.exec_())
> -------------------------------------------------
>
> File = test.py (created with Designer and pyuic4)
> -------------------------------------------------------------------
> # -*- coding: utf-8 -*-
>
> # Form implementation generated from reading ui file 'test.ui'
> #
> # Created: Thu Dec 11 12:32:15 2014
> #      by: PyQt4 UI code generator 4.11.3
> #
> # WARNING! All changes made in this file will be lost!
>
> from PyQt4 import QtCore, QtGui
>
> try:
>     _fromUtf8 = QtCore.QString.fromUtf8
> except AttributeError:
>     def _fromUtf8(s):
>         return s
>
> try:
>     _encoding = QtGui.QApplication.UnicodeUTF8
>     def _translate(context, text, disambig):
>         return QtGui.QApplication.translate(context, text, disambig,
> _encoding)
> except AttributeError:
>     def _translate(context, text, disambig):
>         return QtGui.QApplication.translate(context, text, disambig)
>
> class Ui_MainWindow(object):
>     def setupUi(self, MainWindow):
>         MainWindow.setObjectName(_fromUtf8("MainWindow"))
>         MainWindow.resize(800, 600)
>         self.centralwidget = QtGui.QWidget(MainWindow)
>         self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
>         self.gridLayout = QtGui.QGridLayout(self.centralwidget)
>         self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
>         self.MplFigure = QtGui.QWidget(self.centralwidget)
>         self.MplFigure.setObjectName(_fromUtf8("MplFigure"))
>         self.gridLayout.addWidget(self.MplFigure, 0, 0, 1, 1)
>         MainWindow.setCentralWidget(self.centralwidget)
>
>         self.retranslateUi(MainWindow)
>         QtCore.QMetaObject.connectSlotsByName(MainWindow)
>
>     def retranslateUi(self, MainWindow):
>         MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow",
> None))
> -------------------------------------------------
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20141211/9b68f6b0/attachment.html>


More information about the SciPy-Dev mailing list