pro coma, r, a, f, pder f = a(0)*exp(-r/a(1))*(a(2)+a(3)*r+r^2) + a(4) pder = fltarr(n_elements(r), n_elements(a)) pder(*,0) = (f-a(4))/a(0) pder(*,1) = (f-a(4))*r/a(1)^2 pder(*,2) = a(0)*exp(-r/a(1)) pder(*,3) = a(0)*exp(-r/a(1))*r pder(*,4) = 1.0 return end pro exptl, xx, vec, init ;fit an exponential and a parabola to a profile. ;"init" contains the initial guesses. ;the function is y = a(0)*exp(-x/a(1))*(a(2)+a(3)*x+x^2) + a(4) resu = curvefit(xx, vec, findgen(n_elements(xx))*0.0+1.0, init, sigmaa, $ function_name='coma', chi2=chi2) print, init return end