Changeset 1635 for trunk/external/atnf/PKSIO/MBFITSreader.cc
- Timestamp:
- 09/25/09 11:47:11 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external/atnf/PKSIO/MBFITSreader.cc
r1452 r1635 27 27 //# AUSTRALIA 28 28 //# 29 //# $Id: MBFITSreader.cc,v 19.5 4 2008-11-17 06:51:55cal103 Exp $29 //# $Id: MBFITSreader.cc,v 19.55 2009-01-20 06:45:33 cal103 Exp $ 30 30 //#--------------------------------------------------------------------------- 31 31 //# The MBFITSreader class reads single dish RPFITS files (such as Parkes … … 141 141 int jstat = -3; 142 142 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); 144 144 logMsg(cMsg); 145 145 return 1; … … 159 159 jstat = -1; 160 160 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" 162 162 " %s", rpname); 163 163 logMsg(cMsg); … … 205 205 206 206 if (cNBeam <= 0) { 207 logMsg("ERROR , couldn't determine number of beams.");207 logMsg("ERROR: Couldn't determine number of beams."); 208 208 close(); 209 209 return 1; … … 337 337 // Read the first syscal record. 338 338 if (rpget(1, cEOS)) { 339 logMsg("ERROR , failed to read first syscal record.");339 logMsg("ERROR: Failed to read first syscal record."); 340 340 close(); 341 341 return 1; … … 373 373 { 374 374 if (!cMBopen) { 375 logMsg("ERROR , an MBFITS file has not been opened.");375 logMsg("ERROR: An MBFITS file has not been opened."); 376 376 return 1; 377 377 } … … 515 515 516 516 if (!cMBopen) { 517 logMsg("ERROR , an MBFITS file has not been opened.");517 logMsg("ERROR: An MBFITS file has not been opened."); 518 518 return 1; 519 519 } … … 588 588 cXpolOff = new int[cNIF]; 589 589 590 int simulIF = 0;591 590 int maxChan = 0; 592 591 int maxXpol = 0; 593 592 593 cSimulIF = 0; 594 594 for (int iIF = 0; iIF < cNIF; iIF++) { 595 595 if (cIFs[iIF]) { … … 617 617 618 618 // Maximum number of selected IFs in any simultaneous set. 619 simulIF = max(simulIF, cIFSel[iIF]+1);619 cSimulIF = max(cSimulIF, cIFSel[iIF]+1); 620 620 621 621 // Maximum memory required for any simultaneous set. … … 644 644 645 645 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."); 647 648 close(); 648 649 return 1; … … 657 658 // Allocate memory for spectral arrays. 658 659 for (int ibuff = 0; ibuff < nBuff; ibuff++) { 659 cBuffer[ibuff].setNIFs( simulIF);660 cBuffer[ibuff].setNIFs(cSimulIF); 660 661 cBuffer[ibuff].allocate(0, maxChan, maxXpol); 661 662 662 663 // 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++) { 664 665 cBuffer[ibuff].IFno[iIF] = 0; 665 666 } … … 679 680 cCycleNo = 0; 680 681 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); 681 706 } 682 707 … … 689 714 // the start of the next. 690 715 #ifdef PKSIO_DEBUG 691 fprintf(stderr, "Change-of-day on cUTC: %.1f -> %.1f ",716 fprintf(stderr, "Change-of-day on cUTC: %.1f -> %.1f\n", 692 717 cPrevUTC, cUTC); 693 718 #endif … … 707 732 } 708 733 709 if (cNBin > 1) {710 // Binning mode: correct the time.711 cUTC += param_.intbase * (cBin - (cNBin + 1)/2.0);712 }713 714 734 // New integration cycle? 715 735 if ((cUTC+cod) > cPrevUTC) { … … 717 737 cPrevUTC = cUTC + 0.0001; 718 738 } 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;736 739 737 740 sprintf(cDateObs, "%-10.10s", names_.datobs); … … 784 787 iMBuff = cBuffer + iBeamSel + cNBeamSel*cFlushBin; 785 788 786 // iMBuff->nIF is set to zero (below) to signal that all IFs in787 // 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. 788 791 if (iMBuff->nIF) { 789 792 if (cycleNo == 0 || iMBuff->cycleNo < cycleNo) { … … 805 808 806 809 // Find the IF to flush. 807 for (; cFlushIF < iMBuff->nIF; cFlushIF++) {810 for (; cFlushIF < cSimulIF; cFlushIF++) { 808 811 if (iMBuff->IFno[cFlushIF]) break; 809 812 } … … 827 830 828 831 829 if (c Flushing && cFlushBin == 0 && cFlushIF == 0 && cInterp) {832 if (cInterp && cFlushing == 1) { 830 833 // Start of flush cycle, interpolate the beam position. 831 834 // … … 1098 1101 #endif 1099 1102 } 1103 1104 cFlushing = 2; 1100 1105 } 1101 1106 … … 1114 1119 iMBuff->IFno[cFlushIF] = 0; 1115 1120 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. 1121 1125 iMBuff->cycleNo = 0; 1122 1126
Note:
See TracChangeset
for help on using the changeset viewer.