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

FEAT: Load annulus from file, load reg files from IMPORT DATA #2201

Merged
merged 1 commit into from
Jun 7, 2023

Conversation

pllim
Copy link
Contributor

@pllim pllim commented May 12, 2023

Description

This pull request is to add two new features:

Blocked by

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.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

@pllim pllim added the feature Feature request label May 12, 2023
@pllim pllim added this to the 3.5 milestone May 12, 2023
@github-actions github-actions bot added documentation Explanation of code and concepts imviz labels May 12, 2023
@haticekaratay haticekaratay modified the milestones: 3.5, 3.6 May 25, 2023
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
and allow IMPORT DATA to load reg files.

Annulus support provided by glue-viz/glue#2403 and glue-viz/glue-astronomy#92

Add test for exception.

Bump minimum requirements for glue-core and glue-astronomy.
@pllim pllim force-pushed the annulus-eclipse-of-my-heart branch from 1e679fa to beb45e0 Compare June 5, 2023 22:17
@codecov
Copy link

codecov bot commented Jun 5, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (7ffaa26) 91.62% compared to head (beb45e0) 91.63%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2201   +/-   ##
=======================================
  Coverage   91.62%   91.63%           
=======================================
  Files         148      148           
  Lines       16535    16548   +13     
=======================================
+ Hits        15151    15163   +12     
- Misses       1384     1385    +1     
Impacted Files Coverage Δ
jdaviz/configs/imviz/plugins/parsers.py 88.47% <100.00%> (+0.09%) ⬆️
jdaviz/configs/imviz/tests/test_regions.py 100.00% <100.00%> (+0.60%) ⬆️
jdaviz/core/helpers.py 87.31% <100.00%> (-0.52%) ⬇️
jdaviz/core/region_translators.py 99.00% <100.00%> (+0.01%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@pllim pllim marked this pull request as ready for review June 6, 2023 00:04
@pllim pllim mentioned this pull request Jun 6, 2023
12 tasks
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.

Looks good! Only question is do we want to keep using get_interactive_regions() over get_subsets()? I guess if we move away from using subsets in imviz the answer is "yes", but if we go another way it might be something to consider (out-of-scope for this PR though).

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.

Just one quick question, but otherwise the diff looks reasonable to me and the demo seems to work as expected!

If this doesn't currently catch the exception and show in the load file dialog, that would definitely be nice to include, if possible (like other errors where a wrong file extension is selected, etc).

@@ -12,6 +12,11 @@ Cubeviz
Imviz
^^^^^

- Added the ability to load DS9 region files (``.reg``) using the ``IMPORT DATA``
button. However, this only works after loading at least one image into Imviz. [#2201]
Copy link
Member

Choose a reason for hiding this comment

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

what happens if you try the .reg file before loading an image? Is the ValueError shown in the UI or as a traceback in the console?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It throws error and this is tested on L188 in test_regions.py in this PR:

        with pytest.raises(ValueError, match="Cannot load regions without data"):
            imviz_helper.load_data(self.region_file)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The error would bubble up in the same was as any other error in Imviz parsing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this look good to you?

Screenshot 2023-06-07 161022

@pllim
Copy link
Contributor Author

pllim commented Jun 7, 2023

get_interactive_regions() over get_subsets()

Good question and @kecnry had mentioned before in a few other occasions. I also agree it is out of scope here. Kyle, is there a ticket?

@pllim pllim mentioned this pull request Jun 7, 2023
9 tasks
@pllim
Copy link
Contributor Author

pllim commented Jun 7, 2023

Since this has 2 approvals, I am going to merge. If you don't like how the loading error is presented, it also affects other parsing logic route and should be addressed separately.

Thanks for the reviews!

@pllim pllim merged commit 28395a2 into spacetelescope:main Jun 7, 2023
@pllim pllim deleted the annulus-eclipse-of-my-heart branch June 7, 2023 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Explanation of code and concepts feature Feature request imviz
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Import Data button to also load region files
4 participants