Please help. Below is a script which is supposed to call some curve fitting function. However when I try to run it , it gives me the following errors:
Reading file: D:\Processing\Data\avoncasi1.bin
Compiled module: READ_BINARY.
READ_BINARY: READU: Error encountered reading from file. Unit: 100, File: D:\Mphil2006\Processing\Data\avoncasi1.bin
Error occurred at: READ_BINARY 132 D:\Processing\IDL\read_binary.pro
GAUSSIAN_GAUSS_FIT 9 D:\Processing\IDL\gaussian_gauss_fit.pro
$MAIN$
Execution halted at: GAUSSIAN_GAUSS_FIT 9 D:\Processing\IDL\gaussian_gauss_fit.pro
_________________________________________________________________________
PRO GAUSS_gauss_FIT
imageSize=[15,400,350]
imagecoefSize=[6,400,350]
filestr2 = '~Processing\Data\avoncasi1.bin'
PRINT, 'Reading file: ' + filestr2
OPENR, 1, filestr2
image1 = READ_BINARY(filestr1, DATA_TYPE=1, DATA_DIMS=imageSize)
CLOSE, 1
nx = 15 ;Size of array
ny = 1
imagecoeff = FLTARR(imagecoefSize)
X=[450.,490.,552.,608.,647.,670.,700.,710.,740.,750.,762.,780.,820.,865.,942.]
;P = [ 5., 10., nx/6., ny/10., nx/2., .6*ny] ;Input function parameters
A = [ 5., 10., nx/6., ny/10., nx/2., .6*ny]
FOR line=0, 400 DO BEGIN
FOR pixel=0, 350 DO BEGIN
y = REFORM(image1[*,pixel,line]) ;extract all bands for one pixel
yfit = MPFITPEAK(X, Y, A, NTERMS=6)
;yfit = gaussfit(x,y,a) ;Fit the function, no rotation
print, 'pixel ',string(pixel),', line', string(line)
print,'channels:',string(y,format='(6f10.4)') ;Report results..
print,'coefficients: :',string(a(0:5),format='(6f10.4)')
imagecoeff[*,pixel,line] = a(0:5)
ENDFOR
ENDFOR
filestr1 = '~Processing\Data\GaussCoeffnts.bin'
PRINT, 'Writing binary floating point output file: ' + filestr1
OPENW, 1, filestr2
WRITEU, 1, imagecoeff
CLOSE, 1
END
|