<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi all, <br>
    <br>
    in addition to dd->phaseCalIntervalMHz there ought to be
    dd->phaseCalBaseMHz available that I added two(?) years ago. <br>
    <p>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.</p>
    <p>Wettzell in the end chose to enable/disable PCal on alternate
      scans (shifting was tricky), and made do without PCal for half the
      time.<br>
    </p>
    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)...<br>
    <p>regards,<br>
      Jan<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Am 13.02.2020 um 21:37 schrieb harro
      verkouter via Difx-users:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAAJ7RxEejNK2MbqO5+Vn4CxeRCsL5CZoVGw6FwVOCJsVYsm-Lg@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi all,
        <div><br>
        </div>
        <div>Reading that patch I'm not convinced that randomly adding
          explicit "(int)" conversions is the proper fix.</div>
        <div>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).</div>
        <div><br>
        </div>
        <div>My suggestion would be something along the lines of:</div>
        <div><br>
        </div>
        <div>     toneFreq0 = (int)(( loFreq +
          dd->phaseCalIntervalMHz ) / dd->phaseCalIntervalMHz ) *
          dd->phaseCalIntervalMHz;</div>
        <div><br>
        </div>
        <div>Two birds with one stone:</div>
        <div>1) the special case "if(toneFreq0) <= loFreq" can be
          removed as it will be dealt with automatically</div>
        <div>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.</div>
        <div><br>
        </div>
        <div>Cheers,</div>
        <div>h</div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Thu, 13 Feb 2020 at 18:14,
          Leonid Petrov via Difx-users <<a
            href="mailto:difx-users@listmgr.nrao.edu"
            moz-do-not-send="true">difx-users@listmgr.nrao.edu</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear
          DiFXers,<br>
          <br>
             pcal_200213 bug in difx2fits was found and fixed:<br>
          <br>
          Synopsis:<br>
          <br>
             Phase calibration frequencies in FITS-IDI are not
          commensurate to the <br>
          phase<br>
          cal tone spacings and some frequencies are NaN if for the
          lower <br>
          frequency<br>
          of a given IF is no commensurate to the phase cal tone
          spacings. Was <br>
          found<br>
          in VLBI experiment VT9259 with IF#1 LO Frequency 3448.4 MHz
          and pcal <br>
          tone<br>
          spacings 5 MHz.<br>
          <br>
          Severity:<br>
          <br>
             Serious<br>
          <br>
          Reason:<br>
          <br>
             A trivial coding mistake<br>
          <br>
          Patch:<br>
          <br>
          --- libraries/difxio/difxio/difx_datastream.c~  2019-04-13 <br>
          19:05:23.600324077 -0400<br>
          +++ libraries/difxio/difxio/difx_datastream.c   2020-02-13 <br>
          11:28:46.109375671 -0500<br>
          @@ -342,7 +342,7 @@<br>
          <br>
                  if(df->sideband == 'U')<br>
                  {<br>
          -               toneFreq0 = (((int)(loFreq)) /
          dd->phaseCalIntervalMHz) * <br>
          dd->phaseCalIntervalMHz;<br>
          +               toneFreq0 = ( (int) loFreq  / (int)
          dd->phaseCalIntervalMHz ) * (int) <br>
          dd->phaseCalIntervalMHz;<br>
                          if(toneFreq0 <= loFreq)<br>
                          {<br>
                                  toneFreq0 +=
          dd->phaseCalIntervalMHz;<br>
          @@ -350,7 +350,7 @@<br>
                  }<br>
                  else<br>
                  {<br>
          -               toneFreq0 = (((int)(loFreq)) /
          dd->phaseCalIntervalMHz) * <br>
          dd->phaseCalIntervalMHz;<br>
          +               toneFreq0 = ( (int) loFreq  / (int)
          dd->phaseCalIntervalMHz ) * (int) <br>
          dd->phaseCalIntervalMHz;<br>
                          if(toneFreq0 == loFreq)<br>
                          {<br>
                                  toneFreq0 -=
          dd->phaseCalIntervalMHz;<br>
          <br>
          <br>
          Leonid<br>
          2020.02.13_12:13:06<br>
          <br>
          _______________________________________________<br>
          Difx-users mailing list<br>
          <a href="mailto:Difx-users@listmgr.nrao.edu" target="_blank"
            moz-do-not-send="true">Difx-users@listmgr.nrao.edu</a><br>
          <a href="https://listmgr.nrao.edu/mailman/listinfo/difx-users"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://listmgr.nrao.edu/mailman/listinfo/difx-users</a><br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Difx-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Difx-users@listmgr.nrao.edu">Difx-users@listmgr.nrao.edu</a>
<a class="moz-txt-link-freetext" href="https://listmgr.nrao.edu/mailman/listinfo/difx-users">https://listmgr.nrao.edu/mailman/listinfo/difx-users</a>
</pre>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>