def fit(self, x, y, dcoef='<STR_LIT:none>'):
self.x = x<EOL>self.y = y<EOL>if dcoef is not '<STR_LIT:none>':<EOL><INDENT>coef = dcoef<EOL><DEDENT>else:<EOL><INDENT>coef = self.coef<EOL><DEDENT>fcoef=optimize.leastsq(self.residual,coef,args=(y,self.func,x))<EOL>self.fcoef = fcoef[<NUM_LIT:0>].tolist()<EOL>return fcoef[<NUM_LIT:1>]<EOL>
performs the fit

x, y : list
    Matching data arrays that define a numerical function y(x),
    this is the data to be fitted.
dcoef : list or string
    You can provide a different guess for the coefficients, or
    provide the string 'none' to use the inital guess.  The
    default is 'none'.

Returns
-------
ierr
    Values between 1 and 4 signal success.

Notes
-----
self.fcoef, contains the fitted coefficients.