-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Made change to address http://projects.scipy.org/scipy/ticket/1531 #92
Conversation
Now, if p0 is given and is scalar, it is recast as a numpy array with a size of 1.
The behavior for p0 scalar is not documented, and it will change with this patch. I like your change though, it's more robust and less magical (now you can specify The bug you're seeing though, is because |
Could you please also create a regression test for your fix? |
I am fairly new to this, and I honestly have no idea what a regression test is. Is there is a good web resource that can explain it? I'll try to write something up that checks if 'self' is the first element of args. |
Hi, regression test is just a test that checks that the bug is fixed (so that it doesn't get reintroduced by accident). |
So do you mean that I need to create code that will fail if the bug gets reintroduced but continue to run correctly if the bug remains fixed? |
For the test, have a look at test_minpack.py in scipy/optimize/tests/. There's a class TestCurveFit to which you can add a new test. The test should fail without your fix, pass with it, and be as simple as possible. Perhaps the term "unit test" is more familiar to you. If not, it's worth learning about. There are tons of resources, google is your friend. The numpy/scipy testing guidelines are at https://github.com/numpy/numpy/blob/master/doc/TESTS.rst.txt |
Exactly, that's the point. Making sure that once it's fixed it stays fixed. |
Ok, I will do all that then. I'm a mechanical engineer so I'm barely familiar with computer science terminology. I've used SciPy enough that I feel obligated to make it better when I encounter a problem that I understand well enough to fix. |
Great, we appreciate it. If you run into problems let us know. By the way, if you add commits to your own git branch that you sent the pull request from they automatically show up here. |
Ralph, how can I check if |
test_minpack.py to do anything so I need some help with that.
Ralph, please take a look at my most recent commit. It's not handling the if statement that checks for |
Hi, your check for |
Pauli, can you please have a look at the change in behavior for scalar p0? Before it was possible to give a scalar initial guess for a function that takes multiple input parameters, and the guess would be expanded from This behavior was undocumented, and imho undesired. It raises an error now. |
FWIW: I never realized this undocumented behavior for a scalar p0, and I'm in favor of the change. |
OK, thanks Josef. Pushed. |
So this means my changes will go into the next release of SciPy, right? If so, yay, I'm glad I could contribute! |
Yes, it will be in SciPy 0.11.0, and you'll be listed as a contributing author in the release notes. Thanks again, and hope this won't be your last contribution:) |
Now, if p0 is given and is scalar, it is recast as a numpy array with a size of 1.