/[ascend]/trunk/pygtk/diagnose.py
ViewVC logotype

Diff of /trunk/pygtk/diagnose.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 735 by johnpye, Wed Jul 5 02:42:19 2006 UTC revision 736 by johnpye, Wed Jul 5 04:56:26 2006 UTC
# Line 38  class DiagnoseWindow: Line 38  class DiagnoseWindow:
38          self.blockentry = _xml.get_widget("blockentry")          self.blockentry = _xml.get_widget("blockentry")
39          self.zoomentry = _xml.get_widget("zoomentry")          self.zoomentry = _xml.get_widget("zoomentry")
40    
41          self.varname = _xml.get_widget("varname");          self.var = None; self.rel = None
42          self.varval = _xml.get_widget("varval");          self.varname = _xml.get_widget("varname")
43          self.varinfobutton = _xml.get_widget("varinfobutton");          self.varval = _xml.get_widget("varval")
44          self.relname = _xml.get_widget("relname");          self.varinfobutton = _xml.get_widget("varinfobutton")
45          self.relresid = _xml.get_widget("relresid");          self.relname = _xml.get_widget("relname")
46            self.relresid = _xml.get_widget("relresid")
47          self.relinfobutton = _xml.get_widget("relinfobutton")          self.relinfobutton = _xml.get_widget("relinfobutton")
48    
49          self.varview = _xml.get_widget("varview")          self.varview = _xml.get_widget("varview")
# Line 88  class DiagnoseWindow: Line 89  class DiagnoseWindow:
89      def fill_values(self, block):      def fill_values(self, block):
90                    
91          try:          try:
92                if self.im.getNumBlocks()==0:
93                    print "NO BLOCKS!"
94                    self.image.set_from_stock(gtk.STOCK_DIALOG_ERROR
95                        ,gtk.ICON_SIZE_DIALOG
96                    )
97                    self.browser.reporter.reportError(
98                        "Can't 'Diagnose blocks' until solver has been used."
99                    )
100                    return;
101              rl,cl,rh,ch = self.im.getBlockLocation(block)              rl,cl,rh,ch = self.im.getBlockLocation(block)
102          except IndexError:          except IndexError:
103              if block >= self.im.getNumBlocks():              if block >= self.im.getNumBlocks():
# Line 322  class DiagnoseWindow: Line 332  class DiagnoseWindow:
332      def on_varinfobutton_clicked(self,*args):      def on_varinfobutton_clicked(self,*args):
333          title = "Variable '%s'" % self.var          title = "Variable '%s'" % self.var
334          text = "%s\n%s\n" % (title,"(from the solver's view)")          text = "%s\n%s\n" % (title,"(from the solver's view)")
335          text += "\n%-30s%15f" % ("Value", self.var.getValue())  
336          text += "\n%-30s%15f" % ("Nominal", self.var.getNominal())          _rows = {
337          text += "\n%-30s%15f" % ("Lower bound", self.var.getLowerBound())              "Value": self.var.getValue()
338          text += "\n%-30s%15f" % ("Upper bound", self.var.getUpperBound())              ,"Nominal": self.var.getNominal()
339                ,"Lower bound": self.var.getLowerBound()
340                ,"Upper bound": self.var.getUpperBound()
341            }
342            for k,v in _rows.iteritems():
343                if v!=0:
344                    l = math.log10(abs(v))
345                else:
346                    l = 0;
347                if l > 8 or l < -8:
348                    text += "\n  %-30s%15e" % (k,v)
349                else:
350                    text += "\n  %-30s%15f" % (k,v)
351                    
352          text += "\n\nIncidence with %d relations:" % self.var.getNumIncidentRelations()          text += "\n\nIncidence with %d relations:" % self.var.getNumIncidentRelations()
353          for r in self.var.getIncidentRelations():          for r in self.var.getIncidentRelations():
354              text += "\n%s" % r.getName()              text += "\n  %s" % r.getName()
355    
356          _dialog = InfoDialog(self.browser,self.window,text,title)          _dialog = InfoDialog(self.browser,self.window,text,title)
357          _dialog.run()          _dialog.run()
# Line 337  class DiagnoseWindow: Line 359  class DiagnoseWindow:
359      def on_relinfobutton_clicked(self,*args):      def on_relinfobutton_clicked(self,*args):
360          title = "Relation '%s'" % self.rel          title = "Relation '%s'" % self.rel
361          text = "%s\n%s\n" % (title,"(from the solver's view)")          text = "%s\n%s\n" % (title,"(from the solver's view)")
362          text += "\n%-30s%15f" % ("Residual", self.rel.getResidual())          text += "\n  %-30s%15f" % ("Residual", self.rel.getResidual())
363    
364            text += "\n\nRelation expression:\n"
365            text += self.rel.getRelationAsString()
366    
367          _dialog = InfoDialog(self.browser,self.window,text,title)          _dialog = InfoDialog(self.browser,self.window,text,title)
368          _dialog.run()          _dialog.run()

Legend:
Removed from v.735  
changed lines
  Added in v.736

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22