31 |
integer npoints !fit number of points |
integer npoints !fit number of points |
32 |
real dep(npoints),indep(npoints) !dependent and independent variables |
real dep(npoints),indep(npoints) !dependent and independent variables |
33 |
|
|
34 |
c real angle(npoints) !angle between the tangent line in the input points and |
real angle(npoints) !angle between the tangent line in the input points and |
|
c ! the independent variable axis |
|
|
c real residual(npoints) !residuals |
|
|
c real chi !sum of squared residuals |
|
|
c real xc,zc,radius !circle parameters |
|
|
double precision angle(npoints) !angle between the tangent line in the input points and |
|
35 |
! the independent variable axis |
! the independent variable axis |
36 |
double precision residual(npoints) !residuals EM GCC4.7 |
|
37 |
double precision chi !sum of squared residuals EM GCC4.7 |
real residual(npoints) !residuals |
38 |
double precision xc,zc,radius !circle parameters EM GCC4.7 |
real chi !sum of squared residuals |
39 |
|
real xc,zc,radius !circle parameters |
40 |
|
|
41 |
integer eflag !error flag =1 if the procedure fails |
integer eflag !error flag =1 if the procedure fails |
42 |
|
|
51 |
integer ifail !=-1 if singular matrix error, =0 if not singular |
integer ifail !=-1 if singular matrix error, =0 if not singular |
52 |
integer jfail !=0 if determinant can be evaluated, =-1 if determinat is probably too small, =+1 if too large |
integer jfail !=0 if determinant can be evaluated, =-1 if determinat is probably too small, =+1 if too large |
53 |
|
|
54 |
integer ibig ! EM GCC4.7 |
parameter (ibig=10000) !just a number greater than C(npoints,3) !EM GCC4.7 |
|
c parameter (ibig=1.e4) !just a number greater than C(npoints,3) |
|
|
parameter (ibig=10000) !just a number greater than C(npoints,3) EM GCC 4.7 |
|
55 |
double precision xxc(ibig),zzc(ibig),rrr(ibig) !centres and radii to be averaged |
double precision xxc(ibig),zzc(ibig),rrr(ibig) !centres and radii to be averaged |
56 |
|
|
57 |
double precision tmp1,tmp2,tmp(npoints) !temp variables |
double precision tmp1,tmp2,tmp(npoints) !temp variables |
296 |
zc=0. |
zc=0. |
297 |
radius=0. |
radius=0. |
298 |
do i=1,k |
do i=1,k |
299 |
xc=xc+xxc(i) |
xc=xc+REAL(xxc(i)) !EM GCC4.7 |
300 |
zc=zc+zzc(i) |
zc=zc+REAL(zzc(i)) !EM GCC4.7 |
301 |
radius=radius+rrr(i) |
radius=radius+REAL(rrr(i)) !EM GCC4.7 |
302 |
enddo |
enddo |
303 |
xc=xc/k * scale !back to micrometers |
xc=xc/k * scale !back to micrometers |
304 |
zc=zc/k * scale |
zc=zc/k * scale |
335 |
else |
else |
336 |
tmp(i)=-tmp1 |
tmp(i)=-tmp1 |
337 |
endif |
endif |
338 |
residual(i)=tmp2 - tmp(i) |
residual(i)=REAL(tmp2 - tmp(i)) !EM GCC4.7 |
339 |
chi=chi + residual(i)**2. |
chi=chi + residual(i)**2. |
340 |
c print*,dep(i) !??? |
c print*,dep(i) !??? |
341 |
c print*,indep(i) !??? |
c print*,indep(i) !??? |
347 |
c independent variable axis |
c independent variable axis |
348 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
349 |
do i=1,npoints |
do i=1,npoints |
350 |
angle(i)=(zc-indep(i)) / tmp(i) |
angle(i)=REAL((zc-indep(i)) / tmp(i)) !EM GCC4.7 |
351 |
angle(i)=ATAN(angle(i)) !-pi/2 <= angle <= pi/2 |
angle(i)=ATAN(angle(i)) !-pi/2 <= angle <= pi/2 |
352 |
angle(i)=angle(i)/pigr*180. |
angle(i)=angle(i)/pigr*180. |
353 |
enddo |
enddo |