title: __init__ got an unexpected keyword argument
body: <p>I'm trying to run this script for chemistry research.</p>
  
  <p>In case I didn't copy the script correctly here's the link to download the files:<br>
  <a href="http://pubs.acs.org/doi/suppl/10.1021/acs.analchem.5b02258" rel="nofollow">http://pubs.acs.org/doi/suppl/10.1021/acs.analchem.5b02258</a></p>
  
  <p>This instruction may be helpful:</p>
  
  <blockquote>
    <p>"fsolve_withPT.py takes two command line arguments: input file name of “MamPol2_titration_data.txt” and
    output file name of “Kaps_result.txt”"</p>
  </blockquote>
  
  <p>When I run the script on ipython I get this error message:<br>
  <code>__init__() got an unexpected keyword argument 'step_max'</code></p>
  
  <pre><code>#University of California San Francisco
  #Supplemental for
  #
  #A model for specific and nonspecific binding of ligand to multi-protein
  #complexes by native mass spectrometry
  #
  #Shenheng Guan, et al
  #2015
  #
  
  import sys
  import math
  import numpy
  import warnings
  from scipy.optimize import fsolve,fmin
  import matplotlib.pyplot as plt
  warnings.filterwarnings('ignore')
  
  input_fn='MamPol2_titration_data.txt'
  output_fn='Kaps_result1.txt'
  ##input_fn=sys.argv[1]
  ##output_fn=sys.argv[1]
  
  fid=open(input_fn,'r')
  line=fid.readline()
  line=line.strip('\n')
  no_mam=[float(x) for x in line.split('\t')[1:]]
  line=fid.readline()
  data=[]
  conc=[]
  for line in fid:
  line=line.strip('\n')
  tmp0=line.split('\t')
  conc.append(float(tmp0[0]))
  tmp1=[float(x) for x in tmp0[1:]]
  data.append(tmp1)
  fid.close()
  
  class fsolve_withPT:
      def __init__(self,conc,data):
          self.conc = conc
          self.data = data
  
      def ff(self, x, Kas, LT, PT):#x[0]:[P];x[1]:[PL]...;x[n]:[PLn];x[-1]:[L] n+2 (10)
          fc=[]
          for j in range(0,len(x)-2):#setup equilibrium equations
              fc.append(Kas[j]*x[j]*x[-1]-x[j+1])
  
          #mass conservation for P
          tmpP=0.0#[P]
          for j in range(0,len(x)-1):#x[0] to x[8] or [P] to [PL8]
              tmpP=tmpP+x[j]
          fc.append(tmpP-PT)#PT equals to all P species combined
  
          #mass conservation for L
          tmpL=x[-1]#[L]
          for j in range(1,len(x)-1):
              tmpL=tmpL+j*x[j]
          fc.append(tmpL-LT)
  
          return fc
  
      def error(self,w):
          Kas=w[:-1]
          PT=w[-1]
          mySum=0.0
          for m in range(0,len(self.conc)):#over conc (LT)
              #print Kas,self.conc[m],PT
              F=fsolve(self.ff, [1.0]*10, args=(Kas, self.conc[m], PT))
              myPT=sum(F[:-1])
              for k in range(0, len(no_mam)):#over # of Mam
                  mySum=mySum+(F[k]/myPT-self.data[m][k])**2
          return mySum
  
  w0=[8,7,6,5,4,3,2,1,0]
  w0=numpy.array(w0)
  w0=w0*3.01e4
  w0[-1]=5.e-6
  
  myFclass=fsolve_withPT(conc,data)
  
  w, fopt, iter, funcalls, warnflag  = fmin(myFclass.error, w0, maxiter=2000,
                                        maxfun=2000, full_output=True,disp=True)
  
  # http://nullege.com/codes/show/src@n@u@Numdifftools-0.6.0@numdifftools@speed_comparison@run_benchmarks.py/73/numdifftools.Hessian
  import numdifftools as nd
  #my_step_nom=[1.0e3]*8+[1.0e-6]*1
  my_step_nom=w#*1.0e-3
  hessian = nd.Hessian(myFclass.error,step_max=1.0e-2,step_nom=my_step_nom)#, step_max=1.0, step_nom=numpy.abs(w))
  H = hessian(w)
  covH=numpy.linalg.inv(H)
  
  conc0=conc#numpy.linspace(0.0,6.0E-05,num=101).tolist()
  y0=[]
  for tmp in conc0:
  F=fsolve(myFclass.ff, [1.0]*10, args=(w[:-1], tmp,w[-1]))
  y0.append(F)
  #y0=myFunc(conc0,w)
  
  fid=open(output_fn,'w')
  fid.write('Calculated complex conc. (M)\t'+str(w[-1])+'\n')
  fid.write('# of Mam in Complex\t')
  for j in no_mam:
      fid.write(str(j)+'\t')
      fid.write('\n')
      fid.write('Associate constants (Kas)\t\t')
  for j in no_mam[:-1]:
      fid.write(str(w[j])+'\t')
      fid.write('\n')
      fid.write('Mam Conc. (M)\tSimulated abundances\n')
  for k in range(0,len(y0)):
      fid.write(str(conc0[k])+'\t')
      yc=y0[k]
  tmp=sum(yc[:-1])
  for j in range(0,len(yc)-2):
      fid.write(str(yc[j]/tmp)+'\t')
  fid.write(str(yc[-2])+'\n')
  fid.close()
  
  from scipy import stats
  SS=fopt
  DF=len(data)*len(data[0])-len(w)
  t_factor=stats.t.ppf(0.95, DF)
  
  SE=[]
  dw=[]
  
  for j in range(0,len(w)):
      SE.append(numpy.sqrt(SS/DF*numpy.abs(covH[j,j])))
  for j in range(0,len(w)):
      dw.append(SE[j]*t_factor)
  </code></pre>