Skip to content

Commit

Permalink
Make Selection work on a saved copy of its data
Browse files Browse the repository at this point in the history
  • Loading branch information
klarh committed Jun 22, 2020
1 parent a6f2695 commit cec8b2d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions flowws_analysis/Selection.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import copy
import functools

import flowws
Expand All @@ -7,6 +8,7 @@

DEFAULT_PARTICLE_QUANTITIES = [
'color',
'diameter',
'orientation',
'position',
'type',
Expand Down Expand Up @@ -80,6 +82,7 @@ def run(self, scope, storage):
for name in found_quantities:
scope[name] = scope[name][this_filter]

self.saved_scope = copy.copy(scope)
self.gui_actions = [
('Select rectangle', self._rectangle_callback),
('Dynamic rectangle', self._dynamic_rectangle),
Expand All @@ -90,7 +93,7 @@ def run(self, scope, storage):

def _add_mouse_selection(self, scope, rotation, translation, lower, upper):
indices = filter_rectangle(
scope, translation, rotation, lower, upper)
self.saved_scope, translation, rotation, lower, upper)

if len(indices):
self.arguments['criteria'].append(str(indices.tolist()))
Expand Down Expand Up @@ -139,7 +142,7 @@ def _pop_selection(self, scope, storage):
scope['rerun_callback']()

def _remove_hull(self, scope, storage):
keep_indices = convex_hull_indices(scope)
keep_indices = convex_hull_indices(self.saved_scope)
self.arguments['criteria'].append(str(keep_indices))

if scope.get('rerun_callback', None) is not None:
Expand Down

0 comments on commit cec8b2d

Please sign in to comment.