Skip to content

Commit

Permalink
separate toggle for flattened and trend live-preview visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Sep 22, 2023
1 parent 89c81e1 commit d3c51f3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
21 changes: 13 additions & 8 deletions lcviz/plugins/flatten/flatten.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)

Expand All @@ -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']
Expand Down Expand Up @@ -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')
Expand Down
12 changes: 10 additions & 2 deletions lcviz/plugins/flatten/flatten.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,22 @@
<v-row>
<v-switch
v-model="show_live_preview"
label="Show live preview"
hint="Whether to show live preview of flattening options. Note that the live-preview of the flattened light curve is not yet normalized."
label="Show flattened preview"
hint="Whether to show live-preview of the unnormalized flattened light curve."
persistent-hint
></v-switch>
</v-row>
<v-row v-if="show_live_preview && !unnormalize">
<v-alert type="warning">Live preview is unnormalized, but flattening will normalize.</v-alert>
</v-row>
<v-row>
<v-switch
v-model="show_trend_preview"
label="Show trend preview"
hint="Whether to show live-preview of the trend used for flattening."
persistent-hint
></v-switch>
</v-row>
<v-row>
<v-switch
v-model="default_to_overwrite"
Expand Down

0 comments on commit d3c51f3

Please sign in to comment.