-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plugin wireframe for photometric extraction
- Loading branch information
Showing
6 changed files
with
153 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .photometric_extraction import * # noqa |
62 changes: 62 additions & 0 deletions
62
lcviz/plugins/photometric_extraction/photometric_extraction.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from traitlets import Bool, observe | ||
|
||
from jdaviz.core.registries import tray_registry | ||
from jdaviz.core.template_mixin import (PluginTemplateMixin, | ||
DatasetSelectMixin, AddResultsMixin, | ||
skip_if_no_updates_since_last_active, | ||
with_spinner, with_temp_disable) | ||
from jdaviz.core.user_api import PluginUserApi | ||
|
||
|
||
__all__ = ['PhotometricExtraction'] | ||
|
||
|
||
@tray_registry('photometric-extraction', label="Photometric Extraction") | ||
class PhotometricExtraction(PluginTemplateMixin, DatasetSelectMixin, | ||
AddResultsMixin): | ||
""" | ||
See the :ref:`Photometric Extraction Plugin Documentation <photometric-extraction>` | ||
for more details. | ||
Only the following attributes and methods are available through the | ||
:ref:`public plugin API <plugin-apis>`: | ||
* :meth:`~jdaviz.core.template_mixin.PluginTemplateMixin.show` | ||
* :meth:`~jdaviz.core.template_mixin.PluginTemplateMixin.open_in_tray` | ||
* :meth:`~jdaviz.core.template_mixin.PluginTemplateMixin.close_in_tray` | ||
* ``dataset`` (:class:`~jdaviz.core.template_mixin.DatasetSelect`): | ||
Dataset to bin. | ||
* ``add_results`` (:class:`~jdaviz.core.template_mixin.AddResults`) | ||
* :meth:`extract` | ||
""" | ||
template_file = __file__, "photometric_extraction.vue" | ||
uses_active_status = Bool(True).tag(sync=True) | ||
|
||
show_live_preview = Bool(True).tag(sync=True) | ||
|
||
apply_enabled = Bool(True).tag(sync=True) | ||
|
||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
|
||
def is_tpf(data): | ||
return len(data.shape) == 3 | ||
self.dataset.add_filter(is_tpf) | ||
|
||
@property | ||
def user_api(self): | ||
expose = ['show_live_preview', 'dataset', | ||
'add_results', 'extract'] | ||
return PluginUserApi(self, expose=expose) | ||
|
||
@property | ||
def marks(self): | ||
marks = {} | ||
return marks | ||
|
||
@with_spinner() | ||
def extract(self, add_data=True): | ||
raise NotImplementedError | ||
|
||
def vue_apply(self, event={}): | ||
self.extract(add_data=True) |
55 changes: 55 additions & 0 deletions
55
lcviz/plugins/photometric_extraction/photometric_extraction.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<template> | ||
<j-tray-plugin | ||
description='Extract light curve from TPF data.' | ||
:link="'https://lcviz.readthedocs.io/en/'+vdocs+'/plugins.html#photometric-extraction'" | ||
:uses_active_status="uses_active_status" | ||
@plugin-ping="plugin_ping($event)" | ||
:keep_active.sync="keep_active" | ||
:popout_button="popout_button"> | ||
|
||
<v-row> | ||
<v-expansion-panels popout> | ||
<v-expansion-panel> | ||
<v-expansion-panel-header v-slot="{ open }"> | ||
<span style="padding: 6px">Settings</span> | ||
</v-expansion-panel-header> | ||
<v-expansion-panel-content> | ||
<v-row> | ||
<v-switch | ||
v-model="show_live_preview" | ||
label="Show live preview" | ||
hint="Whether to show live preview of binning options." | ||
persistent-hint | ||
></v-switch> | ||
</v-row> | ||
</v-expansion-panel-content> | ||
</v-expansion-panel> | ||
</v-expansion-panels> | ||
</v-row> | ||
|
||
<plugin-dataset-select | ||
:items="dataset_items" | ||
:selected.sync="dataset_selected" | ||
:show_if_single_entry="false" | ||
label="Data" | ||
hint="Select the TPF as input." | ||
/> | ||
|
||
<plugin-add-results | ||
:label.sync="results_label" | ||
:label_default="results_label_default" | ||
:label_auto.sync="results_label_auto" | ||
:label_invalid_msg="results_label_invalid_msg" | ||
:label_overwrite="results_label_overwrite" | ||
label_hint="Label for the extracted light curve." | ||
:add_to_viewer_items="add_to_viewer_items" | ||
:add_to_viewer_selected.sync="add_to_viewer_selected" | ||
action_label="Extract" | ||
action_tooltip="Extract photometry" | ||
:action_disabled="!apply_enabled" | ||
:action_spinner="spinner" | ||
@click:action="apply" | ||
></plugin-add-results> | ||
|
||
</j-tray-plugin> | ||
</template> |