[Difx-users] pcal_200213 bug in difx2fits

Jan Wagner jwagner105 at googlemail.com
Fri Feb 14 11:12:07 EST 2020


Hi all,

in addition to dd->phaseCalIntervalMHz there ought to be
dd->phaseCalBaseMHz available that I added two(?) years ago.

It reflects the VEX 1.5 $IF block element "P-cal base freq". It
allows to describe up-mixed PCal comb generator output. For example
Wettzell twin telescope was experimenting with shifting PCal of one
antenna by 500 kHz relative to the other antenna, to prevent tones
from dominating the visibility data on the very short baseline. Ny
Alesund could be a similar case.

Wettzell in the end chose to enable/disable PCal on alternate scans
(shifting was tricky), and made do without PCal for half the time.

If there is any anticipated use for VEX "P-cal base freq", then the
toneFreq0 calculation could perhaps be done in floating point? The
output array that holds the tone frequencies is already 'double'.
Similar calculations are already scattered through other parts of
DiFX iirc (in mpifxcorr definitely)...

regards,
Jan



Am 13.02.2020 um 21:37 schrieb harro verkouter via Difx-users:
> Hi all,
>
> Reading that patch I'm not convinced that randomly adding explicit
> "(int)" conversions is the proper fix.
> Looking at the difx_datastream.c code the intent of the
> "toneFreq0" variable is to hold the first integer multiple of the
> PCal frequency that falls within the actual datastream (subband,
> channel, observed band, chunk of sky frequency described).
>
> My suggestion would be something along the lines of:
>
>      toneFreq0 = (int)(( loFreq + dd->phaseCalIntervalMHz ) /
> dd->phaseCalIntervalMHz ) * dd->phaseCalIntervalMHz;
>
> Two birds with one stone:
> 1) the special case "if(toneFreq0) <= loFreq" can be removed as it
> will be dealt with automatically
> 2) only the first part of the computation needs to be converted to
> int (i.e. the rounding to an integer number of pcal tones); the
> multiplication will produce a double again, but the assignment to
> the integer "toneFreq0" will automatically truncate it again.
>
> Cheers,
> h
>
>
> On Thu, 13 Feb 2020 at 18:14, Leonid Petrov via Difx-users
> <difx-users at listmgr.nrao.edu <mailto:difx-users at listmgr.nrao.edu>>
> wrote:
>
>     Dear DiFXers,
>
>        pcal_200213 bug in difx2fits was found and fixed:
>
>     Synopsis:
>
>        Phase calibration frequencies in FITS-IDI are not
>     commensurate to the
>     phase
>     cal tone spacings and some frequencies are NaN if for the lower
>     frequency
>     of a given IF is no commensurate to the phase cal tone
>     spacings. Was
>     found
>     in VLBI experiment VT9259 with IF#1 LO Frequency 3448.4 MHz
>     and pcal
>     tone
>     spacings 5 MHz.
>
>     Severity:
>
>        Serious
>
>     Reason:
>
>        A trivial coding mistake
>
>     Patch:
>
>     --- libraries/difxio/difxio/difx_datastream.c~  2019-04-13
>     19:05:23.600324077 -0400
>     +++ libraries/difxio/difxio/difx_datastream.c   2020-02-13
>     11:28:46.109375671 -0500
>     @@ -342,7 +342,7 @@
>
>             if(df->sideband == 'U')
>             {
>     -               toneFreq0 = (((int)(loFreq)) /
>     dd->phaseCalIntervalMHz) *
>     dd->phaseCalIntervalMHz;
>     +               toneFreq0 = ( (int) loFreq  / (int)
>     dd->phaseCalIntervalMHz ) * (int)
>     dd->phaseCalIntervalMHz;
>                     if(toneFreq0 <= loFreq)
>                     {
>                             toneFreq0 += dd->phaseCalIntervalMHz;
>     @@ -350,7 +350,7 @@
>             }
>             else
>             {
>     -               toneFreq0 = (((int)(loFreq)) /
>     dd->phaseCalIntervalMHz) *
>     dd->phaseCalIntervalMHz;
>     +               toneFreq0 = ( (int) loFreq  / (int)
>     dd->phaseCalIntervalMHz ) * (int)
>     dd->phaseCalIntervalMHz;
>                     if(toneFreq0 == loFreq)
>                     {
>                             toneFreq0 -= dd->phaseCalIntervalMHz;
>
>
>     Leonid
>     2020.02.13_12:13:06
>
>     _______________________________________________
>     Difx-users mailing list
>     Difx-users at listmgr.nrao.edu <mailto:Difx-users at listmgr.nrao.edu>
>     https://listmgr.nrao.edu/mailman/listinfo/difx-users
>
>
> _______________________________________________
> Difx-users mailing list
> Difx-users at listmgr.nrao.edu
> https://listmgr.nrao.edu/mailman/listinfo/difx-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listmgr.nrao.edu/pipermail/difx-users/attachments/20200214/7f672c20/attachment-0001.html>


More information about the Difx-users mailing list