Skip to content
New issue

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

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

Already on GitHub? # to your account

Enable multiselect in subset plugin for recentering #2430

Merged
merged 15 commits into from
Sep 11, 2023

Conversation

javerbukh
Copy link
Contributor

@javerbukh javerbukh commented Sep 7, 2023

Description

This pull request adds multiselect support to the subset plugin for the purposes of recentering in Imviz.

Demo:

subset_plugin_multiselect_demo_2_09082023.mp4

Change log entry

  • Is a change log needed? If yes, is it added to CHANGES.rst? If you want to avoid merge conflicts,
    list the proposed change log here for review and add to CHANGES.rst before merge. If no, maintainer
    should add a no-changelog-entry-needed label.
  • Adds multiselect support to the subset plugin for recentering.

Checklist for package maintainer(s)

This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.

  • Are two approvals required? Branch protection rule does not check for the second approval. If a second approval is not necessary, please apply the trivial label.
  • Do the proposed changes actually accomplish desired goals? Also manually run the affected example notebooks, if necessary.
  • Do the proposed changes follow the STScI Style Guides?
  • Are tests added/updated as required? If so, do they follow the STScI Style Guides?
  • Are docs added/updated as required? If so, do they follow the STScI Style Guides?
  • Did the CI pass? If not, are the failures related?
  • Is a milestone set? Set this to bugfix milestone if this is a bug fix and needs to be released ASAP; otherwise, set this to the next major release milestone.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

@javerbukh javerbukh added plugin Label for plugins common to multiple configurations and removed specviz testing imviz labels Sep 7, 2023
@javerbukh javerbukh force-pushed the subset-plugin-multiselect branch from 7b7f55b to 87addc7 Compare September 7, 2023 14:24
@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Patch coverage is 90.21% of modified lines.

❗ Current head 1d95e26 differs from pull request most recent head 91826e3. Consider uploading reports for the commit 91826e3 to get more accurate results

Files Changed Coverage
jdaviz/core/template_mixin.py 82.35%
...igs/default/plugins/subset_plugin/subset_plugin.py 91.66%
jdaviz/configs/imviz/tests/test_subset_centroid.py 100.00%
.../plugins/line_analysis/tests/test_line_analysis.py 100.00%

📢 Thoughts on this report? Let us know!.

@@ -94,7 +101,7 @@ def _sync_selected_from_state(self, *args):

def _on_subset_update(self, *args):
self._sync_selected_from_state(*args)
if self.subset_selected == 'Create New':
if 'Create New' in self.subset_selected:
Copy link
Member

Choose a reason for hiding this comment

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

this could give us problems if we ever support subset renaming 🐱. (I don't think there's anything needed to be done here for now, just something to keep in mind for later)

@pllim pllim added this to the 3.7 milestone Sep 7, 2023
@pllim pllim added the imviz label Sep 7, 2023
@pllim
Copy link
Contributor

pllim commented Sep 7, 2023

This alternate PR is definitely much cleaner. Thanks for your patience!

@pllim
Copy link
Contributor

pllim commented Sep 7, 2023

p.s. I cannot find a PR for your other approach. Am I going crazy?

@javerbukh
Copy link
Contributor Author

@pllim I appreciate all the feedback to get to here! I did not make a PR for that implementation, you are still sane!

@pllim
Copy link
Contributor

pllim commented Sep 8, 2023

I'll test this when it is out of draft.

@javerbukh javerbukh marked this pull request as ready for review September 8, 2023 18:22
@javerbukh
Copy link
Contributor Author

@pllim Had to fix a bug that I noticed when exiting multiselect and switching subsets. Should be ready for a review now! I'll work on updating the documentation in the meantime.

for _ in range(5):
subset_plugin.vue_recenter_subset()

assert_allclose(subset_plugin.get_center("Subset 2"), (145.593022, 172.515541))
Copy link
Contributor

Choose a reason for hiding this comment

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

Should also check for new center of Subset 1.

Copy link
Contributor

@pllim pllim left a comment

Choose a reason for hiding this comment

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

Some minor comments above. Seems to work well for Imviz.

However, I see the multiselect option available in Cubeviz, which does not make sense, because there is no recentering in Cubeviz.

@@ -1517,12 +1523,24 @@ def selected_obj(self):

@property
def selected_subset_state(self):
if self.is_multiselect:
subset_states = {}
Copy link
Member

Choose a reason for hiding this comment

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

I don't think other instances of multiselect return dictionaries... but since this is not terribly public-facing, this is probably ok for now and we can consider later whether to make everything dictionaries or lists.

Copy link
Member

@kecnry kecnry left a comment

Choose a reason for hiding this comment

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

Will it be confusing for users that the subset information disappears in multiselect mode? Should we add an in-plugin message explaining why? How about that the centering section is still enabled when no subsets are selected? Maybe we need to wait to get user feedback and can consider these edge-cases as possible future improvements.

There are also some behaviors with the multiselect that we might need to tweak and iterate as we begin to adopt it into other plugins as well, but that can definitely be deferred until we begin that work. Overall it seems to work quite well for this use case 🤞

@pllim
Copy link
Contributor

pllim commented Sep 11, 2023

My comments on it existing in Cubeviz and additional test assert were not addressed, so I will withhold approval for now.

Copy link
Contributor

@pllim pllim left a comment

Choose a reason for hiding this comment

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

Thanks, all!

@pllim pllim merged commit 0060d9f into spacetelescope:main Sep 11, 2023
javerbukh added a commit to javerbukh/jdaviz that referenced this pull request Sep 15, 2023
)

* 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 <2090236+pllim@users.noreply.github.com>

---------

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>
Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>
javerbukh pushed a commit to javerbukh/jdaviz that referenced this pull request Sep 15, 2023
fix event handling for choosing config from launcher

filepath fallback when object from config-detection fails to load

fix: support for notebook 7 (spacetelescope#2420)

Notebook 7 requires a different way to detect if the app runs in
a notebook context.

Fix explanation in markdown cell.

DOC: Footprints plugin API docs (spacetelescope#2426)

* build footprints API docs

* add code snippet in plugin docs

* fix syntax in API docs

---------

Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>

prevent overwriting user-API methods (spacetelescope#2425)

fix default color for overlay when traitlet set by user

* for the FIRST overlay, the user could have set the color traitlet before the internal overlay object is created (which occurs as soon as the plugin is first shown).  In that case, we want to respect the user choice of color.

similar fixes for any other traitlet when plugin inactive

regression test

change log entry

fix API import of single region and overwriting existing entry

* along with regression testing

TST: Also pull in scikit-image dev
to get rid of incompatibility with numpy

Use new "true circle" tool from glue-jupyter (spacetelescope#2332)

* Use truecircle tool
from glue-viz/glue-jupyter#376

* MNT: Bump glue-jupyter minversion
that can use this new tool

* Add change log

* Fix line too long

* Fix change log verbiage

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

---------

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

Enable multiselect in subset plugin for recentering (spacetelescope#2430)

* 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 <2090236+pllim@users.noreply.github.com>

---------

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>
Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>

Debug standalone build (spacetelescope#2441)

* Log jdaviz output for debugging

* Run workflow on debugging branch

* See if collecting data from jupyter-client will fix this, otherwise might need to downgrade

* Remove debugging stuff

MNT: Bump actions/checkout to v4

Enable workflow_dispatch for standalone

because it cannot be enabled outside of main apparently

[ci skip] [rtd skip]

EXP: Update workflow versions

Fix Mosviz slit overlay (spacetelescope#2434)

* Fix Mosviz slit overlay
by using polygon instead of forcing a rectangle without angle info.

Co-authored-by: Camilla Pacifici <camilla.pacifici@gmail.com>

* Off by one error in predicted PR num

---------

Co-authored-by: Camilla Pacifici <camilla.pacifici@gmail.com>

API access (hidden) to disable cubeviz movie UI (spacetelescope#2440)

* (hidden) API access to disable cubeviz movie UI
* default movie_enabled based on new app-setting server_is_remote
* test coverage

TST: Ignore ASDF warning about gwcs-1.0.0 schema
because gwcs dev and/or asdf-wcs-schemas 0.2.0 triggers the warning because the schema is no longer supported.
javerbukh pushed a commit to javerbukh/jdaviz that referenced this pull request Sep 18, 2023
fix event handling for choosing config from launcher

filepath fallback when object from config-detection fails to load

fix: support for notebook 7 (spacetelescope#2420)

Notebook 7 requires a different way to detect if the app runs in
a notebook context.

Fix explanation in markdown cell.

DOC: Footprints plugin API docs (spacetelescope#2426)

* build footprints API docs

* add code snippet in plugin docs

* fix syntax in API docs

---------

Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>

prevent overwriting user-API methods (spacetelescope#2425)

fix default color for overlay when traitlet set by user

* for the FIRST overlay, the user could have set the color traitlet before the internal overlay object is created (which occurs as soon as the plugin is first shown).  In that case, we want to respect the user choice of color.

similar fixes for any other traitlet when plugin inactive

regression test

change log entry

fix API import of single region and overwriting existing entry

* along with regression testing

TST: Also pull in scikit-image dev
to get rid of incompatibility with numpy

Use new "true circle" tool from glue-jupyter (spacetelescope#2332)

* Use truecircle tool
from glue-viz/glue-jupyter#376

* MNT: Bump glue-jupyter minversion
that can use this new tool

* Add change log

* Fix line too long

* Fix change log verbiage

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

---------

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

Enable multiselect in subset plugin for recentering (spacetelescope#2430)

* 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 <2090236+pllim@users.noreply.github.com>

---------

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>
Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>

Debug standalone build (spacetelescope#2441)

* Log jdaviz output for debugging

* Run workflow on debugging branch

* See if collecting data from jupyter-client will fix this, otherwise might need to downgrade

* Remove debugging stuff

MNT: Bump actions/checkout to v4

Enable workflow_dispatch for standalone

because it cannot be enabled outside of main apparently

[ci skip] [rtd skip]

EXP: Update workflow versions

Fix Mosviz slit overlay (spacetelescope#2434)

* Fix Mosviz slit overlay
by using polygon instead of forcing a rectangle without angle info.

Co-authored-by: Camilla Pacifici <camilla.pacifici@gmail.com>

* Off by one error in predicted PR num

---------

Co-authored-by: Camilla Pacifici <camilla.pacifici@gmail.com>

API access (hidden) to disable cubeviz movie UI (spacetelescope#2440)

* (hidden) API access to disable cubeviz movie UI
* default movie_enabled based on new app-setting server_is_remote
* test coverage

TST: Ignore ASDF warning about gwcs-1.0.0 schema
because gwcs dev and/or asdf-wcs-schemas 0.2.0 triggers the warning because the schema is no longer supported.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
imviz plugin Label for plugins common to multiple configurations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants