Skip to content

Commit

Permalink
Enable multiselect in subset plugin for recentering (#2430)
Browse files Browse the repository at this point in the history
* Enable multiselect in subset plugin for recentering

* Fix bug with default text

* Remove unused import

* Fix bug in aperature photometry

* Address review comments

* Remove commented out code

* Add initial tests

* Fix bug when exiting multiselect and switching subsets

* Add documentation and update CHANGES file

* Remove print statement

* Add comment about recentering taking multiple iterations to docs

* fix chip styling in subset dropdown

* only set selected_has_subregions if exists

* only show multiselect toggle in imviz

* Apply suggestions from code review

Co-authored-by: P. L. Lim <[email protected]>

---------

Co-authored-by: Kyle Conroy <[email protected]>
Co-authored-by: P. L. Lim <[email protected]>
  • Loading branch information
3 people authored Sep 11, 2023
1 parent 96d974a commit 0060d9f
Show file tree
Hide file tree
Showing 9 changed files with 234 additions and 78 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Imviz

- The stretch histogram is now downsampled for large images for improved performance. [#2408]

- Add multiselect support to the subset plugin for recentering only. [#2430]

Mosviz
^^^^^^

Expand Down
19 changes: 11 additions & 8 deletions docs/imviz/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,19 @@ in the app-level toolbar. It might not show some static regions loaded
via the API unless an interactive region is drawn after.

If an existing subset is selected, the parameters of the subset will also be
shown. Note that while parameters for compound regions (e.g., a subset with
multiple disjoint regions) are displayed, the logical operations joining them
(``OR``, ``AND``, etc.) are not shown.

For a simple subset in Imviz only, you can choose to recenter it based
on the selected Data. The centroid is calculated by
:attr:`photutils.aperture.ApertureStats.centroid`, which is the
center-of-mass of the data within the aperture.
shown. Note that in addition to parameters for compound regions (e.g., a subset with
multiple disjoint regions) being displayed, the logical operations joining them
(``OR``, ``AND``, etc.) are shown as well for each region. This shows how all regions
are added together to create the subset shown in the viewer.

For a simple subset or group of subsets in Imviz only, you can choose to recenter based
on the selected Data. To switch to multiselect mode, click the icon in the top right of
the plugin and select multiple subsets from the drop-down menu.
The centroid is calculated by :attr:`photutils.aperture.ApertureStats.centroid`,
which is the center-of-mass of the data within the aperture.
No background subtraction is performed. Click :guilabel:`Recenter`
to change its parameters and move it to the calculated centroid.
This may take multiple iterations to converge.

.. note::

Expand Down
39 changes: 34 additions & 5 deletions jdaviz/components/plugin_subset_select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,49 @@
:label="label ? label : 'Subset'"
:hint="hint ? hint : 'Select subset.'"
:rules="rules ? rules : []"
:multiple="multiselect"
:chips="multiselect"
item-text="label"
item-value="label"
persistent-hint
>
<template slot="selection" slot-scope="data">
<div class="single-line">
<v-icon v-if="data.item.color" left :color="data.item.color">
{{ data.item.type=='spectral' ? 'mdi-chart-bell-curve' : 'mdi-chart-scatter-plot' }}
</v-icon>
<span>
<v-chip v-if="multiselect" style="width: calc(100% - 20px)">
<span>
<v-icon v-if="data.item.color" left :color="data.item.color">
{{ data.item.type=='spectral' ? 'mdi-chart-bell-curve' : 'mdi-chart-scatter-plot' }}
</v-icon>
{{ data.item.label }}
</span>
</v-chip>
<span v-else>
<v-icon v-if="data.item.color" left :color="data.item.color">
{{ data.item.type=='spectral' ? 'mdi-chart-bell-curve' : 'mdi-chart-scatter-plot' }}
</v-icon>
{{ data.item.label }}
</span>
</div>
</template>
<template v-slot:prepend-item v-if="multiselect">
<v-list-item
ripple
@mousedown.prevent
@click="() => {if (selected.length < items.length) { $emit('update:selected', items.map((item) => item.label))} else {$emit('update:selected', [])}}"
>
<v-list-item-action>
<v-icon>
{{ selected.length == items.length ? 'mdi-close-box' : selected.length ? 'mdi-minus-box' : 'mdi-checkbox-blank-outline' }}
</v-icon>
</v-list-item-action>
<v-list-item-content>
<v-list-item-title>
{{ selected.length < items.length ? "Select All" : "Clear All" }}
</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="mt-2"></v-divider>
</template>
<template slot="item" slot-scope="data">
<div class="single-line">
<v-icon v-if="data.item.color" left :color="data.item.color">
Expand All @@ -46,7 +75,7 @@

<script>
module.exports = {
props: ['items', 'selected', 'label', 'has_subregions', 'has_subregions_warning', 'hint', 'rules', 'show_if_single_entry']
props: ['items', 'selected', 'label', 'has_subregions', 'has_subregions_warning', 'hint', 'rules', 'show_if_single_entry', 'multiselect']
};
</script>

Expand Down
Loading

0 comments on commit 0060d9f

Please sign in to comment.