Changeset 731 for trunk/src


Ignore:
Timestamp:
Mar 10, 2014, 1:03:20 PM (11 years ago)
Author:
sommeria
Message:

bug corrected in civ: log becomes imaginary in max correlation fit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/civ_series.m

    r724 r731  
    914914F=0;
    915915[npy,npx]=size(result_conv);
    916 
    917 % if (x <= (size(result_conv,1)-1)) && (y <= (size(result_conv,1)-1)) && (x >= 1) && (y >= 1)
    918     %the following 8 lines are copyright (c) 1998, Uri Shavit, Roi Gurka, Alex Liberzon, Technion ï¿œ Israel Institute of Technology
    919     %http://urapiv.wordpress.com
    920     peaky = y;
    921     if y <= npy-1 && y >= 1
    922         f0 = log(result_conv(y,x));
    923         f1 = real(log(result_conv(y-1,x)));
    924         f2 = real(log(result_conv(y+1,x)));
    925         peaky = peaky+ (f1-f2)/(2*f1-4*f0+2*f2);
    926     else
    927         F=-2; % warning flag for vector truncated by the limited search box
    928     end
    929     peakx=x;
    930     if x <= npx-1 && x >= 1
    931         f0 = log(result_conv(y,x));
    932         f1 = real(log(result_conv(y,x-1)));
    933         f2 = real(log(result_conv(y,x+1)));
    934         peakx = peakx+ (f1-f2)/(2*f1-4*f0+2*f2);
    935     else
    936         F=-2; % warning flag for vector truncated by the limited search box
    937     end
    938     vector=[peakx-floor(npx/2)-1 peaky-floor(npy/2)-1];
     916result_conv(result_conv<1)=1; %set to 1 correlation values smaller than 1 (to avoid divergence in the log)
     917%the following 8 lines are copyright (c) 1998, Uri Shavit, Roi Gurka, Alex Liberzon, Technion ï¿œ Israel Institute of Technology
     918%http://urapiv.wordpress.com
     919peaky = y;
     920if y <= npy-1 && y >= 1
     921    f0 = log(result_conv(y,x));
     922    f1 = log(result_conv(y-1,x));
     923    f2 = log(result_conv(y+1,x));
     924    peaky = peaky+ (f1-f2)/(2*f1-4*f0+2*f2);
     925else
     926    F=-2; % warning flag for vector truncated by the limited search box
     927end
     928peakx=x;
     929if x <= npx-1 && x >= 1
     930    f0 = log(result_conv(y,x));
     931    f1 = log(result_conv(y,x-1));
     932    f2 = log(result_conv(y,x+1));
     933    peakx = peakx+ (f1-f2)/(2*f1-4*f0+2*f2);
     934else
     935    F=-2; % warning flag for vector truncated by the limited search box
     936end
     937vector=[peakx-floor(npx/2)-1 peaky-floor(npy/2)-1];
    939938
    940939%------------------------------------------------------------------------
     
    946945peaky=y;
    947946peakx=x;
     947result_conv(result_conv<1)=1; %set to 1 correlation values smaller than 1 (to avoid divergence in the log)
    948948[npy,npx]=size(result_conv);
    949949if (x <= npx-1) && (y <= npy-1) && (x >= 1) && (y >= 1)
Note: See TracChangeset for help on using the changeset viewer.