Georg Brandl committed c36be95

result: plot parameter values as well

Comments (0)

Files changed (3)

             self.axes.plot(xx, yy, '-.', label=labels and or '',
+    def plot_params(self, params):
+        s = '\n'.join(str(p) for p in params)
+        self.axes.text(0.02, 0.98, s, horizontalalignment='left',
+                       verticalalignment='top', size='x-small',
+                       transform=self.axes.transAxes)
 def mapping(x, y, runs, minmax=None, mat=False, log=False):
         self.chisqr = chisqr
         self.paramdict = dict((, p) for p in params)
         self.paramvalues = dict((, p.value) for p in params)
+        # XXX make a property
+        self.residuals = model.fcn(self.paramvalues, data.x) - data.y
+    # XXX make lazy
     def xx(self):
         return linspace([0],[-1], 1000)
         print '%-15s = %10.4g' % ('chi^2/NDF', self.chisqr)
         print '=' * 80
-    def plot(self, axes=None):
+    def plot(self, axes=None, params=True):
         """Plot the data and model together in the current figure."""
-        plotter = DataPlotter()
-        plotter.plot_data(, axes=axes)
-        plotter.plot_model(self.model,, axes=axes)
+        # XXX plot parameters in here
+        plotter = DataPlotter(axes)
+        plotter.plot_data(
+        plotter.plot_model(self.model,
+        if params:
+            plotter.plot_params(self.params)
-    def plotfull(self, axes=None):
+    def plotfull(self, axes=None, params=True):
         """Plot the data and model, including subcomponents, together in the
         current figure.
-        plotter = DataPlotter()
-        plotter.plot_data(, axes=axes)
-        plotter.plot_model_full(self.model,, axes=axes)
+        plotter = DataPlotter(axes)
+        plotter.plot_data(
+        plotter.plot_model_full(self.model,
+        if params:
+            plotter.plot_params(self.params)
             return self[key]
         except KeyError:
-            raise AttributeError
+            raise AttributeError(key)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.