Index: trunk/src/series/civ_series.m
===================================================================
--- trunk/src/series/civ_series.m	(revision 1158)
+++ trunk/src/series/civ_series.m	(revision 1160)
@@ -952,5 +952,5 @@
 %  .DVDY
 
-function [xtable,ytable,utable,vtable,ctable,F,result_conv,errormsg] = civ (par_civ)
+function [xtable,ytable,utable,vtable,ctable,FF,result_conv,errormsg] = civ (par_civ)
 
 %% prepare measurement grid
@@ -972,5 +972,4 @@
     par_civ.Grid(:,2)=reshape(GridY,[],1);% increases with array index
     % 
-    % 
     % minix=floor(par_civ.Dx/2)-0.5;
     % maxix=minix+par_civ.Dx*floor((par_civ.ImageWidth-1)/par_civ.Dx);
@@ -1001,5 +1000,5 @@
 vtable=shifty;%zeros(nbvec,1);
 ctable=zeros(nbvec,1);
-F=zeros(nbvec,1);
+FF=zeros(nbvec,1);
 result_conv=[];
 errormsg='';
@@ -1058,5 +1057,5 @@
         iref=round(par_civ.Grid(ivec,1)+0.5);% xindex on the image A for the middle of the correlation box
         jref=round(par_civ.ImageHeight-par_civ.Grid(ivec,2)+0.5);%  j index  for the middle of the correlation box in the image A
-        F(ivec)=0;
+        FF(ivec)=0;
         subrange1_x=iref-ibx2:iref+ibx2;% x indices defining the first subimage
         subrange1_y=jref-iby2:jref+iby2;% y indices defining the first subimage
@@ -1078,5 +1077,5 @@
             sizemask=sum(sum(mask1_crop))/(numel(subrange1_y)*numel(subrange1_x));%size of the masked part relative to the correlation sub-image
             if sizemask > 1/2% eliminate point if more than half of the correlation box is masked
-                F(ivec)=1; %
+                FF(ivec)=1; %
                 utable(ivec)=NaN;
                 vtable(ivec)=NaN;
@@ -1092,12 +1091,12 @@
         end
         %threshold on image minimum
-        if F(ivec)~=1
+        if FF(ivec)==0
             if check_MinIma && (image1_mean < par_civ.MinIma || image2_mean < par_civ.MinIma)
-                F(ivec)=1;
+                FF(ivec)=1;
                 %threshold on image maximum
             elseif check_MaxIma && (image1_mean > par_civ.MaxIma || image2_mean > par_civ.MaxIma)
-                F(ivec)=1;
-            end
-            if F(ivec)==1
+                FF(ivec)=1;
+            end
+            if FF(ivec)==1
                 utable(ivec)=NaN;
                 vtable(ivec)=NaN;
@@ -1127,5 +1126,7 @@
                 sum_square=sum(sum(image1_crop.*image1_crop));
                 %reference: Oliver Pust, PIV: Direct Cross-Correlation
+                %%%%%% correlation calculation
                 result_conv= conv2(image2_crop,flip(flip(image1_crop,2),1),'valid');
+                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                 corrmax= max(max(result_conv));
                 result_conv=(result_conv/corrmax)*255; %normalize, peak=always 255
@@ -1138,9 +1139,9 @@
                     try
                         if par_civ.CorrSmooth==1
-                            [vector,F(ivec)] = SUBPIXGAUSS (result_conv,x,y);
+                            [vector,FF(ivec)] = SUBPIXGAUSS (result_conv,x,y);
                         elseif par_civ.CorrSmooth==2
-                            [vector,F(ivec)] = SUBPIX2DGAUSS (result_conv,x,y);
+                            [vector,FF(ivec)] = SUBPIX2DGAUSS (result_conv,x,y);
                         else
-                            [vector,F(ivec)] = quadr_fit(result_conv,x,y);
+                            [vector,FF(ivec)] = quadr_fit(result_conv,x,y);
                         end
                         utable(ivec)=vector(1)*mesh+shiftx(ivec);
@@ -1154,13 +1155,13 @@
                             utable(ivec)=0;
                             vtable(ivec)=0;
-                            F(ivec)=1;
+                            FF(ivec)=1;
                         end
                         ctable(ivec)=corrmax/sum_square;% correlation value
                     catch ME
-                        F(ivec)=1;
+                        FF(ivec)=1;
                         disp(ME.message)
                     end
                 else
-                    F(ivec)=1;
+                    FF(ivec)=1;
                 end
             end
@@ -1188,15 +1189,15 @@
 %http://urapiv.wordpress.com
 peaky = y;peakx=x;
-if y < npy && y > 1 && x < npx-1 && x > 1
-    f0 = log(result_conv(y,x));
-    f1 = log(result_conv(y-1,x));
-    f2 = log(result_conv(y+1,x));
-    peaky = peaky+ (f1-f2)/(2*f1-4*f0+2*f2);
-    f1 = log(result_conv(y,x-1));
-    f2 = log(result_conv(y,x+1));
-    peakx = peakx+ (f1-f2)/(2*f1-4*f0+2*f2);
-else
-    F=1; % warning flag for vector truncated by the limited search box
-end
+% if y < npy && y > 1 && x < npx-1 && x > 1
+%     f0 = log(result_conv(y,x));
+%     f1 = log(result_conv(y-1,x));
+%     f2 = log(result_conv(y+1,x));
+%     peaky = peaky+ (f1-f2)/(2*f1-4*f0+2*f2);
+%     f1 = log(result_conv(y,x-1));
+%     f2 = log(result_conv(y,x+1));
+%     peakx = peakx+ (f1-f2)/(2*f1-4*f0+2*f2);
+% else
+%     F=1; % warning flag for vector truncated by the limited search box
+% end
 
 vector=[peakx-floor(npx/2)-1 peaky-floor(npy/2)-1];
