Skip to content

Commit

Permalink
set correct attributes for axes in cube viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Jan 23, 2024
1 parent 408b89b commit 77575c0
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lcviz/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

from jdaviz.core.events import NewViewerMessage
from jdaviz.core.registries import viewer_registry
from jdaviz.configs.cubeviz.helper import layer_is_cube_image_data
from jdaviz.configs.cubeviz.plugins.viewers import CubevizImageView
from jdaviz.configs.default.plugins.viewers import JdavizViewerMixin
from jdaviz.configs.specviz.plugins.viewers import SpecvizProfileView

Expand Down Expand Up @@ -267,7 +269,7 @@ def times_to_phases(self, times):


@viewer_registry("lcviz-cube-viewer", label="cube")
class CubeView(JdavizViewerMixin, CloneViewerMixin, BqplotImageView):
class CubeView(CloneViewerMixin, CubevizImageView):
# categories: zoom resets, zoom, pan, subset, select tools, shortcuts
tools_nested = [
['jdaviz:homezoom', 'jdaviz:prevzoom'],
Expand All @@ -292,6 +294,25 @@ def __init__(self, *args, **kwargs):
# Hide axes by default
self.state.show_axes = False

# TODO: refactor upstream so lcviz can inherit cubeviewer methods/setup with jdaviz-specific
# logic:
# * _default_spectrum_viewer_reference_name
# * _default_flux_viewer_reference_name
# * _default_uncert_viewer_reference_name

def _initial_x_axis(self, *args):
# Make sure that the x_att/y_att is correct on data load
ref_data = self.state.reference_data
self.state.x_att = ref_data.id['Pixel Axis 2 [x]']
self.state.y_att = ref_data.id['Pixel Axis 1 [y]']

def _on_layers_update(self, layers=None):
super()._on_layers_update(layers=layers)
flux_comp = self.state.reference_data.id['flux']
for layer in self.state.layers:
if layer.attribute != flux_comp:
layer.attribute = flux_comp

def data(self, cls=None):
# TODO: generalize upstream in jdaviz.
# This method is generalized from
Expand Down

0 comments on commit 77575c0

Please sign in to comment.