-
Notifications
You must be signed in to change notification settings - Fork 153
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
Update 1D Profile viewer to use wcsaxes for plotting and add sliders #2167
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2167 +/- ##
==========================================
- Coverage 87.89% 87.74% -0.15%
==========================================
Files 246 248 +2
Lines 22764 22912 +148
==========================================
+ Hits 20009 20105 +96
- Misses 2755 2807 +52
Continue to review full report at Codecov.
|
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 looking good! In addition to the comments below:
-
The icon added looks identical to https://github.com/glue-viz/glue/blob/master/glue/icons/glue_crosshair.png?
-
There are also changes here that add the pixel extraction to the image viewer by default, which I'm not sure we want to do yet?
Yeah, I could revert the changes made regarding the pixel extraction tool, but I would like to add the image to the |
Removed pixel extraction tool code, but kept the new image for |
@astrofrog PR ready for another review |
I have noticed two major usability issues with this:
|
So have just updated the Regarding the comments:
These will involve some deep changes and hence will need some time to accomplish. |
But I reckon we could enhance this PR with regards to #2167 (comment) in a separate PR at a later stage. |
Turned out the code I wrote was only working in this case only if one tweaks the opacity slider. (And it was working fine for sequentially stacked IRIS Level 2 datacubes.) And I have just fixed the underlying bugs so it is working fine for the typical FITS files containing data cubes as well. See the following for a demo: |
Just added code to hide the extra sliders in the 1D Profile viewer's options widget when we have self.viewer_state != 'slice' |
Just patched this error. Actually I was baffled by why it was the case before as @Cadair never saw the extra sliders but I could. It was because he was using the drag-and-drop action to initiate the 1D Profile viewer. To tackle this error from using the spectrum tool button, I have just removed the code snippets that would cause such an issue in the commit da82536. |
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 almost good to go! A few usability issues:
- Currently the subset profiles don't seem to be right in slice mode, for instance if I make a small subset and push the sliders to the edge of the dataset then the subset profile should be empty/not shown:
-
Currently I can't get this to work with 2-d datasets - this used to work for non slice modes but appears broken for all modes now.
-
The font size in the profile viewer doesn't seem to be the same as for the image viewer:
I'll review the code in detail below.
elif self._sliders[i] is None: | ||
slices.append(0) | ||
|
||
self.viewer_state.slices = slices |
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.
I think in future we'll want to try and avoid duplication with the image viewer - I can investigate once we add this to the 3-d viewer (to visualize >3-d datasets)
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.
Sure
Have made the changes according to the suggestions given. PR is ready for another review. |
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 to me! I'm now going to be a bit annoying and ask if you could add a test - a lot of the code here isn't covered by the test suite since there isn't a test for the profile viewer in slice
mode. There are other tests in glue/viewers/profile/qt/tests
you could perhaps start from ?
if force or any(prop in changed for prop in ('layer', 'slices', 'x_att', 'x_att_pixel', 'attribute', | ||
'function', 'normalize', 'v_min', 'v_max', 'visible')): | ||
self._update_visual_attributes() | ||
self._calculate_profile(reset=True) |
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.
For other viewers the approach is instead to do:
self._calculate_profile(reset=True)
force=True
which ensures the visual properties are updated next. Maybe switch to this approach?
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.
Sure
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.
Tried changing to
self._calculate_profile(reset=True)
self._update_profile(force=True)
But error was thrown upon attempting to view via 1D Profile viewer as data cannot be added for some reason...
Yup, sure. I could add some unit tests for the CI. |
… to 1D Profile viewer
Description
To replace #2156.
Tasks accomplished with this PR:
astropy
'swcsaxes
for plotting.'slice'
function option to the 1D Profile to enable plotting a 1D spectrum of a data cube (e.g. an IRIS raster data cube) at a position picked out by glue-solar's pixel extraction tool.BaseData
type data so that now the dataset in the data collection generated byglue-solar
's pixel extraction tool can be deleted.