From d3c51f329c369e27ae890467512d9cd42ea98ade Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Wed, 30 Aug 2023 07:48:08 -0400 Subject: [PATCH] separate toggle for flattened and trend live-preview visibility --- lcviz/plugins/flatten/flatten.py | 21 +++++++++++++-------- lcviz/plugins/flatten/flatten.vue | 12 ++++++++++-- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/lcviz/plugins/flatten/flatten.py b/lcviz/plugins/flatten/flatten.py index 87cc534b..605b02cb 100644 --- a/lcviz/plugins/flatten/flatten.py +++ b/lcviz/plugins/flatten/flatten.py @@ -26,7 +26,10 @@ class Flatten(PluginTemplateMixin, DatasetSelectMixin, AddResultsMixin): Only the following attributes and methods are available through the public plugin API. - * ``show_live_preview`` + * ``show_live_preview`` : bool + Whether to show the live-preview of the (unnormalized) flattened light curve + * ``show_trend_preview`` : bool + Whether to show the live-preview of the removed trend * ``default_to_overwrite`` * ``dataset`` (:class:`~jdaviz.core.template_mixin.DatasetSelect`): Dataset to flatten. @@ -43,6 +46,7 @@ class Flatten(PluginTemplateMixin, DatasetSelectMixin, AddResultsMixin): uses_active_status = Bool(True).tag(sync=True) show_live_preview = Bool(True).tag(sync=True) + show_trend_preview = Bool(True).tag(sync=True) default_to_overwrite = Bool(True).tag(sync=True) flatten_err = Unicode().tag(sync=True) @@ -65,7 +69,7 @@ def __init__(self, *args, **kwargs): @property def user_api(self): - expose = ['show_live_preview', 'default_to_overwrite', + expose = ['show_live_preview', 'show_trend_preview', 'default_to_overwrite', 'dataset', 'add_results', 'window_length', 'polyorder', 'break_tolerance', 'niters', 'sigma', 'unnormalize', 'flatten'] @@ -160,20 +164,21 @@ def _clear_marks(self): mark.clear() mark.visible = False - @observe('is_active', 'show_live_preview') + @observe('is_active', 'show_live_preview', 'show_trend_preview') def _toggle_marks(self, event={}): - visible = self.show_live_preview and self.is_active + live_visible = self.show_live_preview and self.is_active + trend_visible = self.show_trend_preview and self.is_active trend_marks, flattened_marks = self.marks for mark in trend_marks.values(): - mark.visible = visible + mark.visible = trend_visible for mark in flattened_marks.values(): - mark.visible = visible + mark.visible = live_visible - if visible: + if live_visible or trend_visible: self._live_update(event) - @observe('is_active', 'show_live_preview', + @observe('is_active', 'show_live_preview', 'show_trend_preview', 'dataset_selected', 'window_length', 'polyorder', 'break_tolerance', 'niters', 'sigma') diff --git a/lcviz/plugins/flatten/flatten.vue b/lcviz/plugins/flatten/flatten.vue index 8d7e3ce7..9667b1b8 100644 --- a/lcviz/plugins/flatten/flatten.vue +++ b/lcviz/plugins/flatten/flatten.vue @@ -17,14 +17,22 @@ Live preview is unnormalized, but flattening will normalize. + + +