FUNCTION DI_VISDarkFitModel, X, A, dP ;;----------------------------------------------------------------------------- ;; PURPOSE: ;; Function that defines the fitting model for VIS DI images. This will ;; be called by the MPFITFUN function and conforms to the inputs and ;; outputs needed by that function. The model for VIS images is: ;; ;; ;;Dark(I,B) = A0*I + exp(A1 + A2/B) + A3 ;; ;;Dark(I,B) = A0*I*exp(A1*B) + A2 ;; Dark(I,B) = A0*I + exp(A1+A2*B) + A3 ;; ;; Where: ;; A[0..n-1] - Parameters of fitting model ;; I - Integration time (INTTIME) ;; B - Bench Temperature (IMGH051) ;; ;; CALLING SEQUENCE: ;; RETURN = DI_VISDarkFitModel, X, A, dP ;; ;; REQUIRED INPUTS: ;; X - Matrix of dark frame parameters to evaluate the model at. Each ;; column is a different point and the rows are [I,B] ;; A - Array of the model parameters ;; ;; OUTPUTS: ;; RETURN - Array of the function evaluated at all X ;; dP - Matrix of rows where each row is the partial derivative of the ;; function at X with respect to the parameters in A ;; ;; EXAMPLE: ;; IDL> Y = DI_VISDarkFitModel(X, A) ;; ;; PROCEDURES USED (i.e. called directly!): ;; ;; MODIFICATION HISTORY: ;; 2004-06-08 M. Desnoyer Created ;; ;;----------------------------------------------------------------------------- ;; Calculate some intermediate values ;tmp = exp(A[1]+A[2]/X[*,1]) ;tmp = X[*,0]*exp(A[1]*X[*,1]) tmp = exp(A[1]+A[2]*X[*,1]) n = (SIZE(X,/DIMENSIONS))[0] ;; Calculate the gradient ;dp = [[X[*,0]],[tmp],[tmp/X[*,1]], [intarr(n)+1]] ;dp = [[tmp],[tmp*A[0]*X[*,1]],[intarr(n)+1]] dp = [[X[*,0]],[tmp],[tmp*X[*,1]], [intarr(n)+1]] ;; Calculate the model value ;RETURN, A[0]*X[*,0]+tmp+A[3] ;RETURN, A[0]*tmp + A[2] RETURN, A[0]*X[*,0]+tmp+A[3] END