FUNCTION DUSTEM_CHI2, y, model, npar, err=err; returns the chi-square value of fit MODEL to data Y;; NPAR (I): nr of parameters in the fit; ERR (I): error of each data point. DefaultisERR=0.1*Y ny = n_elements(y)if n_elements(err) EQ 0OR TOTAL(err) EQ 0then beginerr = 0.1*y print,'(W) CHI2: error missing, set to 10 %' endif ndof = ny - npar ; nr of degrees of freedom chi = TOTAL( ((y-model)/err)^2 )if ndof GT 0then chi = chi / ndof return, chiEND