Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev test fix take two #8

Merged
merged 3 commits into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions lcviz/state.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from echo import delay_callback
import numpy as np

from glue.viewers.scatter.state import ScatterViewerState
Expand All @@ -24,9 +23,10 @@ def _reset_att_limits(self, ax):
if not np.all(np.isfinite([ax_min, ax_max])): # pragma: no cover
return

with delay_callback(self, f'{ax}_min', f'{ax}_max'):
setattr(self, f'{ax}_min', ax_min)
setattr(self, f'{ax}_max', ax_max)
lim_helper = getattr(self, f'{ax}_lim_helper')
lim_helper.lower = ax_min
lim_helper.upper = ax_max
lim_helper.update_values()

def _reset_x_limits(self, *event):
self._reset_att_limits('x')
Expand All @@ -50,11 +50,15 @@ def reset_limits(self, *event):
y_min = min(y_min, np.nanmin(y_data))
y_max = max(y_max, np.nanmax(y_data))

with delay_callback(self, 'x_min', 'x_max', 'y_min', 'y_max'):
self.x_min = x_min
self.x_max = x_max
self.y_min = y_min
self.y_max = y_max
# We need to adjust the limits in here to avoid triggering all
# the update events then changing the limits again.
self._adjust_limits_aspect()
x_lim_helper = getattr(self, 'x_lim_helper')
x_lim_helper.lower = x_min
x_lim_helper.upper = x_max

y_lim_helper = getattr(self, 'y_lim_helper')
y_lim_helper.lower = y_min
y_lim_helper.upper = y_max

x_lim_helper.update_values()
y_lim_helper.update_values()

self._adjust_limits_aspect()