Skip to content

Commit

Permalink
use feature-flag to enable/disable cone apertures
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Jan 24, 2024
1 parent f006a2b commit c505591
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion jdaviz/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class Application(VuetifyTemplate, HubListener):
# To make a feature public:
# * search for all instances of the feature label and remove any if-blocks, boolean traitlets
# in plugins, and ultimately remove from this dictionary.
feature_flags = Dict({}).tag(sync=True)
feature_flags = Dict({'cone_apertures': False}).tag(sync=True)

def __init__(self, configuration=None, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class SpectralExtraction(PluginTemplateMixin, ApertureSubsetSelectMixin,
uses_active_status = Bool(True).tag(sync=True)

# feature flag for cone support
dev_cone_support = Bool(False).tag(sync=True)
ff_cone_apertures = Bool(False).tag(sync=True)
wavelength_dependent = Bool(False).tag(sync=True)
reference_wavelength = FloatHandleEmpty().tag(sync=True)
slice_wavelength = Float().tag(sync=True)
Expand Down Expand Up @@ -109,6 +109,8 @@ def __init__(self, *args, **kwargs):
"please load data to enable this plugin."
)

self._sync_feature_flag('ff_cone_apertures', 'cone_apertures')

@property
def user_api(self):
return PluginUserApi(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
hint="Select a spatial region to extract its spectrum."
/>

<div v-if="aperture_selected !== 'Entire Cube' && dev_cone_support">
<div v-if="aperture_selected !== 'Entire Cube' && ff_cone_apertures">
<v-alert type='warning'>cone support is under active development and hidden from users</v-alert>
<v-row>
<v-switch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,17 @@ def test_aperture_markers(cubeviz_helper, spectrum1d_cube):
assert mark.x[1] == before_x[1]

slice_plg.slice = 0
extract_plg._obj.dev_cone_support = True
extract_plg._obj.wavelength_dependent = True
assert mark.x[1] == before_x[1]
with cubeviz_helper.app._ff_temporarily_enabled('cone_apertures'):
extract_plg._obj.wavelength_dependent = True
assert mark.x[1] == before_x[1]

slice_plg.slice = 1
assert mark.x[1] != before_x[1]
slice_plg.slice = 1
assert mark.x[1] != before_x[1]

extract_plg._obj.vue_goto_reference_wavelength()
assert slice_plg.slice == 0
extract_plg._obj.vue_goto_reference_wavelength()
assert slice_plg.slice == 0

slice_plg.slice = 1
extract_plg._obj.vue_adopt_slice_as_reference()
extract_plg._obj.vue_goto_reference_wavelength()
assert slice_plg.slice == 1
slice_plg.slice = 1
extract_plg._obj.vue_adopt_slice_as_reference()
extract_plg._obj.vue_goto_reference_wavelength()
assert slice_plg.slice == 1

0 comments on commit c505591

Please sign in to comment.