-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor and unify the interface for the raster image, contours, and vector overlay. #123
Conversation
…ntrast_to_set_scaling
@kswang1029 Sorry about the delay in getting back to this. I'm going to investigate the unresolved issues from your list. In some cases I'm going to create new issues, as some of these bugs are outside the scope of the refactoring in this PR (and I would like to get these large PRs merged in to make further testing and development easier). |
No problem at all. I should be able to be back to work next week and will catch up debt asap. |
@kswang1029 since the beam is actually purely a per-image property, and not a global setting, I'm planning to move it out of the |
@confluence I think we also have the same problem with the title rendered by AST? We should be able to specify different titles for different images. The behavior then would be the same as the rendered beam elements. In my opinion, having controls of title and beam in the WCSOverlay class feels for unified and consistent (to other AST props), despite the beam element is not rendered via AST. Perhaps we can consider the following? Or not sure if we want to introduce the idea of a "canvas" where it keeps wcs (all the AST props, including title), panel layout props, colorbar, and beam, in order to make the relationships unambiguous? |
@kswang1029 we already have separate image functions for changing the per-image title and colorbar label. I was going to argue, but you've convinced me that all of these functions should be accessible through the session's This is analogous to the export function in the regions PR: I added both a per-region
|
Yes.
Usually we apply same props for the beam in different panels. However, there are chances that different panels need different beam props due to the image feature distributions (to avoid blocking). When there are matched images (rendered as a raster and contours, for example), we may need to fine tune where and how the corresponding beams are rendered. Maybe we should fetch the default settings from the frontend (or the preferences.json) and apply them as the default per image. Then for each image, users can have flexibility to change props. And yes, we better move away from the concept of an active image in the scripting interface. |
@kswang1029 I have refactored the per-image WCS overlay properties. They are now accessible both from the session object through the existing (I initially made the the custom text setters and getters take a single required ID parameter, but as I was writing this explanation I decided that it would be less confusing and more consistent for all of the functions to have the same interface, regardless of how likely the user is to set the same value on multiple images at once.) So if you want to set the image title text or the colorbar label text, you do either this:
...or this:
If you want to set the color of all the beams, one of the beams, or some of the beams, you can do this:
...or you can do this per image:
The global wcs property getters mirror the global property setters, and all return tuples of values (one per image):
...whereas the image wcs property getters mirror their setters, are attributes rather than methods, and all return single values:
|
This approach is great and quite flexible for different use cases! 🚀 |
I originally omitted the pixel grid and spectral conversion from the WCS overlay object because they aren't WCS properties (in the same way that the pan and zoom commands are currently methods on the image object, even though in the GUI they're in a tab in the same configuration dialog as the WCS properties. My current proposal is to put the pixel grid commands in a "raster" object on the session (because the pixel grid is a global setting which affects how image raster components are rendered, and it disappears/reappears when you hide/show an image's raster component), and to put the spectral conversion methods directly on the image object (because they're per-image settings, and this is consistent with the location of the pan and zoom controls, channel / stokes navigation, etc.). But I'm open to suggestions. Usage (pixel grid):
Usage (spectral conversion):
There currently isn't one command for setting both properties in one step, but I could add one if it would be useful. |
The arrangement of the methods looks fine to me. For the |
Will do. I already have a line about this in the docstring, but I will update it to this more detailed wording. I assumed from the frontend code that the special "native" and "channel" spectral types (for unsupported images?) are not applicable to these functions, and so omitted them. Is that correct? |
Correct. 👍 |
@kswang1029 I have gone through the list of issues here, and I think they have mostly been addressed.
|
OK, will run e2e tests and finalize them accordingly. Almost there! |
@kswang1029 I think the "black" palette colour issue is actually a misunderstanding: the palette colours are all predefined colours that we get from the Blueprintjs library, and their "black" has never been actual black (the real colour values differ between library versions). If I export a screenshot from CARTA showing this as one of the overlay colours (from Firefox), and check the colour value, I get the exact same RGB value you're getting ( (Although, now that I'm looking at this, I see that I hardcoded the wrong values into the wrapper's palette-to-rgb colour conversion function, because I used the latest Blueprint version as a reference instead of the one that we're using. I will fix that in a separate PR. This doesn't affect this issue; it's a standalone function.) |
…ntrast_to_set_scaling
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.
Looks good. Let's move forward. I have created a set of e2e tests accordingly. Once this PR is merged, I will enable them in the e2e CI servers.
Great! I will merge this, and we can move onto the regions PR. |
The PR is to resolve #58.
Move
bias
andcontrast
fromImage.set_colormap()
toImage.set_scaling()
. Will wait for the merge of #79 to accept theAUTO
value.