]> git.donarmstrong.com Git - lilypond.git/commitdiff
* buildscripts/output-distance.py
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 1 Jun 2006 18:59:36 +0000 (18:59 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 1 Jun 2006 18:59:36 +0000 (18:59 +0000)
(ComparisonData.write_text_result_page): separate the scores, sort
by geo_score.

* buildscripts/output-distance.py (me_path): use argv[0] for
sys.path extension
(ComparisonData.img_cell): use colored borders.

ChangeLog
buildscripts/output-distance.py

index 0cd1688b2eec73e5e4f0e781462f36f17f003b20..c4d691bb11694ed8f82ef28f17c40c3bee7b320a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2006-06-01  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
+       * buildscripts/output-distance.py
+       (ComparisonData.write_text_result_page): separate the scores, sort
+       by geo_score.
+
        * scm/framework-eps.scm (output-classic-framework): start at 1 for
        system signatures.
 
index f5370e29c1664591815dbff9872e35828f60d3ed..4a851a65ed007f38d2a6f04754ea1870518778a7 100644 (file)
@@ -103,11 +103,6 @@ class GrobSignature:
         else:
             return OUTPUT_EXPRESSION_PENALTY
 
-    def distance(self, other, max_distance):
-        return (self.expression_distance (other)
-                + self.centroid_distance (other, max_distance)
-                + self.bbox_distance (other))
-            
 class SystemSignature:
     def __init__ (self, grob_sigs):
         d = {}
@@ -163,24 +158,35 @@ class SystemLink:
             self.link_list_dict[closest].append (g)
             self.back_link_dict[g] = closest
 
-    def distance (self):
+    def geometric_distance (self):
         d = 0.0
+        for (g1,g2) in self.back_link_dict.items ():
+            if g2:
+                # , scale
+                d += g1.bbox_distance (g2)
 
-        scale = max (bbox_diameter (self.system1.bbox),
-                     bbox_diameter (self.system2.bbox))
-                                      
+        return d
+    
+    def orphan_distance (self):
+        d = 0.0
         for (g1,g2) in self.back_link_dict.items ():
             if g2 == None:
                 d += ORPHAN_GROB_PENALTY
-            else:
-                d += g1.distance (g2, scale)
-
-        for (g1,g2s) in self.link_list_dict.items ():
-            if len (g2s) != 1:
-                d += ORPHAN_GROB_PENALTY
+        return d
+    
+    def output_exp_distance (self):
+        d = 0.0
+        for (g1,g2) in self.back_link_dict.items ():
+            if g2:
+                d += g1.expression_distance (g2)
 
         return d
 
+    def distance (self):
+        return (self.output_exp_distance (),
+                self.orphan_distance (),
+                self.geometric_distance ())
+    
 ################################################################
 # Files/directories
 
@@ -269,8 +275,13 @@ class ComparisonData:
             out = sys.stdout
         else:
             out = open (filename, 'w')
+
+        ## todo: support more scores.
+        results = [(geo_score, oldfile, file)
+                   for (file, ((exp_score, orphan_score,
+                                geo_score), oldfile))
+                   in self.result_dict.items ()]
         
-        results = [(score, oldfile, file) for (file, (score, oldfile)) in self.result_dict.items ()]  
         results.sort ()
         results.reverse ()
 
@@ -291,8 +302,9 @@ class ComparisonData:
         
         threshold = 1.0
         
-        results = [(score, oldfile, file) for (file, (score, oldfile)) in self.result_dict.items ()
-                   if score > threshold]
+        results = [(geo_score, oldfile, file) for (file, ((exp_score, orphan_score,
+                                                           geo_score), oldfile)) in self.result_dict.items ()
+                   if geo_score > threshold]
 
         results.sort ()
         results.reverse ()