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: Support sky regions and allow direct call to translator function #93

Merged
merged 4 commits into from
Jun 16, 2023

Conversation

pllim
Copy link
Contributor

@pllim pllim commented Jun 6, 2023

Description

There is a need for Jdaviz to be able to call the translator code directly and have option to get back sky regions. The first part is useful for spatial region translations where we pass in the subset state directly internally and there is really no need to access subset.data. This blocks:

Fix #89

cc @dhomeier or @astrofrog

@@ -14,8 +14,7 @@

__all__ = ["range_to_rect", "AstropyRegionsHandler"]

GLUE_LT_1_10 = Version(glue_version) < Version('1.10')
GLUE_LT_1_10_1 = Version(glue_version) < Version('1.10.1.dev') # remove .dev after it is released
GLUE_LT_1_11 = Version(glue_version) < Version('1.11')
Copy link
Contributor Author

@pllim pllim Jun 6, 2023

Choose a reason for hiding this comment

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

@dhomeier , I am also cleaning up the version check here, as discussed in #92 (comment) . True annulus ROI support wasn't added till glue-core 1.11.

@codecov
Copy link

codecov bot commented Jun 6, 2023

Codecov Report

Patch coverage: 94.02% and project coverage change: -0.04 ⚠️

Comparison is base (755874d) 96.92% compared to head (3e4a7ab) 96.89%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #93      +/-   ##
==========================================
- Coverage   96.92%   96.89%   -0.04%     
==========================================
  Files          18       18              
  Lines        1399     1415      +16     
==========================================
+ Hits         1356     1371      +15     
- Misses         43       44       +1     
Impacted Files Coverage Δ
glue_astronomy/translators/regions.py 92.15% <93.33%> (-0.05%) ⬇️
glue_astronomy/translators/tests/test_regions.py 99.33% <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

This comment was marked as resolved.

@pllim pllim mentioned this pull request Jun 13, 2023
sky region translation
@pllim pllim changed the title FEAT: Support AstropyRegionsHandler().to_object() direct call FEAT: Support sky regions and allow director call to translator function Jun 13, 2023
@pllim pllim marked this pull request as ready for review June 13, 2023 15:07
@pllim pllim changed the title FEAT: Support sky regions and allow director call to translator function FEAT: Support sky regions and allow direct call to translator function Jun 13, 2023
Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

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

This seems sensible to me - aside from a suggested API change. I'm ok with having the helper function be public API, but curious what the use case is compared to using the regular translator API in glue?

@@ -54,9 +53,54 @@ def range_to_rect(data, ori, low, high):
return RectanglePixelRegion(PixCoord(xcen, ycen), width, height)


def roi_subset_state_to_spatial(subset_state, to_sky=False):
Copy link
Member

Choose a reason for hiding this comment

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

roi_subset_state_to_region might make more sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what the use case is compared to using the regular translator API in glue?

I noticed that the translator code is basically being duplicated at https://github.com/spacetelescope/jdaviz/blob/8790525bcc31582b4828c4b0dfb50200621e3da6/jdaviz/app.py#L1054 . That code was added in for Jdaviz Subset Tools plugin to support display/edit of composite Subset.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I renamed it. Thanks for the review!

@astrofrog astrofrog merged commit 4682152 into glue-viz:main Jun 16, 2023
@astrofrog astrofrog added the enhancement New feature or request label Jun 16, 2023
@pllim pllim deleted the translator-direct-call branch June 16, 2023 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for sky regions in translator
2 participants