Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

markers plugin #1953

Merged
merged 40 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4b25e16
basic markers plugin implementation
kecnry Feb 11, 2023
985d83b
log info from coords_info mouseover display
kecnry Feb 11, 2023
f114b6e
allow user to select layer used in mouseover/markers
kecnry Feb 14, 2023
dd44098
fix support for creating new viewers in Imviz
kecnry Feb 22, 2023
7ed2239
improved support for mixed viewers
kecnry Feb 23, 2023
77521d5
log wcs unreliability
kecnry Feb 24, 2023
0d573f7
rename table column pixel->index
kecnry Feb 24, 2023
f8b50bd
log viewer reference instead of id
kecnry Feb 24, 2023
fa0d748
revert disabling spectrum locking during zoom/subset tool
kecnry Feb 24, 2023
43423b4
use DatasetMixin instead of LayerMixin
kecnry Feb 24, 2023
21307ce
changelog entry
kecnry Feb 24, 2023
7b94215
clear table info to force defaults on keypress
kecnry Feb 24, 2023
5d819d2
update mouseover test to show cursor info when out of bounds
kecnry Feb 24, 2023
5aa6cba
fix css layout for layer/viewer icon in dropdowns
kecnry Feb 24, 2023
7628ab7
fix viewer reference when None (imviz additional viewers)
kecnry Feb 24, 2023
2a50ebf
fix accessing image value of non-active layer
kecnry Feb 24, 2023
9c7ab45
update Markers plugin docs
kecnry Feb 24, 2023
1be5e0a
expose slice wavelength
kecnry Feb 27, 2023
ede27c5
test coverage
kecnry Mar 1, 2023
ca55478
plugin API docs
kecnry Mar 1, 2023
5fd865a
Apply suggestions from code review
kecnry Mar 6, 2023
79c81f9
fix specviz2d marker in spectrum then spectrum2d
kecnry Mar 6, 2023
7c60ef0
update tests to work with full sky coord precision
kecnry Mar 6, 2023
2a3a894
fallback on exposing cursor information when no valid layer match
kecnry Mar 6, 2023
4d1f3ab
allow selecting the auto-collapsed spectrum in the coords info cycler
kecnry Mar 6, 2023
8052e15
table subcomponent: always show columns in same order
kecnry Mar 7, 2023
8c7bc17
store pixel and axes coordinates separately
kecnry Mar 7, 2023
4fb37db
limit precision shown in UI version of the table
kecnry Mar 7, 2023
19a0667
add helper text for cycling layers
kecnry Mar 7, 2023
1ae221e
improve dictionary comparison in markers test
kecnry Mar 8, 2023
c4fb1a9
only expose pixel/world:unreliable in cubeviz
kecnry Mar 8, 2023
46f3590
fix exposing value for 2d spectrum viewer in specviz2d
kecnry Mar 8, 2023
48b54de
fix mouseover before data loaded in viewer in mosviz
kecnry Mar 8, 2023
6a50534
add value:unreliable and explanation text in docs
kecnry Mar 8, 2023
3aa2ff4
only include spatial subsets in cycler for cubeviz
kecnry Mar 14, 2023
b60bd61
imviz mouseover cycler to only consider image layers
kecnry Mar 14, 2023
f9b46cf
fallback for object-cache
kecnry Mar 14, 2023
1443057
docs updates
kecnry Mar 14, 2023
349f66f
exclude slice for 2d images in cubeviz
kecnry Mar 16, 2023
cf4eb4f
Apply suggestions from code review
kecnry Mar 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ New Features
- Configurations that support multiple, simultaneous data files now allow
multiple data products to be specified in the command line. [#1890]

- Ability to cycle through datasets to expose information during mouseover. [#1953]
pllim marked this conversation as resolved.
Show resolved Hide resolved

- New markers plugin to log mouseover information to a table. [#1953]

Cubeviz
^^^^^^^

Expand Down
7 changes: 7 additions & 0 deletions docs/cubeviz/export_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,10 @@ the ``x`` and ``y`` parameters identify specifically which spaxel fits are to be
for models applied to every spaxel using the :guilabel:`Apply to Cube` button.
Leaving ``x`` or ``y`` as ``None`` will mean that the models fit to every spaxel
across that axis will be returned.

Markers Table
=============

All mouseover information in the :ref:`markers plugin <markers-plugin>` can be exported to an
:ref:`astropy table <astropy:astropy-table>`
by calling :meth:`~jdaviz.core.template_mixin.TableMixin.export_table` (see :ref:`plugin-apis`).
9 changes: 9 additions & 0 deletions docs/cubeviz/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ Subset Tools
:ref:`Subset Tools <imviz-subset-plugin>`
Imviz documentation describing the concept of subsets in Jdaviz.


Markers
=======

.. seealso::

:ref:`Markers <markers-plugin>`
Imviz documentation describing the markers plugin.

.. _slice:

Slice
Expand Down
4 changes: 4 additions & 0 deletions docs/imviz/displayimages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ cursor's location in pixel space (X and Y), the RA and Dec at that point, and th
of the data there. This information is displayed in the top bar of the UI, on the
middle-right side.

By default, the cursor information will correspond to the top image layer in the viewer.
To change to a specific data-layer, click the layer-icon in the top bar to cycle between
"auto", "cursor", or specific data layers.

Notes on GWCS
-------------

Expand Down
12 changes: 12 additions & 0 deletions docs/imviz/export_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,15 @@ The columns are as follow:

Once you have the results in a table, you can further manipulated them as
documented in :ref:`astropy:astropy-table`.

Markers Table
=============

All mouseover information in the :ref:`markers plugin <markers-plugin>` can be exported to an
:ref:`astropy table <astropy:astropy-table>`
by calling :meth:`~jdaviz.core.template_mixin.TableMixin.export_table` (see :ref:`plugin-apis`):

.. code-block:: python

markers_plugin = imviz.plugins["Markers"]
markers_table = markers_plugin.export_table()
22 changes: 22 additions & 0 deletions docs/imviz/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,28 @@ parameters, shape, and orientation (if applicable) all update concurrently.

Angle is counter-clockwise rotation around the center in degrees.

.. _markers-plugin:

Markers
=======

This plugin allows for interactively creating markers in any viewer and logging information about
the location of that marker along with the applicable data and viewer labels into a table.

With the plugin open in the tray, mouse over any viewer and press the "m" key to log the information
displayed in the app toolbar into the table. The markers remain at that fixed pixel-position in
the viewer they were created (regardless of changes to the underlying data or linking) and are only
visible when the plugin is opened.
pllim marked this conversation as resolved.
Show resolved Hide resolved

In Imviz, the table also exposed columns labeled "pixel:unreliable", "world:unreliable", and
"value:unreliable". These will be logged as ``True`` in cases where the information is outside
the bounds of the reference image's WCS (noted in the mouseover display by the information showing
as grayed).

To export the table into the notebook via the API, call
pllim marked this conversation as resolved.
Show resolved Hide resolved
:meth:`~jdaviz.core.template_mixin.TableMixin.export_table`
(see :ref:`plugin-apis`).

.. _imviz-link-control:

Link Control
Expand Down
10 changes: 10 additions & 0 deletions docs/mosviz/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ Subset Tools
:ref:`Subset Tools <imviz-subset-plugin>`
Imviz documentation describing the concept of subsets in Jdaviz.

.. _imviz_export_markers:

Markers
kecnry marked this conversation as resolved.
Show resolved Hide resolved
=======

.. seealso::

:ref:`Markers <markers-plugin>`
Imviz documentation describing the markers plugin.

Gaussian Smooth
===============

Expand Down
3 changes: 3 additions & 0 deletions docs/reference/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ Plugins
.. automodapi:: jdaviz.configs.default.plugins.line_lists.line_lists
:no-inheritance-diagram:

.. automodapi:: jdaviz.configs.default.plugins.markers.markers
:no-inheritance-diagram:

.. automodapi:: jdaviz.configs.default.plugins.metadata_viewer.metadata_viewer
:no-inheritance-diagram:

Expand Down
4 changes: 4 additions & 0 deletions docs/specviz/displaying.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ cursor position as well as the spectral axis value, pixel, and flux of the close
to the cursor.
This information is displayed in the top bar of the UI, on the middle-right side.

By default, the cursor information will correspond to the closest data layer to the cursor.
To change to a specific data-layer, click the layer-icon in the top bar to cycle between
"auto", "cursor", or specific data layers.

Home
====

Expand Down
8 changes: 8 additions & 0 deletions docs/specviz/export_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,11 @@ To extract all of the model parameters:
myparams

where the ``model_label`` parameter identifies which model should be returned.
.. _specviz-export-markers:

Markers Table
kecnry marked this conversation as resolved.
Show resolved Hide resolved
=============

All mouseover information in the :ref:`markers plugin <markers-plugin>` can be exported to an
:ref:`astropy table <astropy:astropy-table>`
by calling :meth:`~jdaviz.core.template_mixin.TableMixin.export_table` (see :ref:`plugin-apis`).
8 changes: 8 additions & 0 deletions docs/specviz/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ Subset Tools
:ref:`Subset Tools <imviz-subset-plugin>`
Imviz documentation describing the concept of subsets in Jdaviz.

Markers
=======

.. seealso::

:ref:`Markers <markers-plugin>`
Imviz documentation describing the markers plugin.

.. _gaussian-smooth:

Gaussian Smooth
Expand Down
8 changes: 8 additions & 0 deletions docs/specviz2d/export_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,11 @@ An instance of Specviz can also be accessed, which exposes some helper methods f

:ref:`Specviz: Export Data <specviz-export-data>`
Specviz documentation on exporting spectra.


Markers Table
=============

All mouseover information in the :ref:`markers plugin <markers-plugin>` can be exported to an
:ref:`astropy table <astropy:astropy-table>`
by calling :meth:`~jdaviz.core.template_mixin.TableMixin.export_table` (see :ref:`plugin-apis`).
8 changes: 8 additions & 0 deletions docs/specviz2d/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ Subset Tools

:ref:`Subset Tools <imviz-subset-plugin>`
Imviz documentation describing the concept of subsets in Jdaviz.

Markers
=======

.. seealso::

:ref:`Markers <markers-plugin>`
Imviz documentation describing the markers plugin.

.. _specviz2d-spectral-extraction:

Expand Down
11 changes: 8 additions & 3 deletions jdaviz/components/layer_viewer_icon.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<template>
<span v-if="icon !== undefined" :class="prevent_invert_if_dark ? '' : 'invert-if-dark'" :style="span_style+'; color: '+color+'; '+borderStyle">
{{String(icon).toUpperCase()}}
<span v-if="icon !== undefined">
<v-icon v-if="String(icon).startsWith('mdi-')" size="16">
{{icon}}
</v-icon>
<span v-else :class="prevent_invert_if_dark ? 'layer-viewer-icon' : 'invert-if-dark layer-viewer-icon'" :style="span_style+'; color: '+color+'; '+borderStyle">
{{String(icon).toUpperCase()}}
</span>
Comment on lines -2 to +8
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is needed to allow the cursor icon in the app bar (instead of just layer letters)

</span>
</template>

Expand All @@ -19,7 +24,7 @@ module.exports = {
</script>

<style scoped>
span {
.layer-viewer-icon {
width: 20px;
height: 20px;
line-height: 10px;
Expand Down
13 changes: 12 additions & 1 deletion jdaviz/components/plugin_table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<v-row style="margin: 0px 0px 8px 0px !important">
<v-data-table
dense
:headers="headers_visible.map(item => {return {'text': item, 'value': item}})"
:headers="headers_visible_sorted.map(item => {return {'text': item, 'value': item}})"
:items="items"
class="elevation-1 width-100"
></v-data-table>
Expand All @@ -64,6 +64,17 @@
</div>
</template>

<script>
module.exports = {
computed: {
headers_visible_sorted() {
return this.headers_avail.filter(item => this.headers_visible.indexOf(item) !== -1);
},
}
};
</script>


<style scoped>
.v-data-table {
width: 100% !important
Expand Down
1 change: 1 addition & 0 deletions jdaviz/components/tooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const tooltips = {
'Use the same display parameters for all images and spectra',
'create-image-viewer':
'Create new image viewer',
'coords-info-cycle': 'Cycle selected layer used for mouseover information and markers plugin',

// viewer toolbars
'viewer-toolbar-data': 'Select dataset(s) to display in this viewer',
Expand Down
1 change: 1 addition & 0 deletions jdaviz/configs/cubeviz/cubeviz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ tray:
- g-metadata-viewer
- g-plot-options
- g-subset-plugin
- g-markers
- cubeviz-slice
- g-gaussian-smooth
- g-collapse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self, *args, **kwargs):

self.moment = None

self.dataset.add_filter('is_image')
self.dataset.add_filter('is_cube')
self.add_results.viewer.filters = ['is_image_viewer']

@property
Expand Down
1 change: 1 addition & 0 deletions jdaviz/configs/default/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
from .metadata_viewer.metadata_viewer import * # noqa
from .export_plot.export_plot import * # noqa
from .plot_options.plot_options import * # noqa
from .markers.markers import * # noqa
2 changes: 1 addition & 1 deletion jdaviz/configs/default/plugins/collapse/collapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self, *args, **kwargs):
selected='function_selected',
manual_options=['Mean', 'Median', 'Min', 'Max', 'Sum']) # noqa

self.dataset.add_filter('is_image')
self.dataset.add_filter('is_cube')
self.add_results.viewer.filters = ['is_image_viewer']

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def test_linking_after_spectral_smooth(cubeviz_helper, spectrum1d_cube):

label_mouseover._viewer_mouse_event(spec_viewer,
{'event': 'mousemove', 'domain': {'x': 4.6236e-7, 'y': 60}})
assert label_mouseover.as_text() == ('', '', '')
assert label_mouseover.icon == ''
assert label_mouseover.as_text() == ('Cursor 4.62360e-07, 6.00000e+01', '', '')
assert label_mouseover.icon == 'mdi-cursor-default'
Comment on lines -96 to +97
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of showing nothing, we can just show cursor position (and with the cursor icon instead of no icon)



def test_spatial_convolution(cubeviz_helper, spectrum1d_cube):
Expand Down Expand Up @@ -153,11 +153,11 @@ def test_spectrum1d_smooth(specviz_helper, spectrum1d):
'Flux 5.34688e+00 Jy')
assert label_mouseover.icon == 'b'

# Out-of-bounds shows nothing.
# Out-of-bounds shows only cursor info.
label_mouseover._viewer_mouse_event(spec_viewer,
{'event': 'mousemove', 'domain': {'x': 5500, 'y': 120}})
assert label_mouseover.as_text() == ('', '', '')
assert label_mouseover.icon == ''
assert label_mouseover.as_text() == ('Cursor 5.50000e+03, 1.20000e+02', '', '')
assert label_mouseover.icon == 'mdi-cursor-default'


def test_spectrum2d_smooth(specviz2d_helper, spectrum2d):
Expand Down
1 change: 1 addition & 0 deletions jdaviz/configs/default/plugins/markers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .markers import * # noqa
Loading