-
Notifications
You must be signed in to change notification settings - Fork 75
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
Footprints: custom regions import #2377
Conversation
1cd4144
to
4ef5837
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2377 +/- ##
==========================================
+ Coverage 90.52% 90.59% +0.06%
==========================================
Files 159 159
Lines 18236 18315 +79
==========================================
+ Hits 16509 16593 +84
+ Misses 1727 1722 -5
☔ View full report in Codecov by Sentry. |
acc60e6
to
1f8b024
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just general design thoughts. For a generic region load to be useful:
- It has to work in pixel linking or when only one image is loaded.
- There should be API to grab the "footprint" object back out as proper
regions
shapes (not just polygon, a circle region loaded should come back out as circle shape). - If this functionality needs to be within this same plugin, then pysiaf needs to be optional even in this plugin. I don't want to have to install pysiaf just to load in a DS9 region file.
- The regions API in this plugin needs to somehow tie back nicely to helper
load_regions
andget_regions
. This needs some thought because right now those APIs are tied to subsets, but eventually if we want to get rid of subsets, we need this for less painful transition.
This is still planned, but deferred. 🐱
This already exists as
I agree - I'll copy your comment over to the ticket where we reconsider the pysiaf dependency 🐱. If anyone insists, I could make that happen now (have the plugin enabled, but just remove the jwst instruments from the dropdown)... but I would need to think about how to make that work with no other options available and if we're likely removing that logic soon anyways, I'm not sure its worth the effort and code bloat now.
Down the road we might want the helper methods to have an option to load directly in this plugin or as subsets (and we might also want the ability to convert regions/footprints in this plugin into subsets and vice versa), but I also think we could decide to leave them be separate. This plugin is still called "footprints", so even though it supports generic regions, the scope/context of the plugin is technically just to "overlay instrument footprints". |
With the linking and projection, we would have to be careful. Basically, we need to recreate some stuff that glue-core provides natively with Subsets. |
7a94a5f
to
8d44ea1
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Overall this is looking pretty good to me, but I see an annoying formatting thing when I load a region from file. Oddly, the formatting fixes itself if I switch my mouse over to my other computer, so it might be other software on my computer somehow messing things up: If no one else can replicate this, I'm probably ok approving. |
That happens when the hint breaks onto two lines... I didn't think that could happen with our minimum tray width, but let me see if I can make it more responsive. EDIT: I thought the tray had a minimum width, but apparently that is a percentage. I think we definitely want a minimum absolute width so that we can design the UI accordingly, so I set that here at 250px, which just so happens to ensure that the hint in this case doesn't overflow to two lines 😉 |
Looks better to me now. As I said offline, I'm concerned that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See kecnry#4
Can you explain what situations do not work? The scope here was to allow file and API import of sky regions (pixel-linking and pixel-regions support is intentionally deferred, as previously discussed, and drawing single points may or may not be added in the future). Although there are more general use-cases, the plugin is called "footprints", so the idea is to be able to support importing custom instrument footprints, and doesn't need to support generic pixel apertures, for example. The file dialog (in the original PR) and the API should prevent loading pixel regions, and hopefully only allow files/regions that are compatible. If that is not the case, please send any file/region that you would expect to load or expect to be prevented from loading under the scope of the PR and I will fix that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things still confused me.
Use case 1
I used the API to load a file but plugin is not opened on GUI. Calling footprints_plugin.import_region("four_circles_test.reg")
did not crash, so I thought it must have loaded something. I don't see the circles displayed, which is fine because plugin is not opened.
But I expected the circles to show if I then open the plugin. But they don't. If I call the API again while plugin is opened, then they show.
Use case 2
I load a region file. The circles show. All is well. Then I go to "Overlay" section and click "+", enter a new name, and then the checkmark. I go back to "From File..." and select a different region file to load it.
It works in notebook, but hangs in standalone/voila; i.e., the browser display (not just Imviz) grays out and unresponsive. No traceback on terminal. This is Windows 10 + Chrome. Works now in standalone too when I run it again. 🤷
Update: I cannot reproduce "Use case 2" so maybe it was some frontend fluke. We can ignore it for now. Would still like to know if Use Case 1 is expected behavior or not. |
Let me rebase on top of #2386 and make sure that that handles the mark visibility as expected |
* currently without any repositioning support (region is static)
* already set to have a min-width of 25% the app-width, but for small screens/browsers, this will impose a pixel minimum to prevent UI over-crowding (and in this case, allow us to assume the hint in the "preset" dropdown will remain on a single line).
Co-authored-by: P. L. Lim <[email protected]>
* instead of disabling the plugin, options are removed from the preset dropdown and a warning is shown. * to avoid "From File..." from being the default, a "None" entry is added if pysiaf is not installed * this may largely be reverted in the future Co-authored-by: P. L. Lim <[email protected]>
Co-authored-by: P. L. Lim <[email protected]>
4e82391
to
4eb05d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
></v-select> | ||
</v-row> | ||
<v-alert v-if="!has_pysiaf" type="warning" style="margin-left: -12px; margin-right: -12px"> | ||
<span>To use JWST footprints, install pysiaf and restart jdaviz</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is okay for now but I am not sure this is a good idea if we end up having multiple optional dependencies to support footprints for different telescopes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed - this is just intended to be temporary until we make a decision on what to do with pysiaf (and other similar dependencies)
CI failure is unrelated and is being handled in #2399 |
Description
This pull request implements the ability to load a regions file into the footprints plugin, adopting the pattern we created for searching custom catalog files in the catalogs plugin (but generalizing that logic and moving it into a reusable plugin component)
Screen.Recording.2023-08-16.at.1.23.07.PM.mov
This is also supported from the plugin user API:
TODO:
Open questions:
Change log entry
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, maintainershould 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.
trivial
label.