Bug #1088

xcorr with "-nointerp" gives random wrong results

Added by Hao 7 months ago.

Status:NewStart date:2017-05-01
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Affected version:all Platform:

Description

Sometimes xcorr gives weird result like this:

$ xcorr IMG-HH-ALPSRP207600640-H1.0__A.PRM IMG-HH-ALPSRP227730640-H1.0__A.PRM -xsearch 64 -ysearch 64 -nx 2 -ny 2 -nointerp -norange
......
$ cat freq_xcorr.dat
 4624 -163.000 9344 108.000   5.78       
 6808 -87.000 9344 44.000   8.99                            
 4624 512586170476003328.000 18432 97.000   8.47     
 6808 -110.000 18432  9.000  12.69

After debugging the code, I think the cause is uninitialized xc.loc[iloc].xfrac and yfrac variable. xfrac and yfrac are set in do_highres_corr, but the function is skipped when running xcorr with "-nointerp" argument.

I add following code to get_locations function in order to zero xc.loc struct:

memset(xc->loc, 0, xc->nyl*(xc->nxl+1)*sizeof(struct locs));

Weird results now disappear:

$ xcorr IMG-HH-ALPSRP207600640-H1.0__A.PRM IMG-HH-ALPSRP227730640-H1.0__A.PRM -xsearch 64 -ysearch 64 -nx 2 -ny 2 -nointerp -norange
......
$ cat freq_xcorr.dat
 4624 -163.000 9344 108.000   5.78 
 6808 -87.000 9344 44.000   8.99 
 4624 -120.000 18432 97.000   8.47 
 6808 -110.000 18432  9.000  12.69

Also available in: Atom PDF