-
Notifications
You must be signed in to change notification settings - Fork 280
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
Allow model opts #950
Allow model opts #950
Conversation
…ibution builtin models
…ven non-default values at model creation time
… model creation time
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #950 +/- ##
==========================================
+ Coverage 93.14% 93.20% +0.05%
==========================================
Files 10 10
Lines 3762 3765 +3
==========================================
+ Hits 3504 3509 +5
+ Misses 258 256 -2 ☔ View full report in Codecov by Sentry. |
@reneeotten I'd like to merge this (or a reviewed version of it) and tag as 1.3.1 over the next week or so. Any objections? |
@newville I'll take a look tonight after work. |
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 for the delay @newville .... Changes look fine to me, the only suggestion I would have is to completely remove all type annotations in the added test and perhaps reorganize/minimize the commits a bit so that it's clear what is fixing the two issues. But that does likely require a bit of git-voodoo and I know you're not so keen on that ;) Anyway, the code changes look good to me and to be honest you know that code much better than me - so feel free to merge!
8f49a14
to
1919e80
Compare
…nd 'kwargs' as for variadic function, add test
1919e80
to
217347e
Compare
@reneeotten Thanks! I backed up and did a forced push for one commit to address #953. I think this is probably OK to leave as a few separate commits rather than squash-and-merge. Assuming the tests pass, I'll plan on merging in a day or so. |
OK, merging this... |
Description
This restores the behavior of setting a non-default keyword value for a Model function argument when creating a Model. That is, in 1.3.0,
could sometimes fail to set the form to
erf
. This is true inStepModel
, for example, as it set the independent variables to ['x'].The fix here is sort of "belt and suspenders" in that: the form above should normally work in 1.3.0, but now that new default value (held in
Model.opts = {'form': 'erf'}
) is used, and then any independent variables are set, and then any runtime keyword arguments.See #947
Not being able to leave well enough alone, I also tweaked
Model.__repr__()
to useModel._reprsting()
and to uselong=True
by default. With this, for example, the repr forStepModel
will always show theform
.This can be squashed-and-merged or the repr string change can be removed.
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.3.0.post2+gcf2626b.d20240407, scipy: 1.12.0, numpy: 1.26.4, asteval: 0.9.32, uncertainties: 3.1.7
Verification
Have you