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

Fix reference data for WCS to Pixels to WCS #2751

Merged
merged 5 commits into from
Mar 23, 2024

Conversation

pllim
Copy link
Contributor

@pllim pllim commented Mar 12, 2024

Description

I corrected the test first. Will push commit(s) out later when I can figure out how to fix it properly.

Fixes #2724

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.

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. Bugfix milestone also needs an accompanying backport label.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)? 🐱 👻

@pllim pllim added bug Something isn't working no-changelog-entry-needed changelog bot directive Affects-dev changelog bot directive labels Mar 12, 2024
@pllim pllim added this to the 3.9 milestone Mar 12, 2024
@github-actions github-actions bot added the imviz label Mar 12, 2024
@pllim
Copy link
Contributor Author

pllim commented Mar 15, 2024

Is this going in circles?

@observe('orientation_layer_selected')
def _change_reference_data(self, *args, **kwargs):
if self._refdata_change_available:
self.app._change_reference_data(

triggers

self.hub.broadcast(ChangeRefDataMessage(

that is being listened back in

self.hub.subscribe(self, ChangeRefDataMessage,
handler=self._on_refdata_change)

that calls this

self.orientation.selected = msg.data.label

that would trigger this again?

@observe('orientation_layer_selected')
def _change_reference_data(self, *args, **kwargs):
if self._refdata_change_available:
self.app._change_reference_data(

@pllim pllim force-pushed the wcs-pixels-wcs-ref branch from 2b9e9b5 to 22d6eb4 Compare March 16, 2024 01:54
Copy link

codecov bot commented Mar 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.72%. Comparing base (9edd445) to head (f1ba4a6).
Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2751      +/-   ##
==========================================
+ Coverage   88.70%   88.72%   +0.01%     
==========================================
  Files         108      110       +2     
  Lines       16305    16353      +48     
==========================================
+ Hits        14464    14509      +45     
- Misses       1841     1844       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pllim pllim marked this pull request as ready for review March 16, 2024 02:27
@rosteen
Copy link
Collaborator

rosteen commented Mar 18, 2024

Is this going in circles?

I think it could potentially get called one extra time, but the second time self.orientation.selected wouldn't actually change so it wouldn't trigger another loop.

@pllim
Copy link
Contributor Author

pllim commented Mar 18, 2024

Theoretically Orientation is the only plugin that is allowed to change the ref data, right? There is no reason for it to listen to its own message?

@rosteen
Copy link
Collaborator

rosteen commented Mar 18, 2024

You can also change the ref data through the viewer data menu, so the Orientation plugin needs to see those events to stay in synch.

@pllim
Copy link
Contributor Author

pllim commented Mar 18, 2024

Right... 😒 Thanks for the reminder!

@rosteen
Copy link
Collaborator

rosteen commented Mar 18, 2024

Drats, I thought there was a good chance that this also fixed the bug I was trying to fix on Friday, but it didn't. I did confirm that it fixes the intended use case though. I'll take a look at the actual code before approving.

@pllim
Copy link
Contributor Author

pllim commented Mar 18, 2024

the actual code

Sorry for the messy diff.

Copy link
Collaborator

@rosteen rosteen left a comment

Choose a reason for hiding this comment

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

Looks good to me, I tested a couple more edge cases. I left one comment about an error message but other than that the code looks fine.

jdaviz/configs/imviz/plugins/orientation/orientation.py Outdated Show resolved Hide resolved
@pllim
Copy link
Contributor Author

pllim commented Mar 18, 2024

Code suggestion accepted. Thanks!

Copy link
Collaborator

@rosteen rosteen left a comment

Choose a reason for hiding this comment

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

LGTM now.

Copy link
Contributor

@cshanahan1 cshanahan1 left a comment

Choose a reason for hiding this comment

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

I tested this out in ImvizDitheredExample and it works well for me.

There was one instance when I was messing around with it that when you did some combination of linking, adding and removing viewers, etc, that after that it because very laggy (particularly with subset creation, they were taking 5+ seconds to appear after drawing), but I can't seem to recreate that same scenario.

Would it be possible to add additional test coverage? A lot of the lines are not covered

@pllim
Copy link
Contributor Author

pllim commented Mar 22, 2024

OK looks like the lines are some safeguards that didn't get triggered by test suite. I can look into that as part of this PR but I should probably rebase first. 🤞

UPDATE: Never mind. The uncovered lines are basically impossible to reach via plugin safeguards but does not hurt to keep them. I just marked them as uncovered for now.

@pllim pllim force-pushed the wcs-pixels-wcs-ref branch from b60f9e5 to 2b77353 Compare March 22, 2024 16:36
@@ -130,6 +130,7 @@ def test_markers_cubeviz(cubeviz_helper, spectrum1d_cube):

# appears as option in export plugin and exports successfully
assert "Markers:table" in exp.table.choices
exp.filename = str(tmp_path / "cubeviz_export.ecsv")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

xref #2755

@pllim
Copy link
Contributor Author

pllim commented Mar 22, 2024

Change log failure is unrelated but something I need to fix anyway: scientific-python/action-check-changelogfile#13

pllim and others added 5 commits March 22, 2024 21:33
Co-authored-by: Ricky O'Steen <39831871+rosteen@users.noreply.github.com>
and fix import after rebase
because these are for really unlikely edge cases that cannot
be reached via the plugin GUI anyway
@pllim pllim force-pushed the wcs-pixels-wcs-ref branch from 2a3a0c2 to f1ba4a6 Compare March 23, 2024 01:40
@pllim
Copy link
Contributor Author

pllim commented Mar 23, 2024

Clare verbally approved the PR at tag up this morning, so I am just going to merge when CI is green.

@pllim pllim merged commit d3dcfa5 into spacetelescope:main Mar 23, 2024
16 checks passed
@pllim pllim deleted the wcs-pixels-wcs-ref branch March 23, 2024 02:02
@cshanahan1
Copy link
Contributor

haha yes i retroactively approve :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Affects-dev changelog bot directive bug Something isn't working imviz no-changelog-entry-needed changelog bot directive Ready for final review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: WCS to Pixels to WCS gives wrong reference data
3 participants