From 9d7a5ba769817864bd5cd056564e1d73038683f7 Mon Sep 17 00:00:00 2001 From: tangstad Date: Tue, 25 Apr 2006 10:08:12 +0000 Subject: [PATCH] Optimized plot selection. --- system/plots.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/system/plots.py b/system/plots.py index 1b2f253..84b1989 100644 --- a/system/plots.py +++ b/system/plots.py @@ -187,7 +187,7 @@ class Plot (gtk.Frame): def set_project(self, project): self.project = project - + class EmptyView (Plot): def __init__(self): @@ -260,6 +260,8 @@ class ScatterPlot(Plot): x2, y2 = event2.xdata, event2.ydata ydata = self.yaxis_data xdata = self.xaxis_data + + # find indices of selected area if x1>x2: if y1x2) & (ydata>y1) & (ydatax1) & (xdatay2)) - ids = [id for id,ind in self.dataset[self.current_dim].items() if ind in index] + # generate ids for selected indices + reverse = {} + for key, value in self.dataset[self.current_dim].items(): + reverse[value] = key + ids = [] + for ind in index: + ids.append(reverse[ind]) + self.project.set_selection(self.current_dim,ids) def update(self, key):