Ignore:
Timestamp:
09/25/09 11:47:11 (15 years ago)
Author:
Malte Marquarding
Message:

Update from livedata CVS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/external/atnf/PKSIO/MBFITSreader.cc

    r1452 r1635  
    2727//#                        AUSTRALIA
    2828//#
    29 //# $Id: MBFITSreader.cc,v 19.54 2008-11-17 06:51:55 cal103 Exp $
     29//# $Id: MBFITSreader.cc,v 19.55 2009-01-20 06:45:33 cal103 Exp $
    3030//#---------------------------------------------------------------------------
    3131//# The MBFITSreader class reads single dish RPFITS files (such as Parkes
     
    141141  int jstat = -3;
    142142  if (rpfitsin(jstat)) {
    143     sprintf(cMsg, "ERROR: failed to open MBFITS file\n       %s", rpname);
     143    sprintf(cMsg, "ERROR: Failed to open MBFITS file\n       %s", rpname);
    144144    logMsg(cMsg);
    145145    return 1;
     
    159159  jstat = -1;
    160160  if (rpfitsin(jstat)) {
    161     sprintf(cMsg, "ERROR: failed to read MBFITS header in file\n"
     161    sprintf(cMsg, "ERROR: Failed to read MBFITS header in file\n"
    162162                  "       %s", rpname);
    163163    logMsg(cMsg);
     
    205205
    206206  if (cNBeam <= 0) {
    207     logMsg("ERROR, couldn't determine number of beams.");
     207    logMsg("ERROR: Couldn't determine number of beams.");
    208208    close();
    209209    return 1;
     
    337337  // Read the first syscal record.
    338338  if (rpget(1, cEOS)) {
    339     logMsg("ERROR, failed to read first syscal record.");
     339    logMsg("ERROR: Failed to read first syscal record.");
    340340    close();
    341341    return 1;
     
    373373{
    374374  if (!cMBopen) {
    375     logMsg("ERROR, an MBFITS file has not been opened.");
     375    logMsg("ERROR: An MBFITS file has not been opened.");
    376376    return 1;
    377377  }
     
    515515
    516516  if (!cMBopen) {
    517     logMsg("ERROR, an MBFITS file has not been opened.");
     517    logMsg("ERROR: An MBFITS file has not been opened.");
    518518    return 1;
    519519  }
     
    588588          cXpolOff = new int[cNIF];
    589589
    590           int simulIF = 0;
    591590          int maxChan = 0;
    592591          int maxXpol = 0;
    593592
     593          cSimulIF = 0;
    594594          for (int iIF = 0; iIF < cNIF; iIF++) {
    595595            if (cIFs[iIF]) {
     
    617617
    618618              // Maximum number of selected IFs in any simultaneous set.
    619               simulIF = max(simulIF, cIFSel[iIF]+1);
     619              cSimulIF = max(cSimulIF, cIFSel[iIF]+1);
    620620
    621621              // Maximum memory required for any simultaneous set.
     
    644644
    645645          if (cNBin > 1 && cNBeamSel > 1) {
    646             logMsg("ERROR, cannot handle binning mode for multiple beams.");
     646            logMsg("ERROR: Cannot handle binning mode for multiple beams.\n"
     647                   "       Select a single beam for input.");
    647648            close();
    648649            return 1;
     
    657658          // Allocate memory for spectral arrays.
    658659          for (int ibuff = 0; ibuff < nBuff; ibuff++) {
    659             cBuffer[ibuff].setNIFs(simulIF);
     660            cBuffer[ibuff].setNIFs(cSimulIF);
    660661            cBuffer[ibuff].allocate(0, maxChan, maxXpol);
    661662
    662663            // Signal that this IF in this buffer has been flushed.
    663             for (int iIF = 0; iIF < simulIF; iIF++) {
     664            for (int iIF = 0; iIF < cSimulIF; iIF++) {
    664665              cBuffer[ibuff].IFno[iIF] = 0;
    665666            }
     
    679680          cCycleNo = 0;
    680681          cPrevUTC = -1.0;
     682        }
     683
     684        // Apply beam and IF selection before the change-of-day test to allow
     685        // a single selected beam and IF to be handled in binning-mode.
     686        beamNo = int(cBaseline / 256.0);
     687        if (beamNo == 1) {
     688          // Store the position of beam 1 for grid convergence corrections.
     689          cRA0  = cU;
     690          cDec0 = cV;
     691        }
     692        iBeamSel = cBeamSel[beamNo-1];
     693        if (iBeamSel < 0) continue;
     694
     695        // Sanity check (mainly for MOPS).
     696        if (cIFno > cNIF) continue;
     697
     698        // Apply IF selection.
     699        iIFSel = cIFSel[cIFno - 1];
     700        if (iIFSel < 0) continue;
     701
     702
     703        if (cNBin > 1) {
     704          // Binning mode: correct the time.
     705          cUTC += param_.intbase * (cBin - (cNBin + 1)/2.0);
    681706        }
    682707
     
    689714          // the start of the next.
    690715#ifdef PKSIO_DEBUG
    691           fprintf(stderr, "Change-of-day on cUTC: %.1f -> %.1f",
     716          fprintf(stderr, "Change-of-day on cUTC: %.1f -> %.1f\n",
    692717            cPrevUTC, cUTC);
    693718#endif
     
    707732        }
    708733
    709         if (cNBin > 1) {
    710           // Binning mode: correct the time.
    711           cUTC += param_.intbase * (cBin - (cNBin + 1)/2.0);
    712         }
    713 
    714734        // New integration cycle?
    715735        if ((cUTC+cod) > cPrevUTC) {
     
    717737          cPrevUTC = cUTC + 0.0001;
    718738        }
    719 
    720         // Apply beam selection.
    721         beamNo = int(cBaseline / 256.0);
    722         if (beamNo == 1) {
    723           // Store the position of beam 1 for grid convergence corrections.
    724           cRA0  = cU;
    725           cDec0 = cV;
    726         }
    727         iBeamSel = cBeamSel[beamNo-1];
    728         if (iBeamSel < 0) continue;
    729 
    730         // Sanity check (mainly for MOPS).
    731         if (cIFno > cNIF) continue;
    732 
    733         // Apply IF selection.
    734         iIFSel = cIFSel[cIFno - 1];
    735         if (iIFSel < 0) continue;
    736739
    737740        sprintf(cDateObs, "%-10.10s", names_.datobs);
     
    784787          iMBuff = cBuffer + iBeamSel + cNBeamSel*cFlushBin;
    785788
    786           // iMBuff->nIF is set to zero (below) to signal that all IFs in
    787           // an integration have been flushed.
     789          // iMBuff->nIF is decremented (below) and if zero signals that all
     790          // IFs in an integration have been flushed.
    788791          if (iMBuff->nIF) {
    789792            if (cycleNo == 0 || iMBuff->cycleNo < cycleNo) {
     
    805808
    806809        // Find the IF to flush.
    807         for (; cFlushIF < iMBuff->nIF; cFlushIF++) {
     810        for (; cFlushIF < cSimulIF; cFlushIF++) {
    808811          if (iMBuff->IFno[cFlushIF]) break;
    809812        }
     
    827830
    828831
    829     if (cFlushing && cFlushBin == 0 && cFlushIF == 0 && cInterp) {
     832    if (cInterp && cFlushing == 1) {
    830833      // Start of flush cycle, interpolate the beam position.
    831834      //
     
    10981101#endif
    10991102      }
     1103
     1104      cFlushing = 2;
    11001105    }
    11011106
     
    11141119      iMBuff->IFno[cFlushIF] = 0;
    11151120
    1116       if (cFlushIF == iMBuff->nIF - 1) {
    1117         // Signal that all IFs in this buffer location have been flushed.
    1118         iMBuff->nIF = 0;
    1119 
    1120         // Stop cEOS being set when the next integration is read.
     1121      iMBuff->nIF--;
     1122      if (iMBuff->nIF == 0) {
     1123        // All IFs in this buffer location have been flushed.  Stop cEOS
     1124        // being set when the next integration is read.
    11211125        iMBuff->cycleNo = 0;
    11221126
Note: See TracChangeset for help on using the changeset viewer.