Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Oct 18, 2023
1 parent 95d9cee commit 6874b75
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lcviz/plugins/binning/binning.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ def _toggle_marks(self, event={}):

mark.visible = this_visible

if visible:
if visible and event.get('name', '') in ('is_active', 'show_live_preview'):
# then the marks themselves need to be updated
self._live_update(event)

@observe('dataset_selected', 'ephemeris_selected',
Expand All @@ -152,6 +153,10 @@ def _live_update(self, event={}):
self.bin_enabled = self.n_bins != '' and self.n_bins > 0
return

if event.get('name', '') not in ('is_active', 'show_live_preview'):
# mark visibility hasn't been handled yet
self._toggle_marks()

try:
lc = self.bin(add_data=False)
except Exception:
Expand Down
7 changes: 6 additions & 1 deletion lcviz/plugins/flatten/flatten.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ def _toggle_marks(self, event={}):
for mark in flattened_marks.values():
mark.visible = visible

if visible:
if visible and event.get('name') in ('is_active', 'show_live_preview'):
# then the marks themselves need to be updated
self._live_update(event)

@observe('dataset_selected',
Expand All @@ -186,6 +187,10 @@ def _live_update(self, event={}):
return
self.flatten_err = ''

if event.get('name') not in ('is_active', 'show_live_preview'):
# mark visibility hasn't been handled yet
self._toggle_marks(event)

if self.unnormalize:
output_flux = output_lc.flux.value
else:
Expand Down
4 changes: 3 additions & 1 deletion lcviz/tests/test_plugin_flatten.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def test_plugin_flatten(helper, light_curve_like_kepler_quarter):
# update polyorder (live-preview should re-appear and have changed from before)
f.polyorder = before_polyorder + 1
assert f._obj.flatten_err == ''
after_update = _get_marks_from_viewer(tv)[0].y
marks = _get_marks_from_viewer(tv)
assert len(marks) == 2
after_update = marks[0].y
assert not np.allclose(before_update, after_update)

orig_label = f.dataset.selected
Expand Down

0 comments on commit 6874b75

Please sign in to comment.