Skip to content

Commit

Permalink
undone some other changes - unsure if this is a good idea
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed May 7, 2022
1 parent 6b6bd79 commit 586d194
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
21 changes: 17 additions & 4 deletions glue/viewers/profile/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,18 @@ def _reset_x_limits(self, *event):

data = self.reference_data

if self.x_att in data.pixel_component_ids:
x_min, x_max = -0.5, data.shape[self.x_att.axis] - 0.5
else:
axis = data.world_component_ids.index(self.x_att)
axis_view = [0] * data.ndim
axis_view[axis] = slice(None)
axis_values = data[self.x_att, tuple(axis_view)]
x_min, x_max = np.nanmin(axis_values), np.nanmax(axis_values)

with delay_callback(self, 'x_min', 'x_max'):
self.x_min = -0.5
self.x_max = data.shape[self.x_att_pixel.axis] - 0.5
self.x_min = x_min
self.x_max = x_max

def _reset_y_limits(self, *event):
if self.normalize:
Expand Down Expand Up @@ -180,8 +189,12 @@ def _reference_data_changed(self, before=None, after=None):
self.x_att_helper.set_multiple_data([])
else:
self.x_att_helper.set_multiple_data([self.reference_data])
self.x_att_helper.world_coord = False
self.x_att = self.reference_data.pixel_component_ids[0]
if self._display_world:
self.x_att_helper.world_coord = True
self.x_att = self.reference_data.world_component_ids[0]
else:
self.x_att_helper.world_coord = False
self.x_att = self.reference_data.pixel_component_ids[0]

self._update_x_att()

Expand Down
2 changes: 0 additions & 2 deletions glue/viewers/profile/tests/test_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ def test_basic_world(self):
assert_allclose(x, [0, 1, 2])
assert_allclose(y, [3.5, 11.5, 19.5])


def test_x_att(self):

self.viewer_state.x_att = self.data.pixel_component_ids[0]
x, y = self.layer_state.profile
assert_allclose(x, [0, 1, 2])
Expand Down

0 comments on commit 586d194

Please sign in to comment.