Skip to content

Commit

Permalink
Merge pull request #330 from eteq/specviz-helper-helper
Browse files Browse the repository at this point in the history
add specviz property to cubeviz/mosviz helpers
  • Loading branch information
rosteen authored Apr 12, 2021
2 parents 4ead05b + 0f0c8ab commit ba65f9d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
13 changes: 12 additions & 1 deletion jdaviz/configs/cubeviz/helper.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
from jdaviz.core.helpers import ConfigHelper
from ..default.plugins.line_lists.line_list_mixin import LineListMixin
from jdaviz.configs.default.plugins.line_lists.line_list_mixin import LineListMixin
from jdaviz.configs.specviz import SpecViz


class CubeViz(ConfigHelper, LineListMixin):
"""CubeViz Helper class"""
_default_configuration = 'cubeviz'

@property
def specviz(self):
"""
A specviz helper (`~jdaviz.configs.specviz.SpecViz`) for the Jdaviz
application that is wrapped by cubeviz
"""
if not hasattr(self, '_specviz'):
self._specviz = SpecViz(app=self.app)
return self._specviz
16 changes: 14 additions & 2 deletions jdaviz/configs/mosviz/helper.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import numpy as np
from pathlib import Path

from jdaviz.core.helpers import ConfigHelper
from jdaviz.core.events import SnackbarMessage
from astropy.table import QTable
import astropy.units as u

from jdaviz.core.helpers import ConfigHelper
from jdaviz.core.events import SnackbarMessage
from jdaviz.configs.specviz import SpecViz


class MosViz(ConfigHelper):
"""MosViz Helper class"""
Expand Down Expand Up @@ -282,3 +284,13 @@ def to_csv(self, filename="MOS_data.csv", selected=False, overwrite=False):
table_df = table_df.drop(labels="Pixel Axis 0 [x]", axis=1)

table_df.to_csv(filename, index_label="Table Index")

@property
def specviz(self):
"""
A specviz helper (`~jdaviz.configs.specviz.SpecViz`) for the Jdaviz
application that is wrapped by mosviz
"""
if not hasattr(self, '_specviz'):
self._specviz = SpecViz(app=self.app)
return self._specviz

0 comments on commit ba65f9d

Please # to comment.