Skip to content

Commit

Permalink
Footprints plugin (#2341)
Browse files Browse the repository at this point in the history
* initial footprints plugin with preset jwst footprints generalized for original code from https://github.com/spacetelescope/jwst_novt
* move (and fix some small bugs with) EditableSelectPluginComponent from lcviz
* pysiaf as optional dependency (plugin disabled otherwise)
* viewer access to center_skycoord
* test coverage and API docs
* generalize API names for future expansion to importing regions objects
* exclude viewers without wcs in reference data
* support manually recentering footprint
* disable plotting footprint when pixel-linked

---------

Co-authored-by: melanieclarke <[email protected]>
Co-authored-by: Brett M. Morris <[email protected]>
  • Loading branch information
3 people authored Aug 14, 2023
1 parent 45b0127 commit 0c97b76
Show file tree
Hide file tree
Showing 21 changed files with 1,218 additions and 20 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Imviz

- The stretch histogram within plot options can now be popped-out into its own window. [#2314]

- Footprints plugin for plotting overlays of instrument footprints in the image viewer. [#2341]

Mosviz
^^^^^^

Expand Down
18 changes: 18 additions & 0 deletions docs/imviz/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,24 @@ are not stored. To save the current result before submitting a new query, you ca
The table returned from the API above may cover more sources than shown in the currently zoomed-in
portion of the image. Additional steps will be needed to filter out these points, if necessary.


.. _imviz-footprints:

Footprints
==========

This plugin supports loading and overplotting instrument footprint overlays on the image viewers.
Any number of overlays can be plotted simultaneously from any number of the available
preset instruments.

The top dropdown allows renaming, adding, and removing footprint overlays. To modify the display
and input parameters for a given overlay, select it in the dropdown, and modify the choices
in the plugin to change its color, opacity, visibilities in any image viewer in the app, or to
select between various preset instruments and change the input options (position on the sky,
position angle, offsets, etc).



.. _rotate-canvas:

Canvas Rotation
Expand Down
1 change: 1 addition & 0 deletions jdaviz/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def to_unit(self, data, cid, values, original_units, target_units):
'plugin-subset-select': 'components/plugin_subset_select.vue',
'plugin-viewer-select': 'components/plugin_viewer_select.vue',
'plugin-layer-select': 'components/plugin_layer_select.vue',
'plugin-editable-select': 'components/plugin_editable_select.vue',
'plugin-add-results': 'components/plugin_add_results.vue',
'plugin-auto-label': 'components/plugin_auto_label.vue',
'glue-state-sync-wrapper': 'components/glue_state_sync_wrapper.vue'}
Expand Down
93 changes: 93 additions & 0 deletions jdaviz/components/plugin_editable_select.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<template>
<div>
<v-row>
<v-select
v-if="mode=='select'"
attach
:menu-props="{ left: true }"
:items="items"
v-model="selected"
@change="$emit('update:selected', $event)"
:label="label"
:hint="hint"
:rules="rules ? rules : []"
item-text="label"
item-value="label"
persistent-hint
>
<template v-slot:append>
<v-icon style="cursor: pointer">mdi-menu-down</v-icon>
<j-tooltip tooltipcontent="rename">
<v-icon style="cursor: pointer" @click="modeRename">mdi-pencil</v-icon>
</j-tooltip>
<j-tooltip tooltipcontent="remove">
<v-icon style="cursor: pointer" @click="modeRemove">mdi-delete</v-icon>
</j-tooltip>
<j-tooltip tooltipcontent="create new">
<v-icon style="cursor: pointer" @click="modeAdd">mdi-plus</v-icon>
</j-tooltip>
</template>
</v-select>
<v-alert
v-else-if="mode=='remove'"
type="warning"
style="width: 100%"
>
<span>remove '{{selected}}' {{label.toLowerCase()}}?</span>
<template v-slot:append>
<j-tooltip tooltipcontent="cancel">
<v-icon style="cursor: pointer" @click="changeCancel">mdi-close</v-icon>
</j-tooltip>
<j-tooltip :tooltipcontent="'Remove '+selected+' '+label.toLowerCase()">
<v-icon style="cursor: pointer" @click="changeAccept">mdi-delete</v-icon>
</j-tooltip>
</template>
</v-alert>
<v-text-field
v-else
v-model="edit_value"
@keyup="$emit('update:edit_value', $event.target.value)"
:label="label"
:hint="mode == 'rename' ? 'Rename '+label.toLowerCase() : 'Add '+label.toLowerCase()"
persistent-hint
>
<template v-slot:append>
<j-tooltip v-if="items.length > 0" tooltipcontent="Cancel change">
<v-icon style="cursor: pointer" @click="changeCancel">mdi-close</v-icon>
</j-tooltip>
<j-tooltip tooltipcontent="Accept change">
<v-icon style="cursor: pointer" @click="changeAccept">mdi-check</v-icon>
</j-tooltip>
</template>
</v-text-field>
</v-row>
</div>
</template>

<script>
module.exports = {
props: ['mode', 'edit_value', 'items', 'selected', 'label', 'hint', 'rules'],
methods: {
changeCancel() {
this.$emit('update:edit_value', this.selected);
this.$emit('update:mode', 'select');
},
changeAccept() {
this.$emit('update:mode', this.mode+':accept')
},
modeRename() {
this.$emit('update:mode', 'rename')
},
modeRemove() {
this.$emit('update:mode', 'remove')
},
modeAdd() {
this.$emit('update:edit_value', '')
this.$emit('update:mode', 'add')
}
}
};
</script>

<style scoped>
</style>
1 change: 1 addition & 0 deletions jdaviz/components/tooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const tooltips = {
'plugin-line-analysis-assign': 'Assign the centroid wavelength and update the redshift',
'plugin-moment-save-fits': 'Save moment map as FITS file',
'plugin-link-apply': 'Apply linking to data',
'plugin-footprints-color-picker': 'Change the color of the footprint overlay',
}
Expand Down
2 changes: 1 addition & 1 deletion jdaviz/components/tray_plugin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<span> {{ getDisabledMsg() }}</span>
</v-row>
<div v-else>
<v-row v-if="uses_active_status && keep_active !== undefined">
<v-row v-if="uses_active_status && keep_active !== undefined" style="padding-bottom: 24px">
<v-switch
v-model="keep_active"
@change="$emit('update:keep_active', $event)"
Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/default/plugins/line_lists/line_lists.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<v-menu>
<template v-slot:activator="{ on }">
<span class="linelist-color-menu"
:style="`background:${list_contents[item].color}`"
:style="`background:${list_contents[item].color}; cursor: pointer`"
@click.stop="on.click"
>&nbsp;</span>
</template>
Expand Down
8 changes: 4 additions & 4 deletions jdaviz/configs/default/plugins/plot_options/plot_options.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<v-menu>
<template v-slot:activator="{ on }">
<span class="color-menu"
:style="`background:${subset_color_value}`"
:style="`background:${subset_color_value}; cursor: pointer`"
@click.stop="on.click"
>&nbsp;</span>
</template>
Expand Down Expand Up @@ -127,7 +127,7 @@
<v-menu>
<template v-slot:activator="{ on }">
<span class="color-menu"
:style="`background:${line_color_value}`"
:style="`background:${line_color_value}; cursor: pointer`"
@click.stop="on.click"
>&nbsp;</span>
</template>
Expand Down Expand Up @@ -257,7 +257,7 @@
<v-menu>
<template v-slot:activator="{ on }">
<span class="color-menu"
:style="`background:${marker_color_value}`"
:style="`background:${marker_color_value}; cursor: pointer`"
@click.stop="on.click"
>&nbsp;</span>
</template>
Expand Down Expand Up @@ -416,7 +416,7 @@
<v-menu>
<template v-slot:activator="{ on }">
<span class="color-menu"
:style="`background:${image_color_value}`"
:style="`background:${image_color_value}; cursor: pointer`"
@click.stop="on.click"
>&nbsp;</span>
</template>
Expand Down
1 change: 1 addition & 0 deletions jdaviz/configs/imviz/imviz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ tray:
- imviz-line-profile-xy
- imviz-aper-phot-simple
- imviz-catalogs
- imviz-footprints
- imviz-rotate-canvas
- g-export-plot
viewer_area:
Expand Down
1 change: 1 addition & 0 deletions jdaviz/configs/imviz/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
from .line_profile_xy import * # noqa
from .catalogs import * # noqa
from .rotate_canvas import * # noqa
from .footprints import * # noqa
2 changes: 2 additions & 0 deletions jdaviz/configs/imviz/plugins/footprints/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .footprints import * # noqa
from . import preset_regions # noqa
Loading

0 comments on commit 0c97b76

Please sign in to comment.