[SciPy-dev] New coding style (docstrings) : question

dmitrey openopt at ukr.net
Mon Aug 6 13:10:31 EDT 2007


Hi all,
I try to rewrite scipy.optimize docstrings (as well as openopt ones) in 
new docstrings standard.
(it was assigned to my GSoC milestones)
So please take a look at the example below - is all correct?
Especially I'm interested in func handlers - are they need any type 
describer?
(see those 1 line above and some lines below of line
x0 : ndarray -- the initial guess
)

Regards, D.

def fmin(func, x0, args=(), xtol=1e-4, ftol=1e-4, maxiter=None, maxfun=None,
         full_output=0, disp=1, retall=0, callback=None):
    """Minimize a function using the downhill simplex algorithm.
    :Parameters:

      func -- the Python function or method to be minimized.
      x0 : ndarray -- the initial guess.
      args -- extra arguments for func.
      callback -- an optional user-supplied function to call after each
                  iteration.  It is called as callback(xk), where xk is the
                  current parameter vector.

    :Returns: (xopt, {fopt, iter, funcalls, warnflag})

      xopt : ndarray -- minimizer of function

      fopt : number -- value of function at minimum: fopt = func(xopt)
      iter : number -- number of iterations
      funcalls : number-- number of function calls
      warnflag : number -- Integer warning flag:
                  1 : 'Maximum number of function evaluations.'
                  2 : 'Maximum number of iterations.'
      allvecs : Python list -- a list of solutions at each iteration

    :OtherParameters:

      xtol : number -- acceptable relative error in xopt for convergence.
      ftol : number -- acceptable relative error in func(xopt) for 
convergence.
      maxiter : number -- the maximum number of iterations to perform.
      maxfun : number -- the maximum number of function evaluations.
      full_output : number -- non-zero if fval and warnflag outputs are 
desired.
      disp : number -- non-zero to print convergence messages.
      retall : number -- non-zero to return list of solutions at each 
iteration

    :SeeAlso:

      fmin, fmin_powell, fmin_cg,
             fmin_bfgs, fmin_ncg -- multivariate local optimizers
      leastsq -- nonlinear least squares minimizer

      fmin_l_bfgs_b, fmin_tnc,
             fmin_cobyla -- constrained multivariate optimizers

      anneal, brute -- global optimizers

      fminbound, brent, golden, bracket -- local scalar minimizers

      fsolve -- n-dimenstional root-finding

      brentq, brenth, ridder, bisect, newton -- one-dimensional root-finding

      fixed_point -- scalar fixed-point finder
      
    Notes
    -----
      Uses a Nelder-Mead simplex algorithm to find the minimum of function
      of one or more variables.
      """



More information about the SciPy-Dev mailing list