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

Use TRFLSQFitter instead of LevMarLSQFitter #3202

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

pllim
Copy link
Contributor

@pllim pllim commented Sep 25, 2024

Description

This pull request is to fix #3189

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. Bugfix milestone also needs an accompanying backport label.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)? 🐱

@pllim pllim added the trivial Only needs one approval instead of two label Sep 25, 2024
@pllim pllim added this to the 4.0 milestone Sep 25, 2024
@github-actions github-actions bot added imviz plugin Label for plugins common to multiple configurations labels Sep 25, 2024
@@ -876,7 +876,7 @@ def calculate_photometry(self, dataset=None, aperture=None, background=None,

# Fit Gaussian1D to radial profile data.
if self.fit_radial_profile:
fitter = LevMarLSQFitter()
fitter = TRFLSQFitter()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@larrybradley , is this replacement reasonable or another one is better? Also see astropy/photutils#1895

Copy link
Member

Choose a reason for hiding this comment

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

That should work fine. I don't think you are using parameter bounds, so LMLSQFitter is also an option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Well, not yet. No idea if that is going to be future request or not. 😬

Copy link
Member

Choose a reason for hiding this comment

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

is there any consequence on performance between the two for this use-case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nothing that we have to worry about. I am using what Astropy now suggests in their docs. Tom R made that change upstream and he has been also working on modeling performance there, so he wouldn't recommend anything that would make things worse.

Copy link
Member

Choose a reason for hiding this comment

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

In my testing, TRFLSQFitter is about 4-5% slower than LevMarLSQFitter. However, this difference will not be noticeable here.

Copy link

codecov bot commented Sep 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.50%. Comparing base (32bb09e) to head (2eae18c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3202   +/-   ##
=======================================
  Coverage   88.50%   88.50%           
=======================================
  Files         124      124           
  Lines       18577    18577           
=======================================
  Hits        16441    16441           
  Misses       2136     2136           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pllim pllim merged commit 5f547ea into spacetelescope:main Sep 26, 2024
22 of 24 checks passed
@pllim pllim deleted the TRFLSQFitter branch September 26, 2024 15:27
@pllim
Copy link
Contributor Author

pllim commented Sep 26, 2024

Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imviz plugin Label for plugins common to multiple configurations trivial Only needs one approval instead of two
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stop using LevMarLSQFitter as recommended by astropy
3 participants