Skip to content

Commit

Permalink
Don't update Data.coords if not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed May 7, 2018
1 parent 49fc921 commit c8ccaac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions glue/core/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,10 @@ def coords(self):

@coords.setter
def coords(self, value):
self._coords = value
if len(self.components) > 0:
self._update_world_components(self.ndim)
if (hasattr(self, '_coords') and self._coords != value) or not hasattr(self, '_coords'):
self._coords = value
if len(self.components) > 0:
self._update_world_components(self.ndim)

@property
def subsets(self):
Expand Down
1 change: 1 addition & 0 deletions glue/viewers/matplotlib/qt/tests/test_data_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ def test_numerical_data_changed(self):
self.viewer.add_data(self.data)
assert self.draw_count == 1
data = Data()
data.coords = self.data.coords
for cid in self.data.visible_components:
data.add_component(self.data[cid] * 2, cid.label)
self.data.update_values_from_data(data)
Expand Down

0 comments on commit c8ccaac

Please sign in to comment.