-
Notifications
You must be signed in to change notification settings - Fork 279
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
More uniform independent vars #941
Conversation
…ables, save default value
…come Parameters (following documentation)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #941 +/- ##
==========================================
+ Coverage 93.11% 93.14% +0.02%
==========================================
Files 10 10
Lines 3720 3762 +42
==========================================
+ Hits 3464 3504 +40
- Misses 256 258 +2 ☔ View full report in Codecov by Sentry. |
@newville I will take a look at this during the weekend |
@reneeotten Thanks - that's much appreciated. This is a bit "deep in the weeds" and mostly implementation detail. I think which function arguments to a Model Function should become "independent variable" can be a bit subtle. But the "Model.opts" in the current implementation is confusing, and @schtandard raised some good points. I am not sure there is one obvious solution, but I think this is an improvement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry @newville for the delay.... This looks good to me, I've actually only a few comments regarding some documentation typos and one question regarding an actual code change. Other than that I am happy for it to be merged.
I'll comment later in the discussion about making a new release. I think most is addressed; there was one question on the mailinglist a while ago that involved basinhopping
I think that I was going to look into. I'll try to do so later today and then we can probably do some minor clean-up for a release (i.e., update whatsnew.rst
, etcetera) and we should be good to go!
@newville also, unrelated to this PR, but: I guess we can remove the |
Thanks very much I'll fix the typos and bad wording, and answer the typing question. I'm okay with removing ampgo or leaving it for historical purposes. No preference. I don't remember the details of the |
thanks @newville - a squash-merge with updating the final commit message would be good here. |
c34a6f4
to
c820e19
Compare
@reneeotten fixed the commit typo, a docstring typo, waiting for tests to complete. For basinhopping, I think this is working okay. I would like to add an example, similiar to I know it is unrelated to this PR, but I think adding an example is not a problem, so I just added that example here. |
@reneeotten I'll plan to squash and merge this in a few days. |
Description
This is a change to
Model
to make the assignment of independent variables from function arguments a bit clearer. This is a more complete version of what @schtandard was trying to do with #925 and #926 (and apologies for taking so long on this!)With this change, function arguments with non-numeric default values will now be listed as independent variables, by default. That is, with a mode function of
will now give
['x', 'check_positive']
. The default value will be kept and used as a default value.There is sort of an interesting case of
lmfit.lineshapes.voigt
, which hasWith the change here,
gamma
is initially listed as an independent variable, with default valueNone
. But it can still be turned into a Parameter to vary (or, I suppose constrain some other way) in the fit. I sort of struggled with this, and currently this "turn a function argument that would be an independent variable into a Parameter" can only be done when the default value isNone
or a boolean (True
/False
)After review, this should probably be squashed and merged.
Type of Changes
Tested on
Python: 3.11.5 | packaged by conda-forge | (main, Aug 27 2023, 03:35:23) [Clang 15.0.7 ]
lmfit: 1.2.2.post35+gc9c2b2d.d20240223, scipy: 1.11.4, numpy: 1.26.2, asteval: 0.9.31, uncertainties: 3.1.7
Verification
Have you