-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding support for visualizing all pixels in subsets, and per pixel o…
…n hover
- Loading branch information
Showing
11 changed files
with
216 additions
and
118 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from .tools import * # noqa | ||
from .mixins import * # noqa | ||
from .viewers import * # noqa | ||
from .parsers import * # noqa | ||
from .moment_maps.moment_maps import * # noqa | ||
from .slice.slice import * # noqa | ||
from .spectral_extraction.spectral_extraction import * # noqa | ||
from .tools import * # noqa |
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,47 @@ | ||
from glue_jupyter.bqplot.profile import BqplotProfileView | ||
from jdaviz.core.tools import SinglePixelRegion | ||
from jdaviz.core.marks import PluginLine | ||
|
||
|
||
__all__ = ['ProfileFromCube'] | ||
|
||
|
||
class ProfileFromCube(SinglePixelRegion): | ||
|
||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self._profile_viewer = None | ||
self._previous_bounds = None | ||
self._mark = None | ||
self._data = None | ||
|
||
def _reset_profile_viewer_bounds(self): | ||
pv_state = self._profile_viewer.state | ||
pv_state.x_min = self._previous_bounds[0] | ||
pv_state.x_max = self._previous_bounds[1] | ||
pv_state.y_min = self._previous_bounds[2] | ||
pv_state.y_max = self._previous_bounds[3] | ||
|
||
def activate(self): | ||
self.viewer.add_event_callback(self.on_mouse_move, events=['mousemove', 'mouseleave']) | ||
if self._profile_viewer is None: | ||
# Get first profile viewer | ||
for _, viewer in self.viewer.jdaviz_helper.app._viewer_store.items(): | ||
if isinstance(viewer, BqplotProfileView): | ||
self._profile_viewer = viewer | ||
break | ||
if self._mark is None: | ||
self._mark = PluginLine(self._profile_viewer, visible=False) | ||
self._profile_viewer.figure.marks = self._profile_viewer.figure.marks + [self._mark, ] | ||
# Store these so we can revert to previous user-set zoom after preview view | ||
pv_state = self._profile_viewer.state | ||
self._previous_bounds = [pv_state.x_min, pv_state.x_max, pv_state.y_min, pv_state.y_max] | ||
super().activate() | ||
|
||
def deactivate(self): | ||
self.viewer.remove_event_callback(self.on_mouse_move) | ||
self._reset_profile_viewer_bounds() | ||
super().deactivate() | ||
|
||
def on_mouse_move(self, data): | ||
raise NotImplementedError("must be implemented by sublcasses") |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .viewers import * # noqa | ||
from .parsers import * # noqa | ||
from .ramp_extraction import * # noqa | ||
from .tools import * # noqa |
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
Oops, something went wrong.