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

Add composite subset fixes #2291

Merged
merged 6 commits into from
Jul 12, 2023

Conversation

javerbukh
Copy link
Contributor

Description

This pull request continues the work that @kecnry started in #2207 and I continued in #2266. This fixes the first bug found in #2182 (comment) . It also applies the fix in coords info so that the collapsed composite spatial subset can be hovered over.

Fixes #

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)?

@javerbukh javerbukh added this to the 3.6 milestone Jul 10, 2023
@codecov
Copy link

codecov bot commented Jul 11, 2023

Codecov Report

Patch coverage: 80.43% and project coverage change: +0.03 🎉

Comparison is base (d261e71) 90.91% compared to head (10ba093) 90.94%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2291      +/-   ##
==========================================
+ Coverage   90.91%   90.94%   +0.03%     
==========================================
  Files         152      152              
  Lines       17028    17140     +112     
==========================================
+ Hits        15481    15588     +107     
- Misses       1547     1552       +5     
Impacted Files Coverage Δ
...igs/default/plugins/model_fitting/model_fitting.py 86.45% <ø> (ø)
...imviz/plugins/aper_phot_simple/aper_phot_simple.py 92.66% <ø> (ø)
...igs/specviz/plugins/line_analysis/line_analysis.py 97.05% <ø> (ø)
jdaviz/core/data_formats.py 76.53% <33.33%> (-1.85%) ⬇️
jdaviz/core/launcher.py 35.18% <37.50%> (+19.56%) ⬆️
jdaviz/cli.py 27.90% <50.00%> (+0.84%) ⬆️
...z/configs/imviz/plugins/coords_info/coords_info.py 94.91% <83.33%> (+0.32%) ⬆️
jdaviz/utils.py 87.96% <90.90%> (+0.26%) ⬆️
jdaviz/__init__.py 88.23% <100.00%> (ø)
jdaviz/components/toolbar_nested.py 85.00% <100.00%> (+11.31%) ⬆️
... and 8 more

... and 1 file with indirect coverage changes

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

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.

Some small questions that hopefully will be easy to address. Does this deserve a regression test (either for checking that get_subset_type(composite_spatial_subset) == 'spatial' or that the highlighting mark is added correctly?

jdaviz/configs/imviz/plugins/coords_info/coords_info.py Outdated Show resolved Hide resolved
@@ -377,7 +378,7 @@ def add_data(self, data, color=None, alpha=None, **layer_state):
# that new data entries (from model fitting or gaussian smooth, etc) will only be spectra
# and all subsets affected will be spectral
for layer in self.state.layers:
if "Subset" in layer.layer.label and layer.layer.data.label == data.label:
if get_subset_type(layer.layer) == 'spectral' and layer.layer.data.label == data.label:
Copy link
Member

Choose a reason for hiding this comment

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

I think get_subset_type assumes the input is a subset... does the fact that this works depend on the assumption that spectral is defined first in that function (do we need some way to still detect if the layer is a subset at all vs actual data)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

get_subset_type has a check to start if the layer.layer object has attribute "subset_state" and if not it returns None. I added a check to this if statement though to make it more clear that this should only accept layer's associated with subsets.

assert len([m for m in spectrum_viewer.figure.marks if isinstance(m, ShadowSpatialSpectral)]) == 1 # noqa
assert len([m for m in spectrum_viewer.figure.marks if isinstance(m, ShadowSpatialSpectral)]) == 2 # noqa
Copy link
Member

Choose a reason for hiding this comment

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

this (and the next set of changes to line 229) is only temporary until #2292 is addressed, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Assuming Gaussian Smooth stays a cube, this is the correct number for the amount of ShadowSpatialSpectral marks. A spatial subset is applied to the flux cube AND the smoothed cube, which creates two collapsed spectra in the spectrum viewer. Each of those spectra then has a spectral subset applied to them, creating 2 shadow marks. If you add another spectral subset, that number goes up to 4. If you delete the smooth cube, that number goes back down to 2 since you still have the flux cube's spatial subset intersecting with the two spectral subsets.

jdaviz/utils.py Outdated Show resolved Hide resolved
Copy link
Contributor

@bmorris3 bmorris3 left a comment

Choose a reason for hiding this comment

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

Love seeing this centralized. Thanks!

Co-authored-by: Brett M. Morris <morrisbrettm@gmail.com>
@javerbukh
Copy link
Contributor Author

Thank you for the reviews! I'll merge once CI tests pass.

@javerbukh javerbukh merged commit a69493b into spacetelescope:main Jul 12, 2023
13 of 14 checks passed
@javerbukh javerbukh deleted the add-composite-subset-fixes branch July 12, 2023 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants