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

Mixin for plugin_opened and use for compass #1153

Merged
merged 2 commits into from
Mar 10, 2022

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Mar 8, 2022

Description

This pull request moves the logic in LineAnalysis to act differently if the plugin is opened or closed into the PluginTemplateMixin to be available to all plugins, and then used in the compass plugin to only re-draw the compass when the plugin is opened.

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 change log needed? If yes, is it added to CHANGES.rst?
  • Is a milestone set? Milestone is only currently required for PRs related to Imviz MVP.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

@kecnry kecnry added this to the 2.4 milestone Mar 8, 2022
@codecov
Copy link

codecov bot commented Mar 8, 2022

Codecov Report

Merging #1153 (e83238b) into main (b1f1748) will decrease coverage by 0.75%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1153      +/-   ##
==========================================
- Coverage   76.86%   76.10%   -0.76%     
==========================================
  Files          87       87              
  Lines        6661     6667       +6     
==========================================
- Hits         5120     5074      -46     
- Misses       1541     1593      +52     
Impacted Files Coverage Δ
jdaviz/configs/imviz/plugins/compass/compass.py 85.00% <100.00%> (-12.50%) ⬇️
...igs/specviz/plugins/line_analysis/line_analysis.py 84.76% <100.00%> (-0.49%) ⬇️
jdaviz/core/registries.py 79.68% <100.00%> (+0.65%) ⬆️
jdaviz/core/template_mixin.py 100.00% <100.00%> (ø)
jdaviz/configs/imviz/wcs_utils.py 66.66% <0.00%> (-26.67%) ⬇️
jdaviz/configs/imviz/plugins/viewers.py 74.12% <0.00%> (-9.10%) ⬇️
...configs/default/plugins/data_tools/file_chooser.py 65.71% <0.00%> (-3.43%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1f1748...e83238b. Read the comment docs.

@pllim
Copy link
Contributor

pllim commented Mar 8, 2022

A quick test with Compass (without #1152) seems very promising!

If we want to focus on Compass, Imviz viewer also manually redraw at two other places but we can leave those alone unless performance becomes a problem again:

self.set_compass(self.state.layers[next_layer].layer)

self.set_compass(self.state.layers[i].layer)

@kecnry kecnry added the no-changelog-entry-needed changelog bot directive label Mar 9, 2022
@kecnry kecnry marked this pull request as ready for review March 9, 2022 13:32
@kecnry
Copy link
Member Author

kecnry commented Mar 9, 2022

If we want to focus on Compass, Imviz viewer also manually redraw at two other places

I think in both of these cases, set_compass will see self.compass is None and exit immediately. Once opened, the plugin will set viewer.compass = self for the appropriate viewer and the compass should then update as expected. But I didn't check thoroughly that it is never called when it shouldn't be.

@pllim
Copy link
Contributor

pllim commented Mar 10, 2022

Please rebase to pick up new matrix, thanks!

@pllim pllim added the performance Performance related label Mar 10, 2022
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.

I don't see any reason not to do this.

@kecnry kecnry force-pushed the compass-only-when-open branch from 9455528 to e83238b Compare March 10, 2022 16:15
Copy link
Contributor

@javerbukh javerbukh left a comment

Choose a reason for hiding this comment

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

I can confirm the code is code. Nice work! 😄

@javerbukh javerbukh merged commit 9d90130 into spacetelescope:main Mar 10, 2022
@kecnry kecnry deleted the compass-only-when-open branch March 11, 2022 18:24
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants