/[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 736 by johnpye, Wed Jul 5 04:56:26 2006 UTC revision 737 by johnpye, Wed Jul 5 12:36:29 2006 UTC
# Line 340  class DiagnoseWindow: Line 340  class DiagnoseWindow:
340              ,"Upper bound": self.var.getUpperBound()              ,"Upper bound": self.var.getUpperBound()
341          }          }
342          for k,v in _rows.iteritems():          for k,v in _rows.iteritems():
343              if v!=0:              text += "\n  %s\t%s" % (k,value_human(v))
                 l = math.log10(abs(v))  
             else:  
                 l = 0;  
             if l > 8 or l < -8:  
                 text += "\n  %-30s%15e" % (k,v)  
             else:  
                 text += "\n  %-30s%15f" % (k,v)  
344                    
345          text += "\n\nIncidence with %d relations:" % self.var.getNumIncidentRelations()          text += "\n\nIncident with %d relations:" % self.var.getNumIncidentRelations()
346          for r in self.var.getIncidentRelations():          for r in self.var.getIncidentRelations():
347              text += "\n  %s" % r.getName()              text += "\n  %s" % r.getName()
348    
349          _dialog = InfoDialog(self.browser,self.window,text,title)          _dialog = InfoDialog(self.browser,self.window,text,title,tabs=(150,300))
350          _dialog.run()          _dialog.run()
351    
352      def on_relinfobutton_clicked(self,*args):      def on_relinfobutton_clicked(self,*args):
353          title = "Relation '%s'" % self.rel          title = "Relation '%s'" % self.rel
354          text = "%s\n%s\n" % (title,"(from the solver's view)")          text = "%s\n%s\n" % (title,"(from the solver's view)")
355          text += "\n  %-30s%15f" % ("Residual", self.rel.getResidual())          text += "\n  %s\t%15f" % ("Residual", self.rel.getResidual())
356    
357          text += "\n\nRelation expression:\n"          text += "\n\nRelation expression:\n"
358          text += self.rel.getRelationAsString()          text += self.rel.getRelationAsString()
359    
360          _dialog = InfoDialog(self.browser,self.window,text,title)          text += "\n\nIncident with %d variables:" % self.rel.getNumIncidentVariables()
361            for v in self.rel.getIncidentVariables():
362                text += "\n  %s\t= %s" % ( v.getName(),value_human(v.getValue()) )
363    
364            _dialog = InfoDialog(self.browser,self.window,text,title,tabs=(150,300))
365          _dialog.run()          _dialog.run()
366                    
367    
# Line 434  class DiagnoseWindow: Line 431  class DiagnoseWindow:
431          self.show_cursor(event.x, event.y)          self.show_cursor(event.x, event.y)
432    
433    
434  # The following is from  def value_human(v):
435        if v==0 or abs( math.log10(abs(v)) )<8:
436            return "%f" % v
437        return "%e" % v
438    
439    #---------------------------------------
440    # Procedures to 'fold' a list of items from a hierarchy
441  # http://www.experts-exchange.com/Programming/Programming_Languages/Python/Q_21719649.html  # http://www.experts-exchange.com/Programming/Programming_Languages/Python/Q_21719649.html
442  # it's still buggy.  # It's still buggy, I think
443    
444  def fold(data):  def fold(data):
445      """ fold sorted numeric sequence data into ranged representation:      """ fold sorted numeric sequence data into ranged representation:
# Line 482  def get(indexed, item): Line 485  def get(indexed, item):
485          item, idx = item[:-1].split('[')          item, idx = item[:-1].split('[')
486          indexed.setdefault(item, []).append(int(idx))          indexed.setdefault(item, []).append(int(idx))
487      return item      return item
488    

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

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