[SciPy-User] SciPy-User Digest, Vol 109, Issue 68

Moore, Eric (NIH/NIDDK) [F] eric.moore2@nih....
Fri Sep 28 08:00:42 CDT 2012


> -----Original Message-----
> From: Robaula [mailto:helmrp@yahoo.com]
> Sent: Thursday, September 27, 2012 6:19 PM
> To: scipy-user@scipy.org
> Subject: Re: [SciPy-User] SciPy-User Digest, Vol 109, Issue 68
> 
> 
> 
> Bob & Paula H
> 
> On Sep 27, 2012, at 1:39 PM, scipy-user-request@scipy.org wrote:
> 
> > Message: 4
> > Date: Thu, 27 Sep 2012 16:14:40 -0400
> > From: "Moore, Eric (NIH/NIDDK) [F]" <eric.moore2@nih.gov>
> > Subject: Re: [SciPy-User] Flaws in fmin_cobyla
> > To: "scipy-user@scipy.org" <scipy-user@scipy.org>
> > Message-ID:
> >    <A18C9F980755B44182031BAB3D1AA0A80457AF9BAA@NIHMLBX15.nih.gov>
> > Content-Type: text/plain; charset="us-ascii"
> 
> .......snip.......
> 
> > The various data produced by fmin_cobyla routine are printed using a
> direct call to PRINT from within the fortran routine. This is less than
> optimal because if you are not running in a terminal (ie, at python, or
> ipython) you won't see any of the output.
> >
> > So try executing the example or changing the disp parameter while
> running from the console, and they will work as expected.
> >
> > I'd say this is a big gotcha that should be noted in the docs at
> least.  The better choice would really be to patch cobyla2.f so that
> this would work even in the ipython qtconsole or wherever Bob is
> running his code.
> >
> > If there really is something to line 165
> (https://github.com/scipy/scipy/blob/master/scipy/optimize/cobyla.py#L1
> 65) it's not obvious to me.  Could you elaborate?
> >
> > Eric
> 
> Thanks! This explains a lot of this "now you see it, now you don't"
> business. FYI, I haven't even seen a terminal in the last 25-30 years.
> I'm retired with no access to any commercial or academic support, and
> running on a Gateway desktop under Windows 7 and the latest Python
> 2.7.x and NumPy/SciPy versions. So I'd love to have a sentence or two
> from you noting the difference in returns depending on whether console
> is being used or not. I'd like to use them in my prospective revision
> of fmin_cobyla's docstring.
> 
> Wonder how many other SciPy wrapped-Fortran programs have the same
> behavior?
> 
> Well, I think it's line number 165. Whatever the right number, it's the
> return command from "def fmin_cobyla". That line says to return from
> fmin_cobyla the Results stuff it got from fmin_cobyla's call to
> _minimize_cobyla. But -- when you find it, pay close attention to it's
> last five characters, which are ['x']. Those five characters pick out
> just the part of the Results dictionary that corresponds to the key
> 'x', I.e., the final value of the argument of the objective function.
> One "fix" would be to modify the return statement to return just the
> argument, and to return all of the Results stuff otherwise. OTOH, Ralf
> Gommers might properly object on the grounds of it's effect on existing
> code.
> 
> As far as "gotcha", well, it certainly got me! Again, thanks for your
> astute observations!
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

I suppose I should have been clearer.  I don't mean a hardware terminal. I mean a terminal emulator running on your computer.  So for windows 7, run cmd.exe, and execute python.exe, which if it isn't in your path, will likely be c:\Python27\python.exe.  My tests were done with scipy 0.9 on windows 7, but there is no reason to think that this isn't still true with newer versions of scipy.

Eric


More information about the SciPy-User mailing list