-
Notifications
You must be signed in to change notification settings - Fork 9
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
Get dev tests to pass #93
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #93 +/- ##
=======================================
Coverage 94.18% 94.18%
=======================================
Files 35 35
Lines 1548 1548
=======================================
Hits 1458 1458
Misses 90 90 ☔ View full report in Codecov by Sentry. |
I realized that the lcviz y_max test is failing with remote data because even though that particular test doesn't have remote data, the viewer still has the y_max from the remote data initially, so checking against that after resetting the zoom to the generated data obviously fails. |
Seems like this is from spacetelescope/jdaviz#2649, after testing individual |
After more investigation I've pinned this down more precisely. Setting the bounds to the incorrect values (apparently from previous data) happens when the
And actually, inside the |
So I don't have to keep redigging. Line 181 in 7b78df5
Failure log: https://github.com/spacetelescope/lcviz/actions/runs/8050877356/job/21987497689
|
UPDATE: Nevermind, I don't think freezable anything is used here. See spacetelescope/jdaviz#2746 My hunch points to https://github.com/spacetelescope/jdaviz/blob/0655d4a43b82323042db87a74d352ecf0590d5fc/jdaviz/core/freezable_state.py#L70-L71 but I dunno what that code is supposed to accomplish. When all the limits are being changed at once, won't
class FreezableBqplotImageViewerState(BqplotImageViewerState, FreezableState):
# ...
def __init__(self, *args, **kwargs):
# ...
for attr in ('x_min', 'x_max', 'y_min', 'y_max'):
self.add_callback(attr, self._set_axes_lim)
super().__init__(*args, **kwargs)
def reset_limits(self):
if not self.using_polar:
self._reset_x_limits()
self._reset_y_limits() Also there is no example of setting |
Yes, that can result in the same code being needlessly called 4 times if not delayed when calling, but the final call should contain the final limits and result in the correct result. This should not apply here though since that is only used for image viewers. |
Actually, I see a pattern. In Jdaviz, all the viewers has something like this: _state_cls = FreezableSomethingViewerState But not here: Line 37 in 7b78df5
But since Jdaviz does not have any scatter viewer, there is no such thing as a |
No, lcviz does not need any overrides to the state at this time (the name "Freezable" is for mosviz, which does not apply here, and none of the other overrides to reset_limits, etc, are needed here). I don't suspect that would be the cause of this bug (and wasn't changed in the at-fault PR) - but I could be wrong since I don't know what is actually causing the failure. |
So your scatter viewer state is here: https://github.com/glue-viz/glue/blob/1bbd6e8282a59abfc857eab70f2c9cffe455bc05/glue/viewers/scatter/state.py#L23C1-L23C52 class ScatterViewerState(MatplotlibDataViewerState) The parent is here: https://github.com/glue-viz/glue/blob/1bbd6e8282a59abfc857eab70f2c9cffe455bc05/glue/viewers/matplotlib/state.py#L118 (I guess the Matplotlib in the name is misleading since glue-jupyter also uses it) class MatplotlibDataViewerState(ViewerState):
"""
A base class that includes common attributes for viewers based on
Matplotlib.
"""
x_min = DeferredDrawCallbackProperty(docstring='Lower limit of the visible x range')
x_max = DeferredDrawCallbackProperty(docstring='Upper limit of the visible x range')
y_min = DeferredDrawCallbackProperty(docstring='Lower limit of the visible y range')
y_max = DeferredDrawCallbackProperty(docstring='Upper limit of the visible y range') The attributes you are changing ( When the parent changes it directly, a child might be affected. Consider this: class Parent:
x_min = 1
class Child(Parent):
pass
c1 = Child()
c2 = Child() >>> c2.x_min = 1
>>> Parent.x_min = 100
>>> c1.x_min # Inherits from Parent class, is this what is happening?
100
>>> c2.x_min # Already set in instance before, so not affected
1 |
To continue from above, it looks like the scatter viewer state resets using percentile, unlike the profile viewer, and yes, the percentile is a class attribute. So if you never touch it here, then maybe percentile is being changed at the class level accidentally? def _reset_y_limits(self, *args):
if self.y_att is None:
return
self.y_lim_helper.percentile = self.y_limits_percentile
self.y_lim_helper.update_values(force=True) |
Might have found the culprit: https://github.com/spacetelescope/lcviz/pull/96/files#r1521909661 |
Trying to get tests to pass with the dev version of Jdaviz. I suspect the axis rounding thing is actually the dev version of another dependency but I'm not sure.