Skip to content

Fitting preparation #8

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

Merged
merged 10 commits into from
Jun 7, 2024
Merged

Fitting preparation #8

merged 10 commits into from
Jun 7, 2024

Conversation

andped10
Copy link
Contributor

@andped10 andped10 commented Jun 6, 2024

This PR is just preparation for more fundamental changes of the Fitter code base. No changes have yet been made to the logic. Only moving stuff around to clarify what is going on.

Next step is to make tests.

Main changes

Split Fitting.py into:

  • fitter.py
  • multi_fitter.py

Introduce dir for the minimizers (engines)

  • Fitting.minimizers

Renaming:

  • fitting_template.py -> minimizer_base.py

Extracted functionality from minimizer.minimizer_base.py into minimizer.utils.py

Moved fitter test from unit_tests into integration_tests

Only change to module import path:

  • Objects.Inferface.py , other changes are just text formatting

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request does not contain a valid label. Please add one of the following labels: ['chore', 'fix', 'bugfix', 'bug', 'enhancement', 'feature', 'dependencies', 'documentation']

@andped10 andped10 added the chore PR label label Jun 6, 2024
if TYPE_CHECKING:
from easyscience.Fitting.Fitting import Fitter
from easyscience.Fitting import Fitter
Copy link
Contributor Author

@andped10 andped10 Jun 6, 2024

Choose a reason for hiding this comment

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

Only update to import path. Other changes in file are only text formatting

@andped10 andped10 added the fitting Umbrella for fitting related work label Jun 6, 2024
@andped10 andped10 marked this pull request as ready for review June 6, 2024 08:21
Copy link
Member

@rozyczko rozyczko left a comment

Choose a reason for hiding this comment

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

This looks both benign (in scope) and very useful (for readibility)
Just a question on naming a class, but ready to merge anyway



class lmfit(FittingTemplate): # noqa: S101
class LmFit(MinimizerBase): # noqa: S101
"""
This is a wrapper to lmfit: https://lmfit.github.io/
Copy link
Member

Choose a reason for hiding this comment

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

The correct link is https://lmfit.github.io/lmfit-py/
The current link gives a 404



class lmfit(FittingTemplate): # noqa: S101
class LmFit(MinimizerBase): # noqa: S101
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure about CamelCase here.
LM stands for Levenberg-Marquardt - maybe LMFit ? This would be similar to other acronym-containing class names. Did we agree on naming?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you are right. It seems better to have acronyms capitalized in a class name.

Copy link
Member

Choose a reason for hiding this comment

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

I just didn't remember if we said anything about acronyms in names, but considering we are dealing with many of those (e.g. QENS, INS) we should have a clear rule

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my opinion:

  • module names should always be small caps (file tree)
  • class names should have CamelCase for the individual words. If acronym is part of the name it should be ALLCAPS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess this should be an ADR on the organization level.

@andped10 andped10 merged commit afbe718 into develop Jun 7, 2024
26 checks passed
@andped10 andped10 deleted the fitting_preparation branch June 7, 2024 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore PR label fitting Umbrella for fitting related work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants