[Difx-users] difx2fits_pcal_20200619.patch

Jan Wagner jwagner105 at googlemail.com
Mon Jun 22 08:50:11 EDT 2020


Hi Leonid,

the original startTones[] fill out seems to be buggy, namely the
part with:

startTones[d+1] = startTones[d] + ct*D->datastream[mergedDsId].nRecBand;

Because not all recorded bands in each datastream are actually
utilized in NS r1948, the offsets startTones[] are incorrect, and
should be "tightened" up (skipping the padding-only bands) to solve
the issue.

Am looking into it.

regards,
Jan

Am 22.06.2020 um 05:17 schrieb Leonid Petrov via Difx-users:
> Dear collagues,
>   
>   Please find below a patch to difx2fits wrt trunk version of 
> 2020.06.12.
>
>   Difs2fits did not put phase-cal signal for NS station in IVS 
> experiment r1948. The experiment had 16 IFs: 10 at X band and 6
> at S-band. NS station recorded two datastreams: one for X-band
> and another for S-band. The first datastream had 16 IFs, the second
> ahd 8 IFs, but only low 10 IFs in the first datastream and 
> upper 6 IFs in the second datastream had data.
>
>   The full DiFX output for that experiment can be found in
> ftp://ftp.mpifr-bonn.mpg.de/outgoing/ykchoi/leonid/r1948_difxout.tgz
>
> Here is the exerpt from r1948_0001.difx/PCAL_58995_061200_NS
>
> NS 58995.7083381 0.0000095 4 16 32 8213 R  3.15575e-05  4.98256e-05 8214 R  9.30544e-05 -1.21763e-04 8215 R 
> NS 58995.7083381 0.0000095 5  8 32 2226 R -2.60000e-04 -1.42326e-04 2227 R -1.73795e-04 -2.58253e-04 2228 R 
>
> The old logic appended the record of the second datastream to the prior
> datastream. This did not work. The total number of extracted phase-cal tones
> was 31 and the output arrays were sized to 16*31=496, equal to the number
> of phase-cal tones found in the 1st datasteam, and as a result, the second 
> datastream was ignored.
>
>  I made a minor step: I forced the offset of the second datastreeam to be set 
> to zero if the total number of phase-calibration tones in the 1st 
> datastream is equal to total number of tones. I am confident that this fix will 
> not cause regressions, but I am less confident whether this is sufficient to cover
> other cases when phase cal is split between multiple datasets.
>
> Sincerely
> Leonid
> 2020.06.21_23:12:07
>
> =================================== Patch: =====================================
>
> --- applications/difx2fits/trunk/src/fitsPH.c~	2020-06-19 19:56:45.423005154 -0400
> +++ applications/difx2fits/trunk/src/fitsPH.c	2020-06-19 21:39:16.109417054 -0400
> @@ -981,6 +981,7 @@
>  	float pulseCalDeltaT[2][array_MAX_TONES];
>  	float stateCount[2][array_MAX_STATES*array_MAX_BANDS];
>  	float pulseCalRate[2][array_MAX_TONES];
> +	double pulseCalFrAcc[2][array_MAX_TONES];
>  	int configId = -1;
>  	int sourceId = -1;
>  	int scanId;
> @@ -1224,6 +1225,9 @@
>  
>  					exit(EXIT_FAILURE);
>  				}
> +                                if ( d > 0 && startTones[d] == nTone*nBand ){
> +				     startTones[d] = 0 ;
> +                                }
>  			}
>  
>  			if(nt > maxDifxTones)
> @@ -1251,6 +1255,7 @@
>  		{
>  			for(t = 0; t < array_MAX_TONES; ++t)
>  			{
> +				pulseCalFrAcc[k][t] = 0.0;
>  				pulseCalReAcc[k][t] = 0.0;
>  				pulseCalImAcc[k][t] = 0.0;
>  				pulseCalDeltaT[k][t] = 0.0;
> @@ -1667,7 +1672,7 @@
>  							{
>  								if(pulseCalReAcc[k][l] == 0.0 && pulseCalImAcc[k][l] == 0.0)
>  								{
> -									freqs[k][l] = nan.d;
> +									pulseCalFrAcc[k][l] = nan.d;
>  									pulseCalReAcc[k][l] = nan.f;
>  									pulseCalImAcc[k][l] = nan.f;
>  									pulseCalRate[k][l] = nan.f;
> @@ -1677,7 +1682,7 @@
>  							FITS_WRITE_ARRAY(stateCount[k], p_fitsbuf, 4*nBand);
>  							if(nTone > 0)
>  							{
> -								FITS_WRITE_ARRAY(freqs[k], p_fitsbuf, nTone*nBand);
> +								FITS_WRITE_ARRAY(pulseCalFrAcc[k], p_fitsbuf, nTone*nBand);
>  								FITS_WRITE_ARRAY(pulseCalReAcc[k], p_fitsbuf, nTone*nBand);
>  								FITS_WRITE_ARRAY(pulseCalImAcc[k], p_fitsbuf, nTone*nBand);
>  								FITS_WRITE_ARRAY(pulseCalRate[k], p_fitsbuf, nTone*nBand);
> @@ -1718,6 +1723,7 @@
>  					{
>  						for(t = 0; t < nTone*D->datastream[currentDsId].nRecFreq; ++t)
>  						{
> +						        if ( freqs[k][t] > 0.0 ) pulseCalFrAcc[k][t] = freqs[k][t];
>  							pulseCalReAcc[k][t+startTone] += pulseCalRe[k][t];
>  							pulseCalImAcc[k][t+startTone] += pulseCalIm[k][t];
>  							pulseCalDeltaT[k][t] += D->config[configId].tInt;
>
> _______________________________________________
> Difx-users mailing list
> Difx-users at listmgr.nrao.edu
> https://listmgr.nrao.edu/mailman/listinfo/difx-users




More information about the Difx-users mailing list