Skip to content

Add an inplace=False/True keyword argument to __call__ on fitters to allow in-place modification of models - #17033

Merged
nden merged 10 commits into
astropy:mainfrom
astrofrog:inplace-fitting
Oct 13, 2024
Merged

nden merged 10 commits into
astropy:mainfrom
astrofrog:inplace-fitting

Conversation

@astrofrog

@astrofrog astrofrog commented Sep 18, 2024 •

Copy link
Copy Markdown
Member

This then uses this keyword argument to speed up the fitting in parallel_fit_dask since we can modify the parameters in-place without any risk.

  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button. Maintainers should respect this when possible; however, the final decision is at the discretion of the maintainer that merges the PR.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thank you for your draft pull request! Do you know that you can use [ci skip] or [skip ci] in your commit messages to skip running continuous integration tests until you are ready?

@astrofrog
astrofrog marked this pull request as ready for review September 18, 2024 13:27
@astrofrog
astrofrog requested a review from a team as a code owner September 18, 2024 13:27
@astrofrog astrofrog added this to the v7.0.0 milestone Sep 18, 2024
Comment thread docs/changes/modeling/17033.feature.rst Resolved
@pllim pllim added API change PRs and issues that change an existing API, possibly requiring a deprecation period benchmark Run benchmarks for a PR labels Sep 18, 2024

@mhvk mhvk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems like the nicer approach! I guess one small suggestion (but might as well wait for proper review), is to add a * to ensure the new argument is keyword-only.

@larrybradley

Copy link
Copy Markdown
Member

I'm not a modeling maintainer, but I like this addition!

@astrofrog

Copy link
Copy Markdown
Member Author

This seems like the nicer approach! I guess one small suggestion (but might as well wait for proper review), is to add a * to ensure the new argument is keyword-only.

Done!

@nden

nden commented Oct 10, 2024

Copy link
Copy Markdown
Contributor

This looks good. A couple of comments

  • Can you edit the Returns sections in the docstrings to clarify that the returned model is not always a copy
  • Should the inplace parameter be passed to the FittingWithOutlierRemoval? Speeding up this one will be a good thing too.

@nden

nden commented Oct 10, 2024

Copy link
Copy Markdown
Contributor

Also I wonder if a note should be added to the Performance tips section in the documentation.
https://docs.astropy.org/en/latest/modeling/performance.html

@astrofrog

Copy link
Copy Markdown
Member Author

@nden - I've now:

  • Added a performance tip
  • Updated the Returns sections in the docstrings for all the fitters
  • Added an explicit inplace= option to FittingWithOutlierRemoval (in fact the option was passed through anyway via **kwargs but I think it's clearer this way

@astrofrog

Copy link
Copy Markdown
Member Author

pre-commit.ci autofix

@astrofrog

Copy link
Copy Markdown
Member Author

@nden - this should be ready, the CI failures are unrelated.

@astrofrog

Copy link
Copy Markdown
Member Author

Rebased

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API change PRs and issues that change an existing API, possibly requiring a deprecation period benchmark Run benchmarks for a PR modeling Performance Ready-for-final-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants