Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Hi guys! the goal of my work should be to show, as a result, a multicolor map about 2D matrix within each pixel's value is the percentage fitting error obtained by: 100*(SQRT((TOTAL(yCurr-yfit))^2 /yCurr)) where yCurr and yfit are two curves within nested-for loops. Each pixel has a different error but my final map is monochrome….that meaning it's completely wrong! Where are the mistakes? this is my code, thanks in advance FORWARD_FUNCTION muskfunct, X, A t=TR/NSrr t=t*frm x=t num_x=N_ELEMENTS(x) ERR=FLTARR(num_x) w=FLTARR(num_x) w[*]=1.0 PARINFO=replicate({value:0.D, fixed:0, limited:[0,0], limits:[0.D,0]}, 3) parinfo[0].limited(*) = [1,1] ;S0 limits(S0>0) parinfo[0].limits[0] = 0.0 parinfo[0].limits[1] = 1000.0 parinfo[1].limited(*) = [1,1] ;0<f<1 parinfo[1].limits[0] = 0.5 parinfo[1].limits[1] = 1.0 parinfo[2].limited(*) = [1,1] ;T1 limits(T1>100) parinfo[2].limits[0] = 100 parinfo[2].limits[1] = 4000.0 A0=[60.0, 1.0, 1000.0] parinfo[*].value = A0 T1map=FLTARR(dx,dy) FitErrMap=FLTARR(dx,dy) fitErrors=FLTARR(num_x) T1values=FLTARR(num_x) S0values=FLTARR(num_x) fValues=FLTARR(num_x) for i=0,dx-220 do begin for j=0,dy-220 do begin y=REFORM(Im_final1[i,j,*],num_x) for t=0,num_x-1 do begin T0=t yCurr=y IF (t ne 0 ) THEN yCurr[0:T0]=-y[0:T0] A0=[y(num_x-1), 1.0, 1000.0] A=mpfitfun('maskfunct',x, yCurr, ERR, A0, PARINFO=parinfo, WEIGHTS=w,YFIT=yfit, BESTNORM=error,/QUIET) fitErrors[t]=error S0values[t]=A[0] fvalues[t]=A[1] T1values[t]=A[2] yCurrT=TOTAL(yCurr[0:num_x-1]) yfitT=TOTAL(yfit[0:num_x-1]) endfor min=MIN(fitErrors,idmin) T1 = T1values[idmin] f=fvalues[idmin] S0=S0values[idmin] yfit=maskfunct(x,[S0,f,T1]) T1map[i,j]=T1 RMSE=100.*sqrt(((yCurrT-yfitT)^2)/yCurrT) FitErrMap[i,j]=RMSE endfor endfor iimage, T1map, TITLE='T1map' stop1=systime(1) iimage, FitErrMap, RGB_TABLE=39, TITLE='FitError map'