Retain default values for keyword arguments when manually choosing param_names #919
Replies: 4 comments 3 replies
-
@schtandard I would say that this is intended behavior. Yes, when explicitly stating the names of the parameters with It is not clear to me why you need to explicitly name the Parameters. Perhaps you meant to set the names of the independent variables (non-Parameters) instead, as with:
as described at https://lmfit.github.io/lmfit-py/model.html#explicitly-specifying-independent-vars Also, just to be clear: if you raise an Issue and erase all of the starting Template again, including the part that says
we will certainly will close the issue and not engage with you further. |
Beta Was this translation helpful? Give feedback.
-
@schtandard Well if your model sometimes wants to vary
or
You know, explicit and not ugly. ;)
.... or changing the signature to have a sensible numerical value for |
Beta Was this translation helpful? Give feedback.
-
Is the ruling that this is intended behavior and a change is not desired? Or is it merely not a priority but a PR would be accepted? It seems like an easy change (and fully backwards compatible) so I would give it a shot, but only if the effort is not doomed from the start. |
Beta Was this translation helpful? Give feedback.
-
@schtandard I think it is highly unusual to explicitly set I sort of think it is more likely that you got to a point where you thought you needed to set |
Beta Was this translation helpful? Give feedback.
-
Description
I assume that the current behavior is intended, so I consider this a feature request.
By default, all model function arguments are turned into model parameters unless they are an independent variable or they have a non-numeric default value. Those arguments with a default value get turned into parameters with that as their initial value. However, when explicitly choosing the parameters using
param_names
, this stops being true and one has to set all initial values manually which feels redundant.It would be really nice if the initial values were derived from the default argument values even when using
param_names
.A Minimal, Complete, and Verifiable example
Output:
Version information
Beta Was this translation helpful? Give feedback.
All reactions