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

Add warning when less than 2 data have WCS #13

Merged
merged 8 commits into from
Nov 3, 2023

Conversation

javerbukh
Copy link

@javerbukh javerbukh commented Oct 26, 2023

Description

This pull request adds a warning message in the Links Control plugin when less than 2 no data in data collection has valid WCS.

EDIT:
image

I tried to support data deletion as well but noticed some bugs when deleting data in this PR. Please let me know if that is just on my end.

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.
  • Add warning to Links Control plugin when less than 2 data have WCS.

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 requested a review from bmorris3 as a code owner October 26, 2023 14:21
@github-actions github-actions bot added the imviz label Oct 26, 2023
@javerbukh javerbukh changed the title Add warning when less than 2 data do not have WCS Add warning when less than 2 data have WCS Oct 26, 2023
Copy link

@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.

just a small performance-suggestion, otherwise looks good to me. We might want to tweak the language a bit if anyone finds it confusing, but that can be done as we review the larger PR.

Copy link
Owner

@bmorris3 bmorris3 left a comment

Choose a reason for hiding this comment

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

Leaving some changes for future ease of reading/maintaining, and one point where I'm confused if it works.

num_data_with_wcs = 0
for data in self.app.data_collection:
if hasattr(data.coords, 'pixel_to_world'):
if num_data_with_wcs:
Copy link
Owner

Choose a reason for hiding this comment

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

Shouldn't this be

Suggested change
if num_data_with_wcs:
if num_data_with_wcs > 1:

Copy link

Choose a reason for hiding this comment

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

I don't think so, the increment happens below this line, so this is just saying if there was already one with WCS, making this the second entry, then enable linking and stop looping. But let's definitely add a comment that clears this up, I can see how it is confusing to read 😬

Copy link
Author

Choose a reason for hiding this comment

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

I added a comment explaining what is happening at this step, please let me know if that is sufficient!

@javerbukh javerbukh requested a review from bmorris3 November 2, 2023 13:19
@kecnry
Copy link

kecnry commented Nov 2, 2023

We should test this for the case of original rotation of a single image layer (which might be another motivation for eventually changing the name of the plugin... but that's out of scope here)

@javerbukh
Copy link
Author

@kecnry Rotating a single image worked for me. Hopefully you both see the same thing!

@kecnry
Copy link

kecnry commented Nov 2, 2023

Nope, I'm seeing this with a single image layer in the app with WCS. It might be as simple as only requiring one (and then don't need the counter at all).

Screen Shot 2023-11-02 at 3 23 29 PM

@javerbukh
Copy link
Author

@kecnry So canvas rotation still works with only 1 data loaded into the viewer and if you try to link by wcs with 1 data, it looks like nothing happens. Should I revert the last commit?

@kecnry
Copy link

kecnry commented Nov 3, 2023

Canvas rotation will be removed soon (see #9)

I do see though that the linking itself fails and fallsback on pixel linking, but we need a way to still use the image rotation logic with only a single layer (that has valid WCS). @bmorris3 - can some logic be moved around so the default orientation is created immediately when requesting WCS-linking so that it can then link against that?

Copy link
Owner

@bmorris3 bmorris3 left a comment

Choose a reason for hiding this comment

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

To make the single-data with WCS case work, we need to change this line:


to be > 0 rather than > 1.

@javerbukh javerbukh requested a review from bmorris3 November 3, 2023 15:26
@bmorris3 bmorris3 merged commit 6d55ae9 into bmorris3:wcs-only-layers Nov 3, 2023
@javerbukh javerbukh deleted the no-wcs-no-link branch November 3, 2023 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants