From 6ab99e81f86efea8f1a8a3cd850c3886f8d728da Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 1 Jun 2006 18:59:36 +0000 Subject: [PATCH] * buildscripts/output-distance.py (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 | 4 +++ buildscripts/output-distance.py | 48 ++++++++++++++++++++------------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0cd1688b2e..c4d691bb11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2006-06-01 Han-Wen Nienhuys + * 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. diff --git a/buildscripts/output-distance.py b/buildscripts/output-distance.py index f5370e29c1..4a851a65ed 100644 --- a/buildscripts/output-distance.py +++ b/buildscripts/output-distance.py @@ -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 () -- 2.39.5