Changeset 1393
- Timestamp:
- 08/01/07 02:54:51 (17 years ago)
- Location:
- branches/alma/external/atnf/PKSIO
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/alma/external/atnf/PKSIO/PKSFITSreader.cc
r1325 r1393 26 26 //# Charlottesville, VA 22903-2475 USA 27 27 //# 28 //# $Id : PKSFITSreader.cc,v 19.12 2006/07/05 04:49:57 mcalabre Exp$28 //# $Id$ 29 29 //#--------------------------------------------------------------------------- 30 30 //# Original: 2000/08/02, Mark Calabretta, ATNF … … 142 142 Double &mjd, 143 143 Double &refFreq, 144 Double &bandwidth) 144 Double &bandwidth, 145 String &fluxunit) 145 146 { 146 147 char datobs[32], dopplerFrame_[32], observer_[32], obsType_[32], … … 155 156 } 156 157 158 fluxunit = ""; 157 159 observer = trim(observer_); 158 160 project = trim(project_); -
branches/alma/external/atnf/PKSIO/PKSFITSreader.h
r1325 r1393 26 26 //# Charlottesville, VA 22903-2475 USA 27 27 //# 28 //# $Id : PKSFITSreader.h,v 19.11 2006/07/05 04:49:57 mcalabre Exp$28 //# $Id$ 29 29 //#--------------------------------------------------------------------------- 30 30 //# This class is basically a wrapper class for reading data from either an … … 86 86 Double &mjd, 87 87 Double &refFreq, 88 Double &bandwidth); 88 Double &bandwidth, 89 String &fluxunit); 89 90 90 91 // Get frequency parameters for each IF. -
branches/alma/external/atnf/PKSIO/PKSMS2reader.cc
r1325 r1393 26 26 //# Charlottesville, VA 22903-2475 USA 27 27 //# 28 //# $Id : PKSMS2reader.cc,v 19.11 2006/07/05 04:59:20 mcalabre Exp$28 //# $Id$ 29 29 //#--------------------------------------------------------------------------- 30 30 //# Original: 2000/08/03, Mark Calabretta, ATNF … … 38 38 #include <ms/MeasurementSets/MSColumns.h> 39 39 #include <tables/Tables.h> 40 #include <casa/Quanta/MVTime.h> 41 #include <casa/Quanta/MVAngle.h> 42 #include <casa/BasicMath/Math.h> 43 #include <measures/Measures/MeasConvert.h> 44 #include <measures/Measures/MEpoch.h> 45 #include <measures/Measures/MeasRef.h> 46 40 47 41 48 // Parkes includes. … … 84 91 85 92 cPKSMS = MeasurementSet(msName); 93 // taql access to the syscal table 94 String tmpcalName = msName; 95 tmpcalName.append("/SYSCAL"); 96 cSysCalTab = Table(tmpcalName); 97 86 98 cIdx = 0; 99 lastmjd = 0.0; 87 100 cNRow = cPKSMS.nrow(); 88 101 cMSopen = True; … … 111 124 cFieldIdCol.reference(msCols.fieldId()); 112 125 cFieldNameCol.reference(fieldCols.name()); 126 cFieldDelayDirCol.reference(fieldCols.delayDir()); 113 127 114 128 cSrcIdCol.reference(fieldCols.sourceId()); 129 cSrcId2Col.reference(sourceCols.sourceId()); 115 130 cSrcNameCol.reference(sourceCols.name()); 116 131 cSrcDirCol.reference(sourceCols.direction()); … … 120 135 cStateIdCol.reference(msCols.stateId()); 121 136 cObsModeCol.reference(stateCols.obsMode()); 122 137 cCalCol.reference(stateCols.cal()); 138 cSigStateCol.reference(stateCols.sig()); 139 cRefStateCol.reference(stateCols.ref()); 123 140 cDataDescIdCol.reference(msCols.dataDescId()); 141 cSpWinIdCol.reference(dataDescCols.spectralWindowId()); 124 142 cChanFreqCol.reference(spWinCols.chanFreq()); 125 143 … … 142 160 cTsysCol.attach(cPKSMS.sysCal(), "TSYS"); 143 161 } 162 163 if ((cHaveTcal = cPKSMS.sysCal().tableDesc().isColumn("TCAL"))) { 164 cTcalCol.attach(cPKSMS.sysCal(), "TCAL"); 165 } 144 166 145 167 if ((cHaveCalFctr = cPKSMS.tableDesc().isColumn("CALFCTR"))) { … … 157 179 cFlagCol.reference(msCols.flag()); 158 180 181 159 182 if ((cGetXPol = cPKSMS.isColumn(MSMainEnums::DATA))) { 160 183 if ((cHaveXCalFctr = cPKSMS.tableDesc().isColumn("XCALFCTR"))) { … … 177 200 178 201 // Number of IFs. 179 uInt nIF = dataDescCols.nrow(); 202 //uInt nIF = dataDescCols.nrow(); 203 uInt nIF =spWinCols.nrow(); 180 204 IFs.resize(nIF); 181 205 IFs = True; … … 253 277 Double &mjd, 254 278 Double &refFreq, 255 Double &bandwidth) 279 Double &bandwidth, 280 String &fluxunit) 256 281 { 257 282 if (!cMSopen) { … … 277 302 } 278 303 304 fluxunit = ""; 305 const TableRecord& keywordSet 306 = cFloatDataCol.columnDesc().keywordSet(); 307 if(keywordSet.isDefined("UNIT")) { 308 fluxunit = keywordSet.asString("UNIT"); 309 } 279 310 280 311 // Coordinate equinox. … … 538 569 Int ibeam; 539 570 Int iIF; 571 Int iDataDesc; 572 540 573 while (True) { 541 574 ibeam = cBeamNoCol(cIdx); 542 iIF = cDataDescIdCol(cIdx); 575 iDataDesc = cDataDescIdCol(cIdx); 576 iIF =cSpWinIdCol(iDataDesc); 543 577 if (cBeams(ibeam) && cIFs(iIF)) { 544 578 break; … … 552 586 553 587 // Renumerate scan no. Here still is 1-based 554 scanNo = cScanNoCol(cIdx) - cScanNoCol(0) + 1; 555 588 //scanNo = cScanNoCol(cIdx) - cScanNoCol(0) + 1; 589 scanNo = cScanNoCol(cIdx); 590 556 591 if (scanNo != cScanNo) { 557 592 // Start of new scan. … … 576 611 577 612 Int srcId = cSrcIdCol(fieldId); 578 srcName = cSrcNameCol(srcId); 613 //For source with multiple spectral window setting, this is not 614 // correct. Source name of srcId may not be at 'srcId'th row of SrcNameCol 615 //srcName = cSrcNameCol(srcId); 616 for (uInt irow = 0; irow < cSrcId2Col.nrow(); irow++) { 617 if (cSrcId2Col(irow) == srcId) { 618 srcName = cSrcNameCol(irow); 619 } 620 } 621 579 622 srcDir = cSrcDirCol(srcId); 580 623 srcPM = cSrcPMCol(srcId); … … 587 630 } 588 631 632 ROMSAntennaColumns antennaCols(cPKSMS.antenna()); 633 String telescope = antennaCols.name()(0); 634 Bool cGBT = telescope.contains("GBT"); 589 635 // Observation type. 590 636 Int stateId = cStateIdCol(cIdx); 591 obsMode = cObsModeCol(stateId); 637 if (stateId == -1) { 638 //obsMode = " "; 639 } else { 640 obsMode = cObsModeCol(stateId); 641 Bool sigState =cSigStateCol(stateId); 642 Bool refState =cRefStateCol(stateId); 643 //DEBUG 644 //cerr <<"stateid="<<stateId<<" obsmode="<<obsMode<<endl; 645 if (cGBT) { 646 // split the obsMode string and append a proper label 647 // (these are GBT specific) 648 int epos = obsMode.find_first_of(':'); 649 int nextpos = obsMode.find_first_of(':',epos+1); 650 string obsMode1 = obsMode.substr(0,epos); 651 string obsMode2 = obsMode.substr(epos+1,nextpos-epos-1); 652 653 //cerr <<"obsMode2= "<<obsMode2<<endl; 654 if (!srcName.contains("_ps") 655 &&!srcName.contains("_psr") 656 &&!srcName.contains("_nod") 657 &&!srcName.contains("_fs") 658 &&!srcName.contains("_fsr")) { 659 // if Nod mode observation , append '_nod' 660 if (obsMode1 == "Nod") { 661 srcName.append("_nod"); 662 } else if (obsMode1 == "OffOn") { 663 // for GBT position switch observations (OffOn or OnOff) 664 if (obsMode2 == "PSWITCHON") srcName.append("_ps"); 665 if (obsMode2 == "PSWITCHOFF") srcName.append("_psr"); 666 } else { 667 if (obsMode2 == "FSWITCH") { 668 // for GBT frequency switch mode 669 if (sigState) srcName.append("_fs"); 670 if (refState) srcName.append("_fsr"); 671 } 672 } 673 } 674 } 675 } 676 // CAL state 677 // this should be apply just for GBT data? 678 Double Cal; 679 if (stateId==-1) { 680 Cal = 0; 681 } else { 682 Cal = cCalCol(stateId); 683 } 684 if (cGBT) { 685 if (Cal > 0 && !srcName.contains("_calon")) { 686 srcName.append("_calon"); 687 } 688 } 592 689 593 690 IFno = iIF + 1; 594 691 Int nChan = abs(cEndChan(iIF) - cStartChan(iIF)) + 1; 595 692 596 693 // Minimal handling on continuum data. 597 694 Vector<Double> chanFreq = cChanFreqCol(iIF); … … 607 704 freqInc = chanFreq(0) - chanFreq(1); 608 705 } 609 610 706 refFreq = chanFreq(cRefChan(iIF)-1); 611 707 restFreq = cSrcRestFrqCol(srcId)(IPosition(1,0)); … … 616 712 tcal = 0.0f; 617 713 tcalTime = ""; 618 azimuth = 0.0f;619 elevation = 0.0f;714 //azimuth = 0.0f; 715 //elevation = 0.0f; 620 716 parAngle = 0.0f; 621 717 focusAxi = 0.0f; … … 649 745 beamNo = ibeam + 1; 650 746 651 Matrix<Double> pointingDir = cPointingCol(fieldId); 652 direction = pointingDir.column(0); 653 uInt ncols = pointingDir.ncolumn(); 747 //Matrix<Double> pointingDir = cPointingCol(fieldId); 748 //pointingDir = cPointingCol(fieldId); 749 //direction = pointingDir.column(0); 750 //uInt ncols = pointingDir.ncolumn(); 751 //if (ncols == 1) { 752 // scanRate = 0.0f; 753 //} else { 754 // scanRate = pointingDir.column(1); 755 //} 756 757 // Get direction from FIELD table 758 // here, assume direction to be the field direction not pointing 759 Matrix<Double> delayDir = cFieldDelayDirCol(fieldId); 760 direction = delayDir.column(0); 761 uInt ncols = delayDir.ncolumn(); 654 762 if (ncols == 1) { 655 763 scanRate = 0.0f; 656 764 } else { 657 scanRate = pointingDir.column(1); 658 } 765 scanRate = delayDir.column(1); 766 } 767 768 // caluculate azimuth and elevation 769 // first, get the reference frame 770 MVPosition mvpos(antennaCols.position()(0)); 771 MPosition mp(mvpos); 772 Quantum<Double> qt(time,"s"); 773 MVEpoch mvt(qt); 774 MEpoch me(mvt); 775 MeasFrame frame(mp, me); 776 // 777 ROMSFieldColumns fldCols(cPKSMS.field()); 778 Vector<MDirection> vmd(1); 779 MDirection md; 780 fldCols.delayDirMeasCol().get(fieldId,vmd); 781 md = vmd[0]; 782 //Vector<Double> dircheck = md.getAngle("rad").getValue(); 783 //cerr<<"dircheck="<<dircheck<<endl; 784 785 Vector<Double> azel = 786 MDirection::Convert(md, MDirection::Ref(MDirection::AZEL, 787 frame) 788 )().getAngle("rad").getValue(); 789 //cerr<<"azel="<<azel<<endl; 790 azimuth = azel[0]; 791 elevation = azel[1]; 659 792 660 793 // Get Tsys assuming that entries in the SYSCAL table match the main table. … … 675 808 cSigmaCol.get(cIdx, sigma, True); 676 809 810 //get Tcal if available 811 if (cHaveTcal) { 812 Int nTcalColRow = cTcalCol.nrow(); 813 uInt nBeam = cBeams.nelements(); 814 uInt nIF = cIFs.nelements(); 815 uInt nrws = nBeam * nIF; 816 if (nTcalColRow > 0) { 817 // find tcal match with the data with the data time stamp 818 Double mjds = mjd*(24*3600); 819 Double dtcalTime; 820 if ( mjd > lastmjd || cIdx==0 ) { 821 //Table tmptab = cSysCalTab(near(cSysCalTab.col("TIME"),mjds)); 822 tmptab = cSysCalTab(near(cSysCalTab.col("TIME"),mjds), nrws); 823 //DEBUG 824 //if (cIdx == 0) { 825 // cerr<<"inital table retrieved"<<endl; 826 //} 827 828 } 829 830 if (nBeam == 1) { 831 tmptab2 = tmptab( tmptab.col("SPECTRAL_WINDOW_ID") == iIF, 1); 832 } else { 833 tmptab2 = tmptab( tmptab.col("SPECTRAL_WINDOW_ID") == iIF && 834 tmptab.col("FEED_ID") == ibeam , 1); 835 } 836 //cerr<<"first subtab rows="<<tmptab.nrow()<<endl; 837 int syscalrow = tmptab2.nrow(); 838 ROArrayColumn<Float> tcalCol(tmptab2, "TCAL"); 839 ROScalarColumn<Double> tcalTimeCol(tmptab2, "TIME"); 840 if (syscalrow==0) { 841 cerr<<"Cannot find any matching Tcal at/near the data timestamp." 842 << " Set Tcal=0.0"<<endl; 843 } else { 844 tcalCol.get(0, tcal); 845 tcalTimeCol.get(0,dtcalTime); 846 tcalTime = MVTime(dtcalTime/(24*3600)).string(MVTime::YMD); 847 //DEBUG 848 //cerr<<"cIdx:"<<cIdx<<" tcal="<<tcal<<" tcalTime="<<tcalTime<<endl; 849 tmptab.markForDelete(); 850 tmptab2.markForDelete(); 851 } 852 } 853 lastmjd = mjd; 854 } 855 677 856 // Calibration factors (if available). 678 857 calFctr.resize(cNPol(iIF)); … … 695 874 baseSub.resize(0,0); 696 875 } 697 698 876 699 877 // Get spectral data. … … 780 958 Int ibeam; 781 959 Int iIF; 960 Int iDataDesc; 782 961 while (True) { 783 962 ibeam = cBeamNoCol(cIdx); 784 iIF = cDataDescIdCol(cIdx); 963 //iIF = cDataDescIdCol(cIdx); 964 iDataDesc = cDataDescIdCol(cIdx); 965 iIF = cSpWinIdCol(iDataDesc); 785 966 if (cBeams(ibeam) && cIFs(iIF)) { 786 967 break; … … 794 975 795 976 IFno = iIF + 1; 796 797 977 // Get Tsys assuming that entries in the SYSCAL table match the main table. 798 978 cTsysCol.get(cIdx, tsys, True); -
branches/alma/external/atnf/PKSIO/PKSMS2reader.h
r1325 r1393 26 26 //# Charlottesville, VA 22903-2475 USA 27 27 //# 28 //# $Id : PKSMS2reader.h,v 19.12 2006/07/05 04:55:45 mcalabre Exp$28 //# $Id$ 29 29 //#--------------------------------------------------------------------------- 30 30 //# Original: 2000/08/03, Mark Calabretta, ATNF … … 83 83 Double &mjd, 84 84 Double &refFreq, 85 Double &bandwidth); 85 Double &bandwidth, 86 String &fluxunit); 86 87 87 88 // Get frequency parameters for each IF. … … 168 169 private: 169 170 Bool cHaveBaseLin, cHaveCalFctr, cHaveSrcVel, cHaveTsys, cHaveXCalFctr, 170 cMSopen ;171 cMSopen, cHaveTcal; 171 172 Int cCycleNo, cIdx, cNRow, cScanNo; 172 Double cTime ;173 Double cTime, lastmjd; 173 174 Vector<Int> cEndChan, cRefChan, cStartChan; 174 175 Vector<Bool> cBeams, cIFs; 175 176 Vector<Slicer> cDataSel; 176 177 MeasurementSet cPKSMS; 178 Table cSysCalTab, tmptab, tmptab2; 177 179 178 180 ROScalarColumn<Int> cScanNoCol; … … 181 183 ROScalarColumn<Int> cFieldIdCol; 182 184 ROScalarColumn<String> cFieldNameCol; 185 ROArrayColumn<Double> cFieldDelayDirCol; 183 186 ROScalarColumn<Int> cSrcIdCol; 187 ROScalarColumn<Int> cSrcId2Col; 184 188 ROScalarColumn<String> cSrcNameCol; 185 189 ROArrayColumn<Double> cSrcDirCol; … … 187 191 ROArrayColumn<Double> cSrcVelCol; 188 192 ROScalarColumn<Int> cStateIdCol; 193 ROScalarColumn<Double> cCalCol; 189 194 ROScalarColumn<String> cObsModeCol; 190 195 ROArrayColumn<Double> cSrcRestFrqCol; 191 196 ROScalarColumn<Int> cDataDescIdCol; 197 ROScalarColumn<Int> cSpWinIdCol; 192 198 ROArrayColumn<Double> cChanFreqCol; 193 199 ROScalarColumn<Double> cWeatherTimeCol; … … 195 201 ROScalarColumn<Float> cPressureCol; 196 202 ROScalarColumn<Float> cHumidityCol; 203 ROArrayColumn<Float> cTcalCol; 197 204 ROScalarColumn<Int> cBeamNoCol; 198 205 ROArrayColumn<Double> cPointingCol; … … 207 214 ROArrayColumn<Complex> cDataCol; 208 215 ROScalarColumn<Int> cNumReceptorCol; 216 ROScalarColumn<Bool> cSigStateCol; 217 ROScalarColumn<Bool> cRefStateCol; 218 209 219 }; 210 220 -
branches/alma/external/atnf/PKSIO/PKSMS2writer.cc
r1325 r1393 38 38 #include <casa/BasicSL/Constants.h> 39 39 #include <casa/Quanta/QC.h> 40 #include <casa/Logging/LogIO.h> 40 41 #include <measures/Measures/Stokes.h> 41 42 #include <tables/Tables/ArrColDesc.h> … … 81 82 const Vector<uInt> nPol, 82 83 const Vector<Bool> haveXPol, 83 const Bool haveBase) 84 const Bool haveBase, 85 const String fluxUnit) 84 86 { 85 87 // Open a MS table. … … 92 94 Int maxNPol = max(cNPol); 93 95 96 // check if it is GBT data 97 cGBT = antName.contains("GBT"); 94 98 95 99 // Add the non-standard CALFCTR column. … … 99 103 // Add the optional FLOAT_DATA column. 100 104 MS::addColumnToDesc(pksDesc, MS::FLOAT_DATA, 2); 105 //pksDesc.rwColumnDesc(MS::columnName(MS::FLOAT_DATA)).rwKeywordSet(). 106 // define("UNIT", String("Jy")); 101 107 pksDesc.rwColumnDesc(MS::columnName(MS::FLOAT_DATA)).rwKeywordSet(). 102 define("UNIT", String("Jy"));108 define("UNIT", fluxUnit); 103 109 pksDesc.rwColumnDesc(MS::columnName(MS::FLOAT_DATA)).rwKeywordSet(). 104 110 define("MEASURE_TYPE", ""); … … 350 356 } else if (dopplerFrame == "SOURCE") { 351 357 MFrequency::getType(cDopplerFrame, "REST"); 358 } else if (dopplerFrame == "LSRK") { 359 MFrequency::getType(cDopplerFrame, "LSRK"); 352 360 } 353 361 … … 357 365 addDopplerEntry(); 358 366 addFeedEntry(); 359 addObservationEntry(observer, project); 367 //addObservationEntry(observer, project); 368 addObservationEntry(observer, project, antName); 360 369 addProcessorEntry(); 361 370 … … 446 455 447 456 // SYSCAL subtable. 448 addSysCalEntry(beamNo, iIF, time, interval, tcal, tsys); 457 addSysCalEntry(beamNo, iIF, time, interval, tcal, tsys, nPol); 458 449 459 450 460 // Handle weather information. … … 499 509 } 500 510 } 501 502 511 // Transpose spectra. 503 512 Matrix<Float> tmpData(nPol, nChan); … … 509 518 } 510 519 } 511 512 520 cCalFctrCol->put(irow, calFctr); 513 521 cMSCols->floatData().put(irow, tmpData); … … 522 530 cMSCols->sigma().put(irow, sigma); 523 531 524 Vector<Float> weight(1, 1.0f); 532 //Vector<Float> weight(1, 1.0f); 533 Vector<Float> weight(nPol, 1.0f); 525 534 cMSCols->weight().put(irow, weight); 526 535 527 536 // Flag information. 528 537 Cube<Bool> flags(nPol, nChan, 1, False); 529 cMSCols->flag().put(irow, flags.xyPlane(0));538 //cMSCols->flag().put(irow, flags.xyPlane(0)); 530 539 cMSCols->flagCategory().put(irow, flags); 531 540 cMSCols->flagRow().put(irow, False); … … 601 610 Int n = cAntenna.nrow() - 1; 602 611 612 // do specific things for GBT 603 613 // Data. 604 614 cAntennaCols->name().put(n, antName); 605 cAntennaCols->station().put(n, "ATNF_PARKES"); 615 //cAntennaCols->station().put(n, "ATNF_PARKES"); 616 if (cGBT) { 617 cAntennaCols->station().put(n, "GREENBANK"); 618 } 619 else { 620 cAntennaCols->station().put(n, "ATNF_PARKES"); 621 } 606 622 cAntennaCols->type().put(n, "GROUND-BASED"); 607 623 cAntennaCols->mount().put(n, "ALT-AZ"); … … 609 625 Vector<Double> antOffset(3, 0.0); 610 626 cAntennaCols->offset().put(n, antOffset); 611 cAntennaCols->dishDiameter().put(n, 64.0); 612 627 //cAntennaCols->dishDiameter().put(n, 64.0); 628 if (cGBT) { 629 cAntennaCols->dishDiameter().put(n, 110.0); 630 } 631 else { 632 cAntennaCols->dishDiameter().put(n, 64.0); 633 } 613 634 // Flags. 614 635 cAntennaCols->flagRow().put(n, False); … … 723 744 const Int srcId) 724 745 { 746 747 ROScalarColumn<String> fldn(cField, "NAME"); 748 ROScalarColumn<Int> sourceid(cField, "SOURCE_ID"); 749 Int n; 750 Int nFld = cField.nrow(); 751 for (n = 0; n < nFld; n++) { 752 if (fldn(n) == fieldName && sourceid(n) == srcId) { 753 break; 754 } 755 } 756 725 757 // Extend the FIELD subtable. 726 cField.addRow(); 727 Int n = cField.nrow() - 1; 728 729 // Data. 730 cFieldCols->name().put(n, fieldName); 731 cFieldCols->code().put(n, "DRIFT"); 732 cFieldCols->time().put(n, time); 733 734 Matrix<Double> track(2, 2); 735 track.column(0) = direction; 736 track.column(1) = scanRate; 737 cFieldCols->numPoly().put(n, 1); 738 cFieldCols->delayDir().put(n, track); 739 cFieldCols->phaseDir().put(n, track); 740 cFieldCols->referenceDir().put(n, track); 741 cFieldCols->sourceId().put(n, srcId); 742 743 // Flags. 744 cFieldCols->flagRow().put(n, False); 758 if (n == nFld) { 759 cField.addRow(); 760 //Int n = cField.nrow() - 1; 761 762 // Data. 763 cFieldCols->name().put(n, fieldName); 764 if (cGBT) { 765 cFieldCols->code().put(n, " "); 766 } 767 else { 768 cFieldCols->code().put(n, "DRIFT"); 769 } 770 cFieldCols->time().put(n, time); 771 772 //Matrix<Double> track(2, 2); 773 Matrix<Double> track(2, 1); 774 track.column(0) = direction; 775 //track.column(1) = scanRate; 776 cFieldCols->numPoly().put(n, 1); 777 cFieldCols->delayDir().put(n, track); 778 cFieldCols->phaseDir().put(n, track); 779 cFieldCols->referenceDir().put(n, track); 780 cFieldCols->sourceId().put(n, srcId); 781 782 // Flags. 783 cFieldCols->flagRow().put(n, False); 784 } 745 785 746 786 return n; … … 753 793 Int PKSMS2writer::addObservationEntry( 754 794 const String observer, 755 const String project) 795 const String project, 796 const String antName) 756 797 { 757 798 // Extend the OBSERVATION subtable. … … 760 801 761 802 // Data. 762 cObservationCols->telescopeName().put(n, "Parkes"); 803 //cObservationCols->telescopeName().put(n, "Parkes"); 804 cObservationCols->telescopeName().put(n, antName); 763 805 Vector<Double> timerange(2, 0.0); 764 806 cObservationCols->timeRange().put(n, timerange); … … 766 808 Vector<String> log(1, "none"); 767 809 cObservationCols->log().put(n, log); 768 cObservationCols->scheduleType().put(n, "ATNF"); 810 //cObservationCols->scheduleType().put(n, "ATNF"); 811 cObservationCols->scheduleType().put(n, ""); 769 812 Vector<String> schedule(1, "Not available"); 770 813 cObservationCols->schedule().put(n, schedule); … … 779 822 780 823 //--------------------------------------------- PKSMS2writer::addPointingEntry 824 825 // Modified to fill pointing data if the direction is the pointing direction. 826 // So the following comment is no longer true. 781 827 782 828 // Add an entry to the POINTING subtable. This compulsory subtable simply … … 790 836 const Vector<Double> scanRate) 791 837 { 792 // Extend the POINTING subtable. 793 cPointing.addRow(); 794 Int n = cPointing.nrow() - 1; 795 796 // Keys. 797 cPointingCols->antennaId().put(n, 0); 798 cPointingCols->time().put(n, time); 799 cPointingCols->interval().put(n, interval); 800 801 // Data. 802 cPointingCols->name().put(n, fieldName); 803 cPointingCols->numPoly().put(n, 1); 804 cPointingCols->timeOrigin().put(n, time); 805 806 Matrix<Double> track(2, 2); 807 track.column(0) = direction; 808 track.column(1) = scanRate; 809 cPointingCols->direction().put(n, track); 810 cPointingCols->target().put(n, track); 811 cPointingCols->tracking().put(n, True); 812 838 839 ROScalarColumn<Double> tms(cPointing, "TIME"); 840 Int n; 841 Int ntm = cPointing.nrow(); 842 for (n = 0; n < ntm; n++) { 843 if (tms(n) == time) { 844 break; 845 } 846 } 847 848 if (n == ntm) { 849 // Extend the POINTING subtable. 850 cPointing.addRow(); 851 //Int n = cPointing.nrow() - 1; 852 853 // Keys. 854 cPointingCols->antennaId().put(n, 0); 855 cPointingCols->time().put(n, time); 856 cPointingCols->interval().put(n, interval); 857 858 // Data. 859 cPointingCols->name().put(n, fieldName); 860 cPointingCols->numPoly().put(n, 1); 861 cPointingCols->timeOrigin().put(n, time); 862 863 //Matrix<Double> track(2, 2); 864 Matrix<Double> track(2, 1); 865 track.column(0) = direction; 866 //track.column(1) = scanRate; 867 cPointingCols->direction().put(n, track); 868 cPointingCols->target().put(n, track); 869 cPointingCols->tracking().put(n, True); 870 } 813 871 return n; 814 872 } … … 833 891 // Data. 834 892 Vector<Int> corrType(2); 893 if (nPol == 1) { 894 corrType.resize(1); 895 corrType(0) = Stokes::XX; 896 } 897 else { 898 //Vector<Int> corrType(2); 835 899 corrType(0) = Stokes::XX; 836 900 corrType(1) = Stokes::YY; 901 } 837 902 cPolarizationCols->corrType().put(n, corrType); 838 903 839 904 Matrix<Int> corrProduct(2,2,1); 905 if (nPol == 1) { 906 corrProduct.resize(2,1,1); 907 corrProduct(1,0) = 0; 908 } 840 909 if (nPol == 2) { 841 910 corrProduct(1,0) = 0; … … 945 1014 946 1015 // Data. 947 cSpWindowCols->name().put(n, "L-band"); 1016 //cSpWindowCols->name().put(n, "L-band"); 1017 cSpWindowCols->name().put(n, " "); 948 1018 cSpWindowCols->refFrequency().put(n, refFreq); 949 1019 … … 1027 1097 const Double interval, 1028 1098 const Vector<Float> tcal, 1029 const Vector<Float> tsys) 1030 { 1099 const Vector<Float> tsys, 1100 const Int nPol) 1101 { 1102 LogIO os(LogOrigin("PKSMS2writer", "addSysCalEntry()", WHERE)); 1103 1031 1104 // Extend the SYSCAL subtable. 1032 1105 cSysCal.addRow(); 1033 1106 Int n = cSysCal.nrow() - 1; 1034 1107 1108 //check fo consistency with n pol 1109 //here assume size of Tcal vector = npol 1110 Vector<Float> inTcal(nPol,0); 1111 Int ndim = tcal.shape()(0); 1112 Vector<Float> tmpTcal = tcal; 1113 if (nPol != ndim) { 1114 os << LogIO::WARN 1115 << "Found "<< ndim <<" Tcal value(s) for the data with "<<nPol<<" polarization(s)" 1116 << "(expecting one Tcal per pol)."<<endl 1117 << "First "<< nPol << " Tcal value(s) will be filled." << LogIO::POST; 1118 tmpTcal.resize(nPol, True); 1119 inTcal = tmpTcal; 1120 } 1035 1121 // Keys. 1036 1122 cSysCalCols->antennaId().put(n, 0); … … 1041 1127 1042 1128 // Data. 1043 cSysCalCols->tcal().put(n, tcal); 1129 //cSysCalCols->tcal().put(n, tcal); 1130 cSysCalCols->tcal().put(n, inTcal); 1044 1131 cSysCalCols->tsys().put(n, tsys); 1045 1132 -
branches/alma/external/atnf/PKSIO/PKSMS2writer.h
r1325 r1393 26 26 //# Charlottesville, VA 22903-2475 USA 27 27 //# 28 //# $Id : PKSMS2writer.h,v 19.11 2006/07/05 05:35:31 mcalabre Exp$28 //# $Id$ 29 29 //#--------------------------------------------------------------------------- 30 30 … … 69 69 const Vector<uInt> nPol, 70 70 const Vector<Bool> haveXPol, 71 const Bool haveBase); 71 const Bool haveBase, 72 const String fluxUnit); 72 73 73 74 // Write the next data record. … … 165 166 ScalarColumn<Complex> *cXCalFctrCol; 166 167 168 // for GBT specific data handling 169 Bool cGBT; 167 170 168 171 // Add an entry to the ANTENNA subtable. … … 198 201 Int addObservationEntry( 199 202 const String observer, 200 const String project); 203 const String project, 204 const String antName); 201 205 202 206 // Add an entry to the POINTING subtable. … … 243 247 const Double interval, 244 248 const Vector<Float> Tcal, 245 const Vector<Float> Tsys); 249 const Vector<Float> Tsys, 250 const Int nPol); 246 251 247 252 // Add an entry to the WEATHER subtable. -
branches/alma/external/atnf/PKSIO/PKSSDwriter.cc
r1325 r1393 26 26 //# Charlottesville, VA 22903-2475 USA 27 27 //# 28 //# $Id : PKSSDwriter.cc,v 19.11 2006/07/05 05:41:12 mcalabre Exp$28 //# $Id$ 29 29 //#--------------------------------------------------------------------------- 30 30 … … 68 68 const Vector<uInt> nPol, 69 69 const Vector<Bool> haveXPol, 70 const Bool haveBase) 70 const Bool haveBase, 71 const String fluxUnit) 71 72 { 72 73 double antPos[3]; -
branches/alma/external/atnf/PKSIO/PKSSDwriter.h
r1325 r1393 26 26 //# Charlottesville, VA 22903-2475 USA 27 27 //# 28 //# $Id : PKSSDwriter.h,v 19.12 2006/07/05 05:37:32 mcalabre Exp$28 //# $Id$ 29 29 //# Original: 2000/07/21, Mark Calabretta, ATNF 30 30 //#--------------------------------------------------------------------------- … … 69 69 const Vector<uInt> nPol, 70 70 const Vector<Bool> haveXPol, 71 const Bool haveBase); 71 const Bool haveBase, 72 const String fluxUnit); 72 73 73 74 // Write the next data record. -
branches/alma/external/atnf/PKSIO/PKSreader.h
r1325 r1393 26 26 //# Charlottesville, VA 22903-2475 USA 27 27 //# 28 //# $Id : PKSreader.h,v 19.11 2006/07/05 05:00:21 mcalabre Exp$28 //# $Id$ 29 29 //#--------------------------------------------------------------------------- 30 30 //# Original: 2000/08/02, Mark Calabretta, ATNF … … 105 105 Double &mjd, 106 106 Double &refFreq, 107 Double &bandwidth) = 0; 107 Double &bandwidth, 108 String &fluxunit) = 0; 108 109 109 110 // Get frequency parameters for each IF. -
branches/alma/external/atnf/PKSIO/PKSwriter.h
r1325 r1393 26 26 //# Charlottesville, VA 22903-2475 USA 27 27 //# 28 //# $Id : PKSwriter.h,v 19.12 2006/07/05 05:33:31 mcalabre Exp$28 //# $Id$ 29 29 //#--------------------------------------------------------------------------- 30 30 … … 62 62 const Vector<uInt> nPol, 63 63 const Vector<Bool> haveXPol, 64 const Bool havebase) = 0; 64 const Bool havebase, 65 const String fluxUnit) = 0; 65 66 66 67 // Write the next data record.
Note:
See TracChangeset
for help on using the changeset viewer.