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

No more centroiding in Simple Aperture Photometry plugin #1841

Merged
merged 3 commits into from
Nov 18, 2022

Conversation

pllim
Copy link
Contributor

@pllim pllim commented Nov 14, 2022

Description

This pull request is to remove partial centroiding in Simple Aperture Photometry plugin. We reintroduce fitting of mean in Gaussian (the code was in one of the commits in #1409 but later removed before merged but still in Git history). Radial profile was added in #1030 and this plugin in #938 (there were other PRs too in between).

Also removes an outdated known issue that was already fixed in #1524 .

Fixed a minor bug where Gaussian Fit section shows on GUI even when not applicable. This happens when user enables Gaussian fitting for radial profile, and then redid the calculation with Curve of Growth immediately after without disabling Gaussian fitting option.

Fixes #1442

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

@pllim pllim added this to the 3.2 milestone Nov 14, 2022
@github-actions github-actions bot added documentation Explanation of code and concepts imviz labels Nov 14, 2022
@pllim pllim marked this pull request as ready for review November 14, 2022 22:53
@codecov
Copy link

codecov bot commented Nov 14, 2022

Codecov Report

Base: 88.29% // Head: 88.29% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (267856e) compared to base (9a1d414).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1841   +/-   ##
=======================================
  Coverage   88.29%   88.29%           
=======================================
  Files          95       95           
  Lines       10396    10400    +4     
=======================================
+ Hits         9179     9183    +4     
  Misses       1217     1217           
Impacted Files Coverage Δ
...imviz/plugins/aper_phot_simple/aper_phot_simple.py 92.20% <100.00%> (+0.08%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 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.

Changes seem quite straightforward and seem to work well (and feels both more intuitive and flexible now)!

Just one minor comment about possibly adding some mentions of recentering in the plugin or docs, but I'll leave that up to you.

CHANGES.rst Show resolved Hide resolved
Comment on lines +399 to +405
x_mean = x_data[np.where(y_data == y_max)].mean()
std = 0.5 * (phot_table['semimajor_sigma'][0] +
phot_table['semiminor_sigma'][0])
if isinstance(std, u.Quantity):
std = std.value
gs = Gaussian1D(amplitude=y_max, mean=0, stddev=std,
fixed={'mean': True, 'amplitude': True},
gs = Gaussian1D(amplitude=y_max, mean=x_mean, stddev=std,
fixed={'amplitude': True},
Copy link
Member

Choose a reason for hiding this comment

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

seems to work reasonably well for an intentionally non-centered aperture!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It still isn't fool-proof (it will fail if y_max returns x_data values at different peaks, for instance) but hopefully work good enough for most cases that this plugin is useful for... 🤞

Simple Aperture Photometry plugin.

Removed outdated known issue.

Updated docs and tests.
docs/imviz/plugins.rst Outdated Show resolved Hide resolved
Co-authored-by: Ricky O'Steen <[email protected]>
@pllim
Copy link
Contributor Author

pllim commented Nov 18, 2022

@rosteen , looks good to you know after the typo fix or is there something else? Thanks!

@rosteen
Copy link
Collaborator

rosteen commented Nov 18, 2022

@rosteen , looks good to you know after the typo fix or is there something else? Thanks!

Got distracted in the middle of testing, sorry. Approved!

@pllim pllim merged commit f257d71 into spacetelescope:main Nov 18, 2022
@pllim pllim deleted the centerella branch November 18, 2022 20:33
@pllim
Copy link
Contributor Author

pllim commented Nov 18, 2022

Thanks for the reviews!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Explanation of code and concepts imviz Ready for final review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to disable centroiding in Simple Aperture Photometry
3 participants