- Timestamp:
- 09/12/11 14:53:57 (13 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/MSFiller.h
r2291 r2293 100 100 val = quantCol( idx ) ; 101 101 } 102 // template<class T> void putField( const String &name,103 // TableRecord &rec,104 // T &val )105 // {106 // RecordFieldPtr<T> rf( rec, name ) ;107 // *rf = val ;108 // }109 // template<class T> void defineField( const String &name,110 // TableRecord &rec,111 // T &val )112 // {113 // RecordFieldPtr<T> rf( rec, name ) ;114 // rf.define( val ) ;115 // }116 102 template<class T> T interp( Double x0, Double x1, Double x, T y0, T y1 ) 117 103 { -
trunk/src/MSWriter.cpp
r2291 r2293 1819 1819 } 1820 1820 1821 // void MSWriter::fillAntenna()1822 // {1823 // // double startSec = mathutil::gettimeofday_sec() ;1824 // // os_ << "start MSWriter::fillAntenna() startSec=" << startSec << LogIO::POST ;1825 1826 // // only 1 row1827 // mstable_->antenna().addRow( 1, True ) ;1828 // MSAntennaColumns msAntCols( mstable_->antenna() ) ;1829 1830 // String hAntennaName = header_.antennaname ;1831 // String::size_type pos = hAntennaName.find( "//" ) ;1832 // String antennaName ;1833 // String stationName ;1834 // if ( pos != String::npos ) {1835 // hAntennaName = hAntennaName.substr( pos+2 ) ;1836 // }1837 // pos = hAntennaName.find( "@" ) ;1838 // if ( pos != String::npos ) {1839 // antennaName = hAntennaName.substr( 0, pos ) ;1840 // stationName = hAntennaName.substr( pos+1 ) ;1841 // }1842 // else {1843 // antennaName = hAntennaName ;1844 // stationName = hAntennaName ;1845 // }1846 // // os_ << "antennaName = " << antennaName << LogIO::POST ;1847 // // os_ << "stationName = " << stationName << LogIO::POST ;1848 1849 // msAntCols.name().put( 0, antennaName ) ;1850 // msAntCols.station().put( 0, stationName ) ;1851 1852 // // os_ << "antennaPosition = " << header_.antennaposition << LogIO::POST ;1853 1854 // msAntCols.position().put( 0, header_.antennaposition ) ;1855 1856 // // MOUNT is set to "ALT-AZ"1857 // msAntCols.mount().put( 0, "ALT-AZ" ) ;1858 1859 // Double diameter = getDishDiameter( antennaName ) ;1860 // msAntCols.dishDiameterQuant().put( 0, Quantity( diameter, "m" ) ) ;1861 1862 // // double endSec = mathutil::gettimeofday_sec() ;1863 // // os_ << "end MSWriter::fillAntenna() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;1864 // }1865 1866 1821 void MSWriter::fillProcessor() 1867 1822 { … … 2291 2246 } 2292 2247 2293 void MSWriter::addFeed( Int id )2294 {2295 // double startSec = mathutil::gettimeofday_sec() ;2296 // os_ << "start MSWriter::addFeed() startSec=" << startSec << LogIO::POST ;2297 2298 // add row2299 MSFeed msFeed = mstable_->feed() ;2300 msFeed.addRow( 1, True ) ;2301 Int nrow = msFeed.nrow() ;2302 Int numReceptors = 2 ;2303 Vector<String> polType( numReceptors ) ;2304 Matrix<Double> beamOffset( 2, numReceptors ) ;2305 beamOffset = 0.0 ;2306 Vector<Double> receptorAngle( numReceptors, 0.0 ) ;2307 if ( polType_ == "linear" ) {2308 polType[0] = "X" ;2309 polType[1] = "Y" ;2310 }2311 else if ( polType_ == "circular" ) {2312 polType[0] = "R" ;2313 polType[1] = "L" ;2314 }2315 else {2316 polType[0] = "X" ;2317 polType[1] = "Y" ;2318 }2319 Matrix<Complex> polResponse( numReceptors, numReceptors, 0.0 ) ;2320 for ( Int i = 0 ; i < numReceptors ; i++ )2321 polResponse( i, i ) = 0.0 ;2322 2323 MSFeedColumns msFeedCols( mstable_->feed() ) ;2324 2325 msFeedCols.feedId().put( nrow-1, id ) ;2326 msFeedCols.antennaId().put( nrow-1, 0 ) ;2327 msFeedCols.numReceptors().put( nrow-1, numReceptors ) ;2328 msFeedCols.polarizationType().put( nrow-1, polType ) ;2329 msFeedCols.beamOffset().put( nrow-1, beamOffset ) ;2330 msFeedCols.receptorAngle().put( nrow-1, receptorAngle ) ;2331 msFeedCols.polResponse().put( nrow-1, polResponse ) ;2332 2333 // double endSec = mathutil::gettimeofday_sec() ;2334 // os_ << "end MSWriter::addFeed() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;2335 }2336 2337 void MSWriter::addSpectralWindow( Int spwid, Int freqid )2338 {2339 // double startSec = mathutil::gettimeofday_sec() ;2340 // os_ << "start MSWriter::addSpectralWindow() startSec=" << startSec << LogIO::POST ;2341 2342 // add row2343 MSSpectralWindow msSpw = mstable_->spectralWindow() ;2344 while( (Int)msSpw.nrow() <= spwid ) {2345 msSpw.addRow( 1, True ) ;2346 }2347 2348 MSSpWindowColumns msSpwCols( msSpw ) ;2349 2350 STFrequencies stf = table_->frequencies() ;2351 2352 // MEAS_FREQ_REF2353 msSpwCols.measFreqRef().put( spwid, stf.getFrame( True ) ) ;2354 2355 Double refpix ;2356 Double refval ;2357 Double inc ;2358 stf.getEntry( refpix, refval, inc, (uInt)freqid ) ;2359 2360 // NUM_CHAN2361 //Int nchan = (Int)(refpix * 2) + 1 ;2362 //if ( nchan == 0 )2363 //nchan = 1 ;2364 Int nchan = table_->nchan( spwid ) ;2365 msSpwCols.numChan().put( spwid, nchan ) ;2366 2367 // TOTAL_BANDWIDTH2368 Double bw = nchan * abs( inc ) ;2369 msSpwCols.totalBandwidth().put( spwid, bw ) ;2370 2371 // REF_FREQUENCY2372 Double refFreq = refval - refpix * inc ;2373 msSpwCols.refFrequency().put( spwid, refFreq ) ;2374 2375 // NET_SIDEBAND2376 // tentative: USB->0, LSB->12377 Int netSideband = 0 ;2378 if ( inc < 0 )2379 netSideband = 1 ;2380 msSpwCols.netSideband().put( spwid, netSideband ) ;2381 2382 // RESOLUTION, CHAN_WIDTH, EFFECTIVE_BW2383 Vector<Double> sharedDoubleArr( nchan, abs(inc) ) ;2384 msSpwCols.resolution().put( spwid, sharedDoubleArr ) ;2385 msSpwCols.chanWidth().put( spwid, sharedDoubleArr ) ;2386 msSpwCols.effectiveBW().put( spwid, sharedDoubleArr ) ;2387 2388 // CHAN_FREQ2389 indgen( sharedDoubleArr, refFreq, inc ) ;2390 msSpwCols.chanFreq().put( spwid, sharedDoubleArr ) ;2391 2392 // double endSec = mathutil::gettimeofday_sec() ;2393 // os_ << "end MSWriter::addSpectralWindow() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;2394 }2395 2396 void MSWriter::addField( Int fid, String fieldname, String srcname, Double t, Vector<Double> rate )2397 {2398 // double startSec = mathutil::gettimeofday_sec() ;2399 // os_ << "start MSWriter::addField() startSec=" << startSec << LogIO::POST ;2400 2401 MSField msField = mstable_->field() ;2402 while( (Int)msField.nrow() <= fid ) {2403 msField.addRow( 1, True ) ;2404 }2405 MSFieldColumns msFieldCols( msField ) ;2406 2407 // Access to SOURCE table2408 MSSource msSrc = mstable_->source() ;2409 2410 // fill target row2411 msFieldCols.name().put( fid, fieldname ) ;2412 msFieldCols.time().put( fid, t ) ;2413 Int numPoly = 0 ;2414 if ( anyNE( rate, 0.0 ) )2415 numPoly = 1 ;2416 msFieldCols.numPoly().put( fid, numPoly ) ;2417 MSSourceIndex msSrcIdx( msSrc ) ;2418 Int srcId = -1 ;2419 Vector<Int> srcIdArr = msSrcIdx.matchSourceName( srcname ) ;2420 if ( srcIdArr.size() != 0 ) {2421 srcId = srcIdArr[0] ;2422 MSSource msSrcSel = msSrc( msSrc.col("SOURCE_ID") == srcId, 1 ) ;2423 ROMSSourceColumns msSrcCols( msSrcSel ) ;2424 Vector<Double> srcDir = msSrcCols.direction()( 0 ) ;2425 Matrix<Double> srcDirA( IPosition( 2, 2, 1+numPoly ) ) ;2426 // os_ << "srcDirA = " << srcDirA << LogIO::POST ;2427 // os_ << "sliced srcDirA = " << srcDirA.column( 0 ) << LogIO::POST ;2428 srcDirA.column( 0 ) = srcDir ;2429 // os_ << "srcDirA = " << srcDirA << LogIO::POST ;2430 if ( numPoly != 0 )2431 srcDirA.column( 1 ) = rate ;2432 msFieldCols.phaseDir().put( fid, srcDirA ) ;2433 msFieldCols.referenceDir().put( fid, srcDirA ) ;2434 msFieldCols.delayDir().put( fid, srcDirA ) ;2435 }2436 msFieldCols.sourceId().put( fid, srcId ) ;2437 2438 // double endSec = mathutil::gettimeofday_sec() ;2439 // os_ << "end MSWriter::addField() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;2440 }2441 2442 void MSWriter::addPointing( String &name, Double &me, Double &interval, Matrix<Double> &dir )2443 {2444 // double startSec = mathutil::gettimeofday_sec() ;2445 // os_ << "start MSWriter::addPointing() startSec=" << startSec << LogIO::POST ;2446 2447 // access to POINTING subtable2448 MSPointing msp = mstable_->pointing() ;2449 uInt nrow = msp.nrow() ;2450 2451 // add row2452 msp.addRow( 1, True ) ;2453 2454 // fill row2455 TableRow row( msp ) ;2456 TableRecord &rec = row.record() ;2457 RecordFieldPtr<Int> antennaRF( rec, "ANTENNA_ID" ) ;2458 *antennaRF = 0 ;2459 RecordFieldPtr<Int> numpolyRF( rec, "NUM_POLY" ) ;2460 *numpolyRF = dir.ncolumn() - 1 ;2461 RecordFieldPtr<Double> timeRF( rec, "TIME" ) ;2462 *timeRF = me ;2463 RecordFieldPtr<Double> toriginRF( rec, "TIME_ORIGIN" ) ;2464 *toriginRF = me ;2465 RecordFieldPtr<Double> intervalRF( rec, "INTERVAL" ) ;2466 *intervalRF = interval ;2467 RecordFieldPtr<String> nameRF( rec, "NAME" ) ;2468 *nameRF = name ;2469 RecordFieldPtr<Bool> trackRF( rec, "TRACKING" ) ;2470 *trackRF = True ;2471 RecordFieldPtr< Array<Double> > dirRF( rec, "DIRECTION" ) ;2472 *dirRF = dir ;2473 RecordFieldPtr< Array<Double> > targetRF( rec, "TARGET" ) ;2474 *targetRF = dir ;2475 row.put( nrow ) ;2476 2477 // double endSec = mathutil::gettimeofday_sec() ;2478 // os_ << "end MSWriter::addPointing() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;2479 }2480 2481 Int MSWriter::addPolarization( Vector<Int> polnos )2482 {2483 // double startSec = mathutil::gettimeofday_sec() ;2484 // os_ << "start MSWriter::addPolarization() startSec=" << startSec << LogIO::POST ;2485 2486 // os_ << "polnos = " << polnos << LogIO::POST ;2487 MSPolarization msPol = mstable_->polarization() ;2488 uInt nrow = msPol.nrow() ;2489 2490 // // only 1 POLARIZATION row for 1 scantable2491 // if ( nrow > 0 )2492 // return 0 ;2493 2494 Vector<Int> corrType = toCorrType( polnos ) ;2495 2496 ROArrayColumn<Int> corrtCol( msPol, "CORR_TYPE" ) ;2497 //Matrix<Int> corrTypeArr = corrtCol.getColumn() ;2498 Int polid = -1 ;2499 for ( uInt irow = 0 ; irow < nrow ; irow++ ) {2500 Vector<Int> corrTypeArr = corrtCol( irow ) ;2501 if ( corrType.nelements() == corrTypeArr.nelements()2502 && allEQ( corrType, corrTypeArr ) ) {2503 polid = irow ;2504 break ;2505 }2506 }2507 2508 if ( polid == -1 ) {2509 MSPolarizationColumns msPolCols( msPol ) ;2510 2511 // add row2512 msPol.addRow( 1, True ) ;2513 polid = (Int)nrow ;2514 2515 // CORR_TYPE2516 msPolCols.corrType().put( nrow, corrType ) ;2517 2518 // NUM_CORR2519 uInt npol = corrType.size() ;2520 msPolCols.numCorr().put( nrow, npol ) ;2521 2522 // CORR_PRODUCT2523 Matrix<Int> corrProd( 2, npol, -1 ) ;2524 if ( npol == 1 ) {2525 corrProd = 0 ;2526 }2527 else if ( npol == 2 ) {2528 corrProd.column( 0 ) = 0 ;2529 corrProd.column( 1 ) = 1 ;2530 }2531 else {2532 corrProd.column( 0 ) = 0 ;2533 corrProd.column( 3 ) = 1 ;2534 corrProd( 0,1 ) = 0 ;2535 corrProd( 1,1 ) = 1 ;2536 corrProd( 0,2 ) = 1 ;2537 corrProd( 1,2 ) = 0 ;2538 }2539 msPolCols.corrProduct().put( nrow, corrProd ) ;2540 }2541 2542 // double endSec = mathutil::gettimeofday_sec() ;2543 // os_ << "end MSWriter::addPolarization() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;2544 2545 return polid ;2546 }2547 2548 Int MSWriter::addDataDescription( Int polid, Int spwid )2549 {2550 // double startSec = mathutil::gettimeofday_sec() ;2551 // os_ << "start MSWriter::addDataDescription() startSec=" << startSec << LogIO::POST ;2552 2553 MSDataDescription msDataDesc = mstable_->dataDescription() ;2554 uInt nrow = msDataDesc.nrow() ;2555 2556 // only 1 POLARIZATION_ID for 1 scantable2557 Int ddid = -1 ;2558 ROScalarColumn<Int> spwCol( msDataDesc, "SPECTRAL_WINDOW_ID" ) ;2559 Vector<Int> spwIds = spwCol.getColumn() ;2560 //ROScalarColumn<Int> polCol( msDataDesc, "POLARIZATION_ID" ) ;2561 //Vector<Int> polIds = polCol.getColumn() ;2562 for ( uInt irow = 0 ; irow < nrow ; irow++ ) {2563 //if ( spwid == spwIds[irow] && polid == polIds[irow] ) {2564 if ( spwid == spwIds[irow] ) {2565 ddid = irow ;2566 break ;2567 }2568 }2569 // os_ << "ddid = " << ddid << LogIO::POST ;2570 2571 2572 if ( ddid == -1 ) {2573 msDataDesc.addRow( 1, True ) ;2574 MSDataDescColumns msDataDescCols( msDataDesc ) ;2575 msDataDescCols.polarizationId().put( nrow, polid ) ;2576 msDataDescCols.spectralWindowId().put( nrow, spwid ) ;2577 ddid = (Int)nrow ;2578 }2579 2580 // double endSec = mathutil::gettimeofday_sec() ;2581 // os_ << "end MSWriter::addDataDescription() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;2582 2583 return ddid ;2584 }2585 2586 Int MSWriter::addState( Int st, Int &subscan )2587 {2588 // double startSec = mathutil::gettimeofday_sec() ;2589 // os_ << "start MSWriter::addState() startSec=" << startSec << LogIO::POST ;2590 2591 // access to STATE subtable2592 MSState msState = mstable_->state() ;2593 uInt nrow = msState.nrow() ;2594 2595 String obsMode ;2596 Bool isSignal ;2597 Double tnoise ;2598 Double tload ;2599 queryType( st, obsMode, isSignal, tnoise, tload ) ;2600 // os_ << "obsMode = " << obsMode << " isSignal = " << isSignal << LogIO::POST ;2601 2602 Int idx = -1 ;2603 ROScalarColumn<String> obsModeCol( msState, "OBS_MODE" ) ;2604 ROScalarColumn<Int> subscanCol( msState, "SUB_SCAN" ) ;2605 for ( uInt irow = 0 ; irow < nrow ; irow++ ) {2606 if ( obsModeCol(irow) == obsMode2607 //&& sigCol(irow) == isSignal2608 //&& refCol(irow) != isSignal2609 && subscanCol(irow) == subscan ) {2610 idx = irow ;2611 break ;2612 }2613 }2614 if ( idx == -1 ) {2615 msState.addRow( 1, True ) ;2616 TableRow row( msState ) ;2617 TableRecord &rec = row.record() ;2618 RecordFieldPtr<String> obsmodeRF( rec, "OBS_MODE" ) ;2619 *obsmodeRF = obsMode ;2620 RecordFieldPtr<Bool> sigRF( rec, "SIG" ) ;2621 *sigRF = isSignal ;2622 RecordFieldPtr<Bool> refRF( rec, "REF" ) ;2623 *refRF = !isSignal ;2624 RecordFieldPtr<Int> subscanRF( rec, "SUB_SCAN" ) ;2625 *subscanRF = subscan ;2626 RecordFieldPtr<Double> noiseRF( rec, "CAL" ) ;2627 *noiseRF = tnoise ;2628 RecordFieldPtr<Double> loadRF( rec, "LOAD" ) ;2629 *loadRF = tload ;2630 row.put( nrow ) ;2631 idx = nrow ;2632 }2633 subscan++ ;2634 2635 // double endSec = mathutil::gettimeofday_sec() ;2636 // os_ << "end MSWriter::addState() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;2637 2638 return idx ;2639 }2640 2641 Vector<Int> MSWriter::toCorrType( Vector<Int> polnos )2642 {2643 // double startSec = mathutil::gettimeofday_sec() ;2644 // os_ << "start MSWriter::toCorrType() startSec=" << startSec << LogIO::POST ;2645 2646 uInt npol = polnos.size() ;2647 Vector<Int> corrType( npol, Stokes::Undefined ) ;2648 2649 if ( npol == 4 ) {2650 if ( polType_ == "linear" ) {2651 for ( uInt ipol = 0 ; ipol < npol ; ipol++ ) {2652 if ( polnos[ipol] == 0 )2653 corrType[ipol] = Stokes::XX ;2654 else if ( polnos[ipol] == 1 )2655 corrType[ipol] = Stokes::XY ;2656 else if ( polnos[ipol] == 2 )2657 corrType[ipol] = Stokes::YX ;2658 else if ( polnos[ipol] == 3 )2659 corrType[ipol] = Stokes::YY ;2660 }2661 }2662 else if ( polType_ == "circular" ) {2663 for ( uInt ipol = 0 ; ipol < npol ; ipol++ ) {2664 if ( polnos[ipol] == 0 )2665 corrType[ipol] = Stokes::RR ;2666 else if ( polnos[ipol] == 1 )2667 corrType[ipol] = Stokes::RL ;2668 else if ( polnos[ipol] == 2 )2669 corrType[ipol] = Stokes::LR ;2670 else if ( polnos[ipol] == 3 )2671 corrType[ipol] = Stokes::LL ;2672 }2673 }2674 else if ( polType_ == "stokes" ) {2675 for ( uInt ipol = 0 ; ipol < npol ; ipol++ ) {2676 if ( polnos[ipol] == 0 )2677 corrType[ipol] = Stokes::I ;2678 else if ( polnos[ipol] == 1 )2679 corrType[ipol] = Stokes::Q ;2680 else if ( polnos[ipol] == 2 )2681 corrType[ipol] = Stokes::U ;2682 else if ( polnos[ipol] == 3 )2683 corrType[ipol] = Stokes::V ;2684 }2685 }2686 }2687 else if ( npol == 2 ) {2688 if ( polType_ == "linear" ) {2689 for ( uInt ipol = 0 ; ipol < npol ; ipol++ ) {2690 if ( polnos[ipol] == 0 )2691 corrType[ipol] = Stokes::XX ;2692 else if ( polnos[ipol] == 1 )2693 corrType[ipol] = Stokes::YY ;2694 }2695 }2696 else if ( polType_ == "circular" ) {2697 for ( uInt ipol = 0 ; ipol < npol ; ipol++ ) {2698 if ( polnos[ipol] == 0 )2699 corrType[ipol] = Stokes::RR ;2700 else if ( polnos[ipol] == 1 )2701 corrType[ipol] = Stokes::LL ;2702 }2703 }2704 else if ( polType_ == "stokes" ) {2705 for ( uInt ipol = 0 ; ipol < npol ; ipol++ ) {2706 if ( polnos[ipol] == 0 )2707 corrType[ipol] = Stokes::I ;2708 else if ( polnos[ipol] == 1 )2709 corrType[ipol] = Stokes::V ;2710 }2711 }2712 else if ( polType_ == "linpol" ) {2713 for ( uInt ipol = 0 ; ipol < npol ; ipol++ ) {2714 if ( polnos[ipol] == 1 )2715 corrType[ipol] = Stokes::Plinear ;2716 else if ( polnos[ipol] == 2 )2717 corrType[ipol] = Stokes::Pangle ;2718 }2719 }2720 }2721 else if ( npol == 1 ) {2722 if ( polType_ == "linear" )2723 corrType[0] = Stokes::XX ;2724 else if ( polType_ == "circular" )2725 corrType[0] = Stokes::RR ;2726 else if ( polType_ == "stokes" )2727 corrType[0] = Stokes::I ;2728 }2729 2730 // double endSec = mathutil::gettimeofday_sec() ;2731 // os_ << "end MSWriter::toCorrType() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;2732 2733 return corrType ;2734 }2735 2736 2248 void MSWriter::getValidTimeRange( Double &me, Double &interval, Table &tab ) 2737 2249 { … … 2780 2292 } 2781 2293 2782 //void MSWriter::queryType( Int type, String &stype, Bool &b )2783 void MSWriter::queryType( Int type, String &stype, Bool &b, Double &t, Double &l )2784 {2785 // double startSec = mathutil::gettimeofday_sec() ;2786 // os_ << "start MSWriter::queryType() startSec=" << startSec << LogIO::POST ;2787 2788 // 2011/03/14 TN2789 // OBS_MODE string of MS created by importasdm task is slightly2790 // (but critically) changed.2791 // 2011/05/20 TN2792 // OBS_MODE string of MS created by importasdm task is changed2793 // again (separator is now "#" instead of "_"2794 String sep1="#" ;2795 String sep2="," ;2796 String target="OBSERVE_TARGET" ;2797 String atmcal="CALIBRATE_TEMPERATURE" ;2798 String onstr="ON_SOURCE" ;2799 String offstr="OFF_SOURCE" ;2800 String pswitch="POSITION_SWITCH" ;2801 String nod="NOD" ;2802 String fswitch="FREQUENCY_SWITCH" ;2803 String sigstr="SIG" ;2804 String refstr="REF" ;2805 String unspecified="UNSPECIFIED" ;2806 String ftlow="LOWER" ;2807 String fthigh="HIGHER" ;2808 switch ( type ) {2809 case SrcType::PSON:2810 //stype = "OBSERVE_TARGET_ON_SOURCE,POSITION_SWITCH" ;2811 stype = target+sep1+onstr+sep2+pswitch ;2812 b = True ;2813 t = 0.0 ;2814 l = 0.0 ;2815 break ;2816 case SrcType::PSOFF:2817 //stype = "OBSERVE_TARGET_OFF_SOURCE,POSITION_SWITCH" ;2818 stype = target+sep1+offstr+sep2+pswitch ;2819 b = False ;2820 t = 0.0 ;2821 l = 0.0 ;2822 break ;2823 case SrcType::NOD:2824 //stype = "OBSERVE_TARGET_ON_SOURCE,NOD" ;2825 stype = target+sep1+onstr+sep2+nod ;2826 b = True ;2827 t = 0.0 ;2828 l = 0.0 ;2829 break ;2830 case SrcType::FSON:2831 //stype = "OBSERVE_TARGET_ON_SOURCE,FREQUENCY_SWITCH_SIG" ;2832 stype = target+sep1+onstr+sep2+fswitch+sep1+sigstr ;2833 b = True ;2834 t = 0.0 ;2835 l = 0.0 ;2836 break ;2837 case SrcType::FSOFF:2838 //stype = "OBSERVE_TARGET_ON_SOURCE,FREQUENCY_SWITCH_REF" ;2839 stype = target+sep1+onstr+sep2+fswitch+sep1+refstr ;2840 b = False ;2841 t = 0.0 ;2842 l = 0.0 ;2843 break ;2844 case SrcType::SKY:2845 //stype = "CALIBRATE_TEMPERATURE_OFF_SOURCE,UNSPECIFIED" ;2846 stype = atmcal+sep1+offstr+sep2+unspecified ;2847 b = False ;2848 t = 0.0 ;2849 l = 1.0 ;2850 break ;2851 case SrcType::HOT:2852 //stype = "CALIBRATE_TEMPERATURE_OFF_SOURCE,UNSPECIFIED" ;2853 stype = atmcal+sep1+offstr+sep2+unspecified ;2854 b = False ;2855 t = 0.0 ;2856 l = 1.0 ;2857 break ;2858 case SrcType::WARM:2859 //stype = "CALIBRATE_TEMPERATURE_OFF_SOURCE,UNSPECIFIED" ;2860 stype = atmcal+sep1+offstr+sep2+unspecified ;2861 t = 0.0 ;2862 b = False ;2863 l = 1.0 ;2864 break ;2865 case SrcType::COLD:2866 //stype = "CALIBRATE_TEMPERATURE_OFF_SOURCE,UNSPECIFIED" ;2867 stype = atmcal+sep1+offstr+sep2+unspecified ;2868 b = False ;2869 t = 0.0 ;2870 l = 1.0 ;2871 break ;2872 case SrcType::PONCAL:2873 //stype = "CALIBRATE_TEMPERATURE_ON_SOURCE,POSITION_SWITCH" ;2874 stype = atmcal+sep1+onstr+sep2+pswitch ;2875 b = True ;2876 t = 1.0 ;2877 l = 0.0 ;2878 break ;2879 case SrcType::POFFCAL:2880 //stype = "CALIBRATE_TEMPERATURE_OFF_SOURCE,POSITION_SWITCH" ;2881 stype = atmcal+sep1+offstr+sep2+pswitch ;2882 b = False ;2883 t = 1.0 ;2884 l = 0.0 ;2885 break ;2886 case SrcType::NODCAL:2887 //stype = "CALIBRATE_TEMPERATURE_ON_SOURCE,NOD" ;2888 stype = atmcal+sep1+onstr+sep2+nod ;2889 b = True ;2890 t = 1.0 ;2891 l = 0.0 ;2892 break ;2893 case SrcType::FONCAL:2894 //stype = "CALIBRATE_TEMPERATURE_ON_SOURCE,FREQUENCY_SWITCH_SIG" ;2895 stype = atmcal+sep1+onstr+sep2+fswitch+sep1+sigstr ;2896 b = True ;2897 t = 1.0 ;2898 l = 0.0 ;2899 break ;2900 case SrcType::FOFFCAL:2901 //stype = "CALIBRATE_TEMPERATURE_OFF_SOURCE,FREQUENCY_SWITCH_REF" ;2902 stype = atmcal+sep1+offstr+sep2+fswitch+sep1+refstr ;2903 b = False ;2904 t = 1.0 ;2905 l = 0.0 ;2906 break ;2907 case SrcType::FSLO:2908 //stype = "OBSERVE_TARGET_ON_SOURCE,FREQUENCY_SWITCH_LOWER" ;2909 stype = target+sep1+onstr+sep2+fswitch+sep1+ftlow ;2910 b = True ;2911 t = 0.0 ;2912 l = 0.0 ;2913 break ;2914 case SrcType::FLOOFF:2915 //stype = "OBSERVE_TARGET_OFF_SOURCE,FREQUENCY_SWITCH_LOWER" ;2916 stype = target+sep1+offstr+sep2+fswitch+sep1+ftlow ;2917 b = False ;2918 t = 0.0 ;2919 l = 0.0 ;2920 break ;2921 case SrcType::FLOSKY:2922 //stype = "CALIBRATE_TEMPERATURE_OFF_SOURCE,FREQUENCY_SWITCH_LOWER" ;2923 stype = atmcal+sep1+offstr+sep2+fswitch+sep1+ftlow ;2924 b = False ;2925 t = 0.0 ;2926 l = 1.0 ;2927 break ;2928 case SrcType::FLOHOT:2929 //stype = "CALIBRATE_TEMPERATURE_OFF_SOURCE,FREQUENCY_SWITCH_LOWER" ;2930 stype = atmcal+sep1+offstr+sep2+fswitch+sep1+ftlow ;2931 b = False ;2932 t = 0.0 ;2933 l = 1.0 ;2934 break ;2935 case SrcType::FLOWARM:2936 //stype = "CALIBRATE_TEMPERATURE_OFF_SOURCE,FREQUENCY_SWITCH_LOWER" ;2937 stype = atmcal+sep1+offstr+sep2+fswitch+sep1+ftlow ;2938 b = False ;2939 t = 0.0 ;2940 l = 1.0 ;2941 break ;2942 case SrcType::FLOCOLD:2943 //stype = "CALIBRATE_TEMPERATURE_OFF_SOURCE,FREQUENCY_SWITCH_LOWER" ;2944 stype = atmcal+sep1+offstr+sep2+fswitch+sep1+ftlow ;2945 b = False ;2946 t = 0.0 ;2947 l = 1.0 ;2948 break ;2949 case SrcType::FSHI:2950 //stype = "OBSERVE_TARGET_ON_SOURCE,FREQUENCY_SWITCH_HIGHER" ;2951 stype = target+sep1+onstr+sep2+fswitch+sep1+fthigh ;2952 b = True ;2953 t = 0.0 ;2954 l = 0.0 ;2955 break ;2956 case SrcType::FHIOFF:2957 //stype = "CALIBRATE_TEMPERATURE_OFF_SOURCE,FREQUENCY_SWITCH_HIGHER" ;2958 stype = target+sep1+offstr+sep2+fswitch+sep1+fthigh ;2959 b = False ;2960 t = 0.0 ;2961 l = 0.0 ;2962 break ;2963 case SrcType::FHISKY:2964 //stype = "CALIBRATE_TEMPERATURE_OFF_SOURCE,FREQUENCY_SWITCH_HIGHER" ;2965 stype = atmcal+sep1+offstr+sep2+fswitch+sep1+fthigh ;2966 b = False ;2967 t = 0.0 ;2968 l = 1.0 ;2969 break ;2970 case SrcType::FHIHOT:2971 //stype = "CALIBRATE_TEMPERATURE_OFF_SOURCE,FREQUENCY_SWITCH_HIGHER" ;2972 stype = atmcal+sep1+offstr+sep2+fswitch+sep1+fthigh ;2973 b = False ;2974 t = 0.0 ;2975 l = 1.0 ;2976 break ;2977 case SrcType::FHIWARM:2978 //stype = "CALIBRATE_TEMPERATURE_OFF_SOURCE,FREQUENCY_SWITCH_HIGHER" ;2979 stype = atmcal+sep1+offstr+sep2+fswitch+sep1+fthigh ;2980 b = False ;2981 t = 0.0 ;2982 l = 1.0 ;2983 break ;2984 case SrcType::FHICOLD:2985 //stype = "CALIBRATE_TEMPERATURE_OFF_SOURCE,FREQUENCY_SWITCH_HIGHER" ;2986 stype = atmcal+sep1+offstr+sep2+fswitch+sep1+fthigh ;2987 b = False ;2988 t = 0.0 ;2989 l = 1.0 ;2990 break ;2991 case SrcType::SIG:2992 //stype = "OBSERVE_TARGET_ON_SOURCE,UNSPECIFIED" ;2993 stype = target+sep1+onstr+sep2+unspecified ;2994 b = True ;2995 t = 0.0 ;2996 l = 0.0 ;2997 break ;2998 case SrcType::REF:2999 //stype = "OBSERVE_TARGET_ON_SOURCE,UNSPECIFIED" ;3000 stype = target+sep1+offstr+sep2+unspecified ;3001 b = False ;3002 t = 0.0 ;3003 l = 0.0 ;3004 break ;3005 default:3006 //stype = "UNSPECIFIED" ;3007 stype = unspecified ;3008 b = True ;3009 t = 0.0 ;3010 l = 0.0 ;3011 break ;3012 }3013 3014 // double endSec = mathutil::gettimeofday_sec() ;3015 // os_ << "end MSWriter::queryType() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;3016 2294 } 3017 3018 Double MSWriter::getDishDiameter( String antname )3019 {3020 Double diameter = 0.0 ;3021 3022 antname.upcase() ;3023 3024 if ( antname.matches( Regex( "DV[0-9]+$" ) )3025 || antname.matches( Regex( "DA[0-9]+$" ) )3026 || antname.matches( Regex( "PM[0-9]+$" ) ) )3027 diameter = 12.0 ;3028 else if ( antname.matches( Regex( "CM[0-9]+$" ) ) )3029 diameter = 7.0 ;3030 else if ( antname.contains( "GBT" ) )3031 diameter = 104.9 ;3032 else if ( antname.contains( "MOPRA" ) )3033 diameter = 22.0 ;3034 else if ( antname.contains( "PKS" ) || antname.contains( "PARKS" ) )3035 diameter = 64.0 ;3036 else if ( antname.contains( "TIDBINBILLA" ) )3037 diameter = 70.0 ;3038 else if ( antname.contains( "CEDUNA" ) )3039 diameter = 30.0 ;3040 else if ( antname.contains( "HOBART" ) )3041 diameter = 26.0 ;3042 else if ( antname.contains( "APEX" ) )3043 diameter = 12.0 ;3044 else if ( antname.contains( "ASTE" ) )3045 diameter = 10.0 ;3046 else if ( antname.contains( "NRO" ) )3047 diameter = 45.0 ;3048 else3049 diameter = 1.0 ;3050 3051 return diameter ;3052 }3053 3054 void MSWriter::infillSpectralWindow()3055 {3056 MSSpectralWindow msSpw = mstable_->spectralWindow() ;3057 MSSpWindowColumns msSpwCols( msSpw ) ;3058 uInt nrow = msSpw.nrow() ;3059 3060 ScalarColumn<Int> measFreqRefCol = msSpwCols.measFreqRef() ;3061 ArrayColumn<Double> chanFreqCol = msSpwCols.chanFreq() ;3062 ArrayColumn<Double> chanWidthCol = msSpwCols.chanWidth() ;3063 ArrayColumn<Double> effectiveBWCol = msSpwCols.effectiveBW() ;3064 ArrayColumn<Double> resolutionCol = msSpwCols.resolution() ;3065 Vector<Double> dummy( 1, 0.0 ) ;3066 for ( uInt irow = 0 ; irow < nrow ; irow++ ) {3067 if ( !(chanFreqCol.isDefined( irow )) ) {3068 measFreqRefCol.put( irow, 1 ) ;3069 chanFreqCol.put( irow, dummy ) ;3070 chanWidthCol.put( irow, dummy ) ;3071 effectiveBWCol.put( irow, dummy ) ;3072 resolutionCol.put( irow, dummy ) ;3073 }3074 }3075 3076 }3077 3078 } -
trunk/src/MSWriter.h
r2291 r2293 86 86 void fillSysCal( std::map< casa::Int,casa::Vector<casa::uInt> > &idrec, 87 87 std::map< casa::Int,casa::Vector<casa::uInt> > &rowrec ) ; 88 // void fillSysCal( Record &idrec, Record &rowrec ) ;89 // void fillSysCal() ;90 91 // fill empty rows92 void infillSpectralWindow() ;93 94 // add rows to subtables95 void addFeed( casa::Int id ) ;96 void addSpectralWindow( casa::Int spwid, casa::Int freqid ) ;97 void addField( casa::Int fid, casa::String fieldname, casa::String srcname, casa::Double t, casa::Vector<casa::Double> scanrate ) ;98 void addPointing( casa::String &name, casa::Double &me, casa::Double &interval, casa::Matrix<casa::Double> &dir ) ;99 casa::Int addPolarization( casa::Vector<casa::Int> polnos ) ;100 casa::Int addDataDescription( casa::Int polid, casa::Int spwid ) ;101 casa::Int addState( casa::Int type, casa::Int &subscan ) ;102 88 103 89 // utility 104 casa::Vector<casa::Int> toCorrType( casa::Vector<casa::Int> polnos ) ;105 90 void getValidTimeRange( casa::Double &me, casa::Double &interval, casa::Table &tab ) ; 106 91 void getValidTimeRange( casa::Double &me, casa::Double &interval, casa::Vector<casa::Double> &atime, casa::Vector<casa::Double> &ainterval ) ; 107 //void queryType( casa::Int type, casa::String &stype, casa::Bool &b ) ;108 void queryType( casa::Int type, casa::String &stype, casa::Bool &b, casa::Double &t, Double &l ) ;109 casa::Double getDishDiameter( casa::String antname ) ;110 92 void antennaProperty( casa::String &name, casa::String &mount, casa::String &type, casa::Double &diameter ) ; 111 93 … … 115 97 casa::CountedPtr<Scantable> table_ ; 116 98 STHeader header_ ; 117 //casa::CountedPtr<casa::MeasurementSet> mstable_ ;118 99 casa::MeasurementSet *mstable_ ; 119 100 … … 134 115 casa::LogIO os_ ; 135 116 136 // casa::Record tcalIdRec_ ;137 // casa::Record tcalRowRec_ ;138 117 casa::Record srcRec_ ; 139 118
Note:
See TracChangeset
for help on using the changeset viewer.