Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

disallow gaussian smooth output as input #2239

Merged
merged 1 commit into from
Jun 7, 2023

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Jun 6, 2023

Description

This pull request excludes the output from the gaussian smooth plugin to be a valid input back into the plugin, preventing a vertical "shift" after clicking the smooth button when only one input data was available.

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

@kecnry kecnry added this to the 3.6 milestone Jun 6, 2023
@kecnry kecnry force-pushed the dataset-plugin-filter branch from e999145 to d2e0d01 Compare June 6, 2023 16:30
@@ -1496,6 +1496,9 @@ def _is_valid_item(self, data):
def not_from_plugin(data):
return data.meta.get('Plugin', None) is None

def not_from_this_plugin(data):
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think in the future we would need a generic version of this, maybe something like this?

Suggested change
def not_from_this_plugin(data):
def not_from_plugin(data, plugin_name="self"):

For example, is there a situation where we would say "plugin X cannot take output from plugin Y"?

Copy link
Member Author

Choose a reason for hiding this comment

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

The current framework doesn't allow for that (there is no way to set the kwargs that would get passed on). Instead, the plugin could create and pass its own callable to the filter:

def not_from_something_specific(data):
    return data.meta.get('Plugin', None) not in ('something', 'specific')

dataset.add_filter(not_from_something_specific)

or if we find we re-use something often, we could migrate it directly into the dataset component.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, fine as-is then. If it is not easy, no point to worry about use case that does not yet exist.

@kecnry kecnry force-pushed the dataset-plugin-filter branch from d2e0d01 to e0a1fd6 Compare June 6, 2023 16:51
@codecov
Copy link

codecov bot commented Jun 6, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (7ffaa26) 91.62% compared to head (e0a1fd6) 91.63%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2239   +/-   ##
=======================================
  Coverage   91.62%   91.63%           
=======================================
  Files         148      148           
  Lines       16535    16538    +3     
=======================================
+ Hits        15151    15154    +3     
  Misses       1384     1384           
Impacted Files Coverage Δ
...default/plugins/gaussian_smooth/gaussian_smooth.py 97.75% <100.00%> (+0.02%) ⬆️
...gins/gaussian_smooth/tests/test_gaussian_smooth.py 100.00% <100.00%> (ø)
jdaviz/core/template_mixin.py 93.11% <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.

@kecnry kecnry marked this pull request as ready for review June 6, 2023 17:14
Copy link
Contributor

@pllim pllim left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@pllim pllim merged commit 62948ba into spacetelescope:main Jun 7, 2023
@pllim pllim added the plugin Label for plugins common to multiple configurations label Jun 7, 2023
@kecnry kecnry deleted the dataset-plugin-filter branch June 7, 2023 16:06
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
plugin Label for plugins common to multiple configurations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants