Changeset 1693 for branches/alma


Ignore:
Timestamp:
02/10/10 19:39:06 (14 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-1908

Ready to Release: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes

Module(s): Module Names change impacts.

Description: Describe your changes here...

Changed a tagging as the source type is tagged by using SRCTYPE, not
an extra string in SRCNAME. To do this, I have defined a selection method
by SRCTYPE in STSelector class. I have newly added python_SrcType.cpp
that defines a Python interface of SrcType? enums which is defined
in atnf/PKSIO/SrcType.h.

Since I have added new file in the src directory, I have modified src/Makefile
to compile new file.

Location:
branches/alma
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • branches/alma/python/asapmath.py

    r1686 r1693  
    184184    varlist = vars()
    185185    # check for the appropriate data
    186     s = scantab.get_scan('*_ps*')
    187     if s is None:
     186##    s = scantab.get_scan('*_ps*')
     187##     if s is None:
     188##         msg = "The input data appear to contain no position-switch mode data."
     189##         if rcParams['verbose']:
     190##             #print msg
     191##             asaplog.push(msg)
     192##             print_log('ERROR')
     193##             return
     194##         else:
     195##             raise TypeError(msg)
     196    s = scantab.copy()
     197    from asap._asap import srctype
     198    sel = selector()
     199    sel.set_types( srctype.pson )
     200    try:
     201        scantab.set_selection( sel )
     202    except Exception, e:
    188203        msg = "The input data appear to contain no position-switch mode data."
    189204        if rcParams['verbose']:
     
    194209        else:
    195210            raise TypeError(msg)
     211    s.set_selection()
     212    sel.reset()
    196213    ssub = s.get_scan(scannos)
    197214    if ssub is None:
     
    204221        else:
    205222            raise TypeError(msg)
    206     ssubon = ssub.get_scan('*calon')
    207     ssuboff = ssub.get_scan('*[^calon]')
     223    #ssubon = ssub.get_scan('*calon')
     224    #ssuboff = ssub.get_scan('*[^calon]')
     225    sel.set_types( [srctype.poncal,srctype.poffcal] )
     226    ssub.set_selection( sel )
     227    ssubon = ssub.copy()
     228    ssub.set_selection()
     229    sel.reset()
     230    sel.set_types( [srctype.pson,srctype.psoff] )
     231    ssub.set_selection( sel )
     232    ssuboff = ssub.copy()
     233    ssub.set_selection()
     234    sel.reset()
    208235    if ssubon.nrow() != ssuboff.nrow():
    209236        msg = "mismatch in numbers of CAL on/off scans. Cannot calibrate. Check the scan numbers."
     
    216243            raise TypeError(msg)
    217244    cals = dototalpower(ssubon, ssuboff, tcalval)
    218     sig = cals.get_scan('*ps')
    219     ref = cals.get_scan('*psr')
     245    #sig = cals.get_scan('*ps')
     246    #ref = cals.get_scan('*psr')
     247    sel.set_types( srctype.pson )
     248    cals.set_selection( sel )
     249    sig = cals.copy()
     250    cals.set_selection()
     251    sel.reset()
     252    sel.set_types( srctype.psoff )
     253    cals.set_selection( sel )
     254    ref = cals.copy()
     255    cals.set_selection()
     256    sel.reset()
    220257    if sig.nscan() != ref.nscan():
    221258        msg = "mismatch in numbers of on/off scans. Cannot calibrate. Check the scan numbers."
     
    261298        postcal=[]
    262299        keys=['ps','ps_calon','psr','psr_calon']
     300        types=[srctype.pson,srctype.poncal,srctype.psoff,srctype.poffcal]
    263301        ifnos=list(ssub.getifnos())
    264302        polnos=list(ssub.getpolnos())
    265303        sel=selector()
    266304        for i in range(2):
    267             ss=ssuboff.get_scan('*'+keys[2*i])
     305            #ss=ssuboff.get_scan('*'+keys[2*i])
    268306            ll=[]
    269307            for j in range(len(ifnos)):
     
    271309                    sel.set_ifs(ifnos[j])
    272310                    sel.set_polarizations(polnos[k])
     311                    sel.set_types(types[2*i])
    273312                    try:
    274                         ss.set_selection(sel)
     313                        #ss.set_selection(sel)
     314                        ssuboff.set_selection(sel)
    275315                    except:
    276316                        continue
    277                     ll.append(numpy.array(ss._getspectrum(0)))
     317                    #ll.append(numpy.array(ss._getspectrum(0)))
     318                    ll.append(numpy.array(ssuboff._getspectrum(0)))
    278319                    sel.reset()
    279                     ss.set_selection()
     320                    ssuboff.set_selection()
    280321            precal[keys[2*i]]=ll
    281             del ss
    282             ss=ssubon.get_scan('*'+keys[2*i+1])
     322            #del ss
     323            #ss=ssubon.get_scan('*'+keys[2*i+1])
    283324            ll=[]
    284325            for j in range(len(ifnos)):
     
    286327                    sel.set_ifs(ifnos[j])
    287328                    sel.set_polarizations(polnos[k])
     329                    sel.set_types(types[2*i+1])
    288330                    try:
    289                         ss.set_selection(sel)
     331                        #ss.set_selection(sel)
     332                        ssubon.set_selection(sel)
    290333                    except:
    291334                        continue
    292                     ll.append(numpy.array(ss._getspectrum(0)))
     335                    #ll.append(numpy.array(ss._getspectrum(0)))
     336                    ll.append(numpy.array(ssubon._getspectrum(0)))
    293337                    sel.reset()
    294                     ss.set_selection()
     338                    ssubon.set_selection()
    295339            precal[keys[2*i+1]]=ll
    296             del ss
     340            #del ss
    297341        for j in range(len(ifnos)):
    298342            for k in range(len(polnos)):
     
    413457    varlist = vars()
    414458    from asap._asap import stmath
     459    from asap._asap import srctype
    415460    stm = stmath()
    416461    stm._setinsitu(False)
    417462
    418463    # check for the appropriate data
    419     s = scantab.get_scan('*_nod*')
    420     if s is None:
     464##     s = scantab.get_scan('*_nod*')
     465##     if s is None:
     466##         msg = "The input data appear to contain no Nod observing mode data."
     467##         if rcParams['verbose']:
     468##             #print msg
     469##             asaplog.push(msg)
     470##             print_log('ERROR')
     471##             return
     472##         else:
     473##             raise TypeError(msg)
     474    s = scantab.copy()
     475    sel = selector()
     476    sel.set_types( srctype.nod )
     477    try:
     478        s.set_selection( sel )
     479    except Exception, e:
    421480        msg = "The input data appear to contain no Nod observing mode data."
    422481        if rcParams['verbose']:
     
    427486        else:
    428487            raise TypeError(msg)
     488    sel.reset()
     489    del sel
     490    del s
    429491
    430492    # need check correspondance of each beam with sig-ref ...
     
    475537        precal={}
    476538        postcal=[]
    477         keys=['nod','nod_calon']
     539        keys=['','_calon']
     540        types=[srctype.nod,srctype.nodcal]
    478541        ifnos=list(scantab.getifnos())
    479542        polnos=list(scantab.getpolnos())
    480543        sel=selector()
     544        ss = scantab.copy()
    481545        for i in range(2):
    482             ss=scantab.get_scan('*'+keys[i])
     546            #ss=scantab.get_scan('*'+keys[i])
    483547            ll=[]
    484548            ll2=[]
     
    488552                    sel.set_polarizations(polnos[k])
    489553                    sel.set_scans(pairScans[0])
     554                    sel.set_types(types[i])
    490555                    try:
    491556                        ss.set_selection(sel)
     
    498563                    sel.set_polarizations(polnos[k])
    499564                    sel.set_scans(pairScans[1])
     565                    sel.set_types(types[i])
    500566                    try:
    501567                        ss.set_selection(sel)
     
    506572                    sel.reset()
    507573                    ss.set_selection()
    508             key='%s%s' %(pairScans[0],keys[i].lstrip('nod'))
     574            key='%s%s' %(pairScans[0],keys[i])
    509575            precal[key]=ll
    510             key='%s%s' %(pairScans[1],keys[i].lstrip('nod'))
     576            key='%s%s' %(pairScans[1],keys[i])
    511577            precal[key]=ll2
    512             del ss
     578            #del ss
    513579        keys=precal.keys()
    514580        for j in range(len(ifnos)):
     
    638704    varlist = vars()
    639705    from asap._asap import stmath
     706    from asap._asap import srctype
    640707    stm = stmath()
    641708    stm._setinsitu(False)
     
    657724        # get data
    658725        ssub = s.get_scan(scannos)
    659         ssubon = ssub.get_scan('*calon')
    660         ssuboff = ssub.get_scan('*[^calon]')
     726        #ssubon = ssub.get_scan('*calon')
     727        #ssuboff = ssub.get_scan('*[^calon]')
     728        sel = selector()
     729        sel.set_types( [srctype.foncal,srctype.foffcal] )
     730        ssub.set_selection( sel )
     731        ssubon = ssub.copy()
     732        ssub.set_selection()
     733        sel.reset()
     734        sel.set_types( [srctype.fson,srctype.fsoff] )
     735        ssub.set_selection( sel )
     736        ssuboff = ssub.copy()
     737        ssub.set_selection()
     738        sel.reset()
    661739        import numpy
    662740        precal={}
    663741        postcal=[]
    664742        keys=['fs','fs_calon','fsr','fsr_calon']
     743        types=[srctype.fson,srctype.foncal,srctype.fsoff,srctype.foffcal]
    665744        ifnos=list(ssub.getifnos())
    666745        polnos=list(ssub.getpolnos())
    667         sel=selector()
    668746        for i in range(2):
    669             ss=ssuboff.get_scan('*'+keys[2*i])
     747            #ss=ssuboff.get_scan('*'+keys[2*i])
    670748            ll=[]
    671749            for j in range(len(ifnos)):
     
    673751                    sel.set_ifs(ifnos[j])
    674752                    sel.set_polarizations(polnos[k])
     753                    sel.set_types(types[2*i])
    675754                    try:
    676                         ss.set_selection(sel)
     755                        #ss.set_selection(sel)
     756                        ssuboff.set_selection(sel)
    677757                    except:
    678758                        continue
    679759                    ll.append(numpy.array(ss._getspectrum(0)))
    680760                    sel.reset()
    681                     ss.set_selection()
     761                    #ss.set_selection()
     762                    ssuboff.set_selection()
    682763            precal[keys[2*i]]=ll
    683             del ss
    684             ss=ssubon.get_scan('*'+keys[2*i+1])
     764            #del ss
     765            #ss=ssubon.get_scan('*'+keys[2*i+1])
    685766            ll=[]
    686767            for j in range(len(ifnos)):
     
    688769                    sel.set_ifs(ifnos[j])
    689770                    sel.set_polarizations(polnos[k])
     771                    sel.set_types(types[2*i+1])
    690772                    try:
    691                         ss.set_selection(sel)
     773                        #ss.set_selection(sel)
     774                        ssubon.set_selection(sel)
    692775                    except:
    693776                        continue
    694777                    ll.append(numpy.array(ss._getspectrum(0)))
    695778                    sel.reset()
    696                     ss.set_selection()
     779                    #ss.set_selection()
     780                    ssubon.set_selection()
    697781            precal[keys[2*i+1]]=ll
    698             del ss
    699         sig=resspec.get_scan('*_fs')
    700         ref=resspec.get_scan('*_fsr')
     782            #del ss
     783        #sig=resspec.get_scan('*_fs')
     784        #ref=resspec.get_scan('*_fsr')
     785        sel.set_types( srctype.fson )
     786        resspec.set_selection( sel )
     787        sig=resspec.copy()
     788        resspec.set_selection()
     789        sel.reset()
     790        sel.set_type( srctype.fsoff )
     791        resspec.set_selection( sel )
     792        ref=resspec.copy()
     793        resspec.set_selection()
     794        sel.reset()
    701795        for k in range(len(polnos)):
    702796            for j in range(len(ifnos)):
  • branches/alma/python/selector.py

    r1639 r1693  
    159159        if isinstance(vec,list):
    160160            self._setrows(vec)
     161        else:
     162            raise TypeError('Unknown row number type. Use lists of integers.')
     163
     164    def set_types(self, types=[]):
     165        """
     166        Set a sequence of source types.
     167        Parameters:
     168            types:    a list of integers. Default [] is to unset the selection.
     169        """
     170        vec = _to_list(types, int)
     171        if isinstance(vec,list):
     172            self._settypes(vec)
    161173        else:
    162174            raise TypeError('Unknown row number type. Use lists of integers.')
     
    176188    def get_order(self):
    177189        return list(self._getorder())
     190    def get_types(self):
     191        return list(self._gettypes())
    178192    def get_query(self):
    179193        prefix = "SELECT FROM $1 WHERE "
  • branches/alma/src/Makefile

    r1608 r1693  
    134134             python_STWriter.o \
    135135             python_LineCatalog.o \
     136             python_SrcType.o \
    136137             python_asap.o
    137138
  • branches/alma/src/STMath.cpp

    r1682 r1693  
    4343#include <scimath/Mathematics/Convolver.h>
    4444#include <scimath/Functionals/Polynomial.h>
     45
     46#include <atnf/PKSIO/SrcType.h>
    4547
    4648#include <casa/Logging/LogIO.h>
     
    819821  // make this operation non insitu
    820822  const Table& tin = in->table();
    821   Table ons = tin(tin.col("SRCTYPE") == Int(0));
    822   Table offs = tin(tin.col("SRCTYPE") == Int(1));
     823  Table ons = tin(tin.col("SRCTYPE") == Int(SrcType::PSON));
     824  Table offs = tin(tin.col("SRCTYPE") == Int(SrcType::PSOFF));
    823825  if ( offs.nrow() == 0 )
    824826    throw(AipsError("No 'off' scans present."));
     
    12031205  setInsitu(false);
    12041206  STSelector sel;
    1205   std::vector<int> scan1, scan2, beams;
     1207  std::vector<int> scan1, scan2, beams, types;
    12061208  std::vector< vector<int> > scanpair;
    1207   std::vector<string> calstate;
     1209  //std::vector<string> calstate;
     1210  std::vector<int> calstate;
    12081211  String msg;
    12091212
     
    12521255  scanpair.push_back(scan1);
    12531256  scanpair.push_back(scan2);
    1254   calstate.push_back("*calon");
    1255   calstate.push_back("*[^calon]");
     1257  //calstate.push_back("*calon");
     1258  //calstate.push_back("*[^calon]");
     1259  calstate.push_back(SrcType::NODCAL);
     1260  calstate.push_back(SrcType::NOD);
    12561261  CountedPtr< Scantable > ws = getScantable(s, false);
    12571262  uInt l=0;
     
    12621267          sel.reset();
    12631268          sel.setScans(scanpair[i]);
    1264           sel.setName(calstate[k]);
     1269          //sel.setName(calstate[k]);
     1270          types.clear();
     1271          types.push_back(calstate[k]);
     1272          sel.setTypes(types);
    12651273          beams.clear();
    12661274          beams.push_back(j);
     
    13771385  CountedPtr< Scantable > calsig, calref, out, out1, out2;
    13781386  Bool nofold=False;
     1387  vector<int> types ;
    13791388
    13801389  //split the data
    1381   sel.setName("*_fs");
     1390  //sel.setName("*_fs");
     1391  types.push_back( SrcType::FSON ) ;
     1392  sel.setTypes( types ) ;
    13821393  ws->setSelection(sel);
    13831394  sig = getScantable(ws,false);
    13841395  sel.reset();
    1385   sel.setName("*_fs_calon");
     1396  types.clear() ;
     1397  //sel.setName("*_fs_calon");
     1398  types.push_back( SrcType::FONCAL ) ;
     1399  sel.setTypes( types ) ;
    13861400  ws->setSelection(sel);
    13871401  sigwcal = getScantable(ws,false);
    13881402  sel.reset();
    1389   sel.setName("*_fsr");
     1403  types.clear() ;
     1404  //sel.setName("*_fsr");
     1405  types.push_back( SrcType::FSOFF ) ;
     1406  sel.setTypes( types ) ;
    13901407  ws->setSelection(sel);
    13911408  ref = getScantable(ws,false);
    13921409  sel.reset();
    1393   sel.setName("*_fsr_calon");
     1410  types.clear() ;
     1411  //sel.setName("*_fsr_calon");
     1412  types.push_back( SrcType::FOFFCAL ) ;
     1413  sel.setTypes( types ) ;
    13941414  ws->setSelection(sel);
    13951415  refwcal = getScantable(ws,false);
     1416  sel.reset() ;
     1417  types.clear() ;
    13961418
    13971419  calsig = dototalpower(sigwcal, sig, tcal=tcal);
     
    35403562  }
    35413563  else {
    3542     string skystr = "*_sky" ;
    3543     string hotstr = "*_hot" ;
    3544     string coldstr = "*_cold" ;
    3545     string onstr = "*_" ;
    3546     string offstr = "*_" ;
    3547    
    3548     if ( calmode == "ps" || calmode == "otf" ) {
    3549       onstr += "pson" ;
    3550       offstr += "psoff" ;
    3551     }
    3552     else if ( calmode == "wob" ) {
    3553       onstr += "wobon" ;
    3554       offstr += "woboff" ;
    3555     }
    3556    
    35573564    vector<bool> masks = s->getMask( 0 ) ;
    3558    
     3565    vector<int> types ;
     3566
    35593567    // sky scan
    35603568    STSelector sel = STSelector() ;
    3561     sel.setName( skystr ) ;
     3569    types.push_back( SrcType::SKY ) ;
     3570    sel.setTypes( types ) ;
    35623571    s->setSelection( sel ) ;
    35633572    vector< CountedPtr<Scantable> > tmp( 1, getScantable( s, false ) ) ;
     
    35653574    s->unsetSelection() ;
    35663575    sel.reset() ;
     3576    types.clear() ;
    35673577
    35683578    // hot scan
    3569     sel.setName( hotstr ) ;
     3579    types.push_back( SrcType::HOT ) ;
     3580    sel.setTypes( types ) ;
    35703581    s->setSelection( sel ) ;
    3571     tmp[0] = getScantable( s, false ) ;
     3582    tmp.clear() ;
     3583    tmp.push_back( getScantable( s, false ) ) ;
    35723584    CountedPtr<Scantable> ahot = average( tmp, masks, "TINT", "SCAN" ) ;
    35733585    s->unsetSelection() ;
    35743586    sel.reset() ;
     3587    types.clear() ;
    35753588   
    35763589    // cold scan
    3577     sel.setName( coldstr ) ;
     3590    CountedPtr<Scantable> acold ;
     3591//     types.push_back( SrcType::COLD ) ;
     3592//     sel.setTypes( types ) ;
     3593//     s->setSelection( sel ) ;
     3594//     tmp.clear() ;
     3595//     tmp.push_back( getScantable( s, false ) ) ;
     3596//     CountedPtr<Scantable> acold = average( tmp, masks, "TINT", "SCNAN" ) ;
     3597//     s->unsetSelection() ;
     3598//     sel.reset() ;
     3599//     types.clear() ;
     3600
     3601    // off scan
     3602    types.push_back( SrcType::PSOFF ) ;
     3603    sel.setTypes( types ) ;
    35783604    s->setSelection( sel ) ;
    3579     tmp[0] = getScantable( s, false ) ;
    3580     CountedPtr<Scantable> acold = average( tmp, masks, "TINT", "SCNAN" ) ;
    3581     s->unsetSelection() ;
    3582     sel.reset() ;
    3583 
    3584     // off scan
    3585     sel.setName( offstr ) ;
    3586     s->setSelection( sel ) ;
    3587     tmp[0] = getScantable( s, false ) ;
     3605    tmp.clear() ;
     3606    tmp.push_back( getScantable( s, false ) ) ;
    35883607    CountedPtr<Scantable> aoff = average( tmp, masks, "TINT", "SCAN" ) ;
    35893608    s->unsetSelection() ;
    35903609    sel.reset() ;
     3610    types.clear() ;
    35913611   
    35923612    // on scan
     
    35953615    CountedPtr<Scantable> out = getScantable( s, true ) ;
    35963616    insitu_ = insitu ;
    3597     sel.setName( onstr ) ;
     3617    types.push_back( SrcType::PSON ) ;
     3618    sel.setTypes( types ) ;
    35983619    s->setSelection( sel ) ;
    35993620    TableCopy::copyRows( out->table(), s->table() ) ;
    36003621    s->unsetSelection() ;
    36013622    sel.reset() ;
     3623    types.clear() ;
    36023624   
    36033625    // process each on scan
     
    36223644    }
    36233645
    3624     // remove additional string from SRCNAME
    3625     ScalarColumn<String> srcnameCol ;
    3626     srcnameCol.attach( out->table(), "SRCNAME" ) ;
    3627     Vector<String> srcnames( srcnameCol.getColumn() ) ;
    3628     for ( uInt i = 0 ; i < srcnames.nelements() ; i++ ) {
    3629       srcnames[i] = srcnames[i].substr( 0, srcnames[i].find( onstr.substr(1,onstr.size()-1) ) ) ;
    3630     }
    3631     srcnameCol.putColumn( srcnames ) ;
    3632 
    36333646    // flux unit
    36343647    out->setFluxUnit( "K" ) ;
     
    36503663    // off scan
    36513664    STSelector sel = STSelector() ;
    3652     string taql = "SELECT FROM $1 WHERE SRCTYPE == 1" ;
    3653     sel.setTaQL( taql ) ;
     3665    vector<int> types ;
     3666    types.push_back( SrcType::PSOFF ) ;
     3667    sel.setTypes( types ) ;
    36543668    s->setSelection( sel ) ;
    36553669    // TODO 2010/01/08 TN
     
    36923706    s->unsetSelection() ;
    36933707    sel.reset() ;
     3708    types.clear() ;
    36943709   
    36953710    // on scan
     
    36983713    CountedPtr<Scantable> out = getScantable( s, true ) ;
    36993714    insitu_ = insitu ;
    3700     taql = "SELECT FROM $1 WHERE SRCTYPE == 0" ;
    3701     sel.setTaQL( taql ) ;
     3715    types.push_back( SrcType::PSON ) ;
     3716    sel.setTypes( types ) ;
    37023717    s->setSelection( sel ) ;
    37033718    TableCopy::copyRows( out->table(), s->table() ) ;
    37043719    s->unsetSelection() ;
    37053720    sel.reset() ;
     3721    types.clear() ;
    37063722   
    37073723    // process each on scan
     
    37233739                                       const String antname )
    37243740{
    3725   string skystr = "*_sky" ;
    3726   string skystr1 = "*_fslo_sky" ;
    3727   string skystr2 = "*_fshi_sky" ;
    3728   string hotstr = "*_hot" ;
    3729   string hotstr1 = "*_fslo_hot" ;
    3730   string hotstr2 = "*_fshi_hot" ;
    3731   string coldstr = "*_cold" ;
    3732   string coldstr1 = "*_fslo_cold" ;
    3733   string coldstr2 = "*_fshi_cold" ;
    3734   string offstr1 = "*_fslo_off" ;
    3735   string offstr2 = "*_fshi_off" ;
    3736   string sigstr = "*_" ;
    3737   string refstr = "*_" ;
     3741  vector<int> types ;
    37383742
    37393743  // APEX calibration mode
     
    37413745 
    37423746  if ( antname.find( "APEX" ) != string::npos ) {
    3743     sigstr += "fslo" ;
    3744     refstr += "fshi" ;   
    3745 
    37463747    // check if off scan exists or not
    37473748    STSelector sel = STSelector() ;
    3748     sel.setName( offstr1 ) ;
     3749    //sel.setName( offstr1 ) ;
     3750    types.push_back( SrcType::FLOOFF ) ;
     3751    sel.setTypes( types ) ;
    37493752    try {
    37503753      s->setSelection( sel ) ;
     
    37533756      apexcalmode = 0 ;
    37543757    }
    3755   }
    3756   else {
    3757     sigstr += "fssig" ;
    3758     refstr += "fsref" ;
    3759   }
     3758    sel.reset() ;
     3759  }
     3760  s->unsetSelection() ;
     3761  types.clear() ;
    37603762
    37613763  vector<bool> masks = s->getMask( 0 ) ;
     
    37633765  CountedPtr<Scantable> out ;
    37643766
    3765   if ( antname.find( "APEX" ) != string::npos && apexcalmode == 0 ) {
    3766     // APEX fs data without off scan
     3767  if ( antname.find( "APEX" ) != string::npos ) {
     3768    // APEX calibration
    37673769    // sky scan
    37683770    STSelector sel = STSelector() ;
    3769     sel.setName( skystr1 ) ;
     3771    types.push_back( SrcType::FLOSKY ) ;
     3772    sel.setTypes( types ) ;
    37703773    s->setSelection( sel ) ;
    37713774    vector< CountedPtr<Scantable> > tmp( 1, getScantable( s, false ) ) ;
     
    37733776    s->unsetSelection() ;
    37743777    sel.reset() ;
    3775     sel.setName( skystr2 ) ;
     3778    types.clear() ;
     3779    types.push_back( SrcType::FHISKY ) ;
     3780    sel.setTypes( types ) ;
    37763781    s->setSelection( sel ) ;
    3777     tmp[0] = getScantable( s, false ) ;
     3782    tmp.clear() ;
     3783    tmp.push_back( getScantable( s, false ) ) ;
    37783784    CountedPtr<Scantable> askyhi = average( tmp, masks, "TINT", "SCAN" ) ;
    37793785    s->unsetSelection() ;
    37803786    sel.reset() ;
     3787    types.clear() ;
    37813788   
    37823789    // hot scan
    3783     sel.setName( hotstr1 ) ;
     3790    types.push_back( SrcType::FLOHOT ) ;
     3791    sel.setTypes( types ) ;
    37843792    s->setSelection( sel ) ;
    3785     tmp[0] = getScantable( s, false ) ;
     3793    tmp.clear() ;
     3794    tmp.push_back( getScantable( s, false ) ) ;
    37863795    CountedPtr<Scantable> ahotlo = average( tmp, masks, "TINT", "SCAN" ) ;
    37873796    s->unsetSelection() ;
    37883797    sel.reset() ;
    3789     sel.setName( hotstr2 ) ;
     3798    types.clear() ;
     3799    types.push_back( SrcType::FHIHOT ) ;
     3800    sel.setTypes( types ) ;
    37903801    s->setSelection( sel ) ;
    3791     tmp[0] = getScantable( s, false ) ;
     3802    tmp.clear() ;
     3803    tmp.push_back( getScantable( s, false ) ) ;
    37923804    CountedPtr<Scantable> ahothi = average( tmp, masks, "TINT", "SCAN" ) ;
    37933805    s->unsetSelection() ;
    37943806    sel.reset() ;
     3807    types.clear() ;
    37953808   
    37963809    // cold scan
    3797     sel.setName( coldstr1 ) ;
    3798     s->setSelection( sel ) ;
    3799     tmp[0] = getScantable( s, false ) ;
    3800     CountedPtr<Scantable> acoldlo = average( tmp, masks, "TINT", "SCAN" ) ;
    3801     s->unsetSelection() ;
    3802     sel.reset() ;
    3803     sel.setName( coldstr2 ) ;
    3804     s->setSelection( sel ) ;
    3805     tmp[0] = getScantable( s, false ) ;
    3806     CountedPtr<Scantable> acoldhi = average( tmp, masks, "TINT", "SCAN" ) ;
    3807     s->unsetSelection() ;
    3808     sel.reset() ;
    3809    
     3810    CountedPtr<Scantable> acoldlo, acoldhi ;
     3811//     types.push_back( SrcType::FLOCOLD ) ;
     3812//     sel.setTypes( types ) ;
     3813//     s->setSelection( sel ) ;
     3814//     tmp.clear() ;
     3815//     tmp.push_back( getScantable( s, false ) ) ;
     3816//     CountedPtr<Scantable> acoldlo = average( tmp, masks, "TINT", "SCAN" ) ;
     3817//     s->unsetSelection() ;
     3818//     sel.reset() ;
     3819//     types.clear() ;
     3820//     types.push_back( SrcType::FHICOLD ) ;
     3821//     sel.setTypes( types ) ;
     3822//     s->setSelection( sel ) ;
     3823//     tmp.clear() ;
     3824//     tmp.push_back( getScantable( s, false ) ) ;
     3825//     CountedPtr<Scantable> acoldhi = average( tmp, masks, "TINT", "SCAN" ) ;
     3826//     s->unsetSelection() ;
     3827//     sel.reset() ;
     3828//     types.clear() ;
     3829
    38103830    // ref scan
    38113831    bool insitu = insitu_ ;
     
    38133833    sref = getScantable( s, true ) ;
    38143834    insitu_ = insitu ;
    3815     sel.setName( refstr ) ;
     3835    types.push_back( SrcType::FSLO ) ;
     3836    sel.setTypes( types ) ;
    38163837    s->setSelection( sel ) ;
    38173838    TableCopy::copyRows( sref->table(), s->table() ) ;
    38183839    s->unsetSelection() ;
    38193840    sel.reset() ;
     3841    types.clear() ;
    38203842   
    38213843    // sig scan
     
    38233845    ssig = getScantable( s, true ) ;
    38243846    insitu_ = insitu ;
    3825     sel.setName( sigstr ) ;
     3847    types.push_back( SrcType::FSHI ) ;
     3848    sel.setTypes( types ) ;
    38263849    s->setSelection( sel ) ;
    38273850    TableCopy::copyRows( ssig->table(), s->table() ) ;
    38283851    s->unsetSelection() ;
    38293852    sel.reset() ; 
    3830 
    3831     // process each sig and ref scan
    3832     ArrayColumn<Float> tsysCollo ;
    3833     tsysCollo.attach( ssig->table(), "TSYS" ) ;
    3834     ArrayColumn<Float> tsysColhi ;
    3835     tsysColhi.attach( sref->table(), "TSYS" ) ;
    3836     for ( int i = 0 ; i < ssig->nrow() ; i++ ) {
    3837       vector< CountedPtr<Scantable> > sky( 2 ) ;
    3838       sky[0] = askylo ;
    3839       sky[1] = askyhi ;
    3840       vector< CountedPtr<Scantable> > hot( 2 ) ;
    3841       hot[0] = ahotlo ;
    3842       hot[1] = ahothi ;
    3843       vector< CountedPtr<Scantable> > cold( 2 ) ;
    3844       cold[0] = acoldlo ;
    3845       cold[1] = acoldhi ;
    3846       vector<float> sp = getFSCalibratedSpectra( ssig, sref, sky, hot, cold, i ) ;
    3847       ssig->setSpectrum( sp, i ) ;
    3848       string reftime = ssig->getTime( i ) ;
    3849       vector<int> ii( 1, ssig->getIF( i ) ) ;
    3850       vector<int> ib( 1, ssig->getBeam( i ) ) ;
    3851       vector<int> ip( 1, ssig->getPol( i ) ) ;
    3852       sel.setIFs( ii ) ;
    3853       sel.setBeams( ib ) ;
    3854       sel.setPolarizations( ip ) ;
    3855       askylo->setSelection( sel ) ;
    3856       vector<float> sptsys = getTsysFromTime( reftime, askylo, "linear" ) ;
    3857       const Vector<Float> Vtsyslo( sptsys ) ;
    3858       tsysCollo.put( i, Vtsyslo ) ;
    3859       askylo->unsetSelection() ;
     3853    types.clear() ;
     3854         
     3855    if ( apexcalmode == 0 ) {
     3856      // APEX fs data without off scan
     3857      // process each sig and ref scan
     3858      ArrayColumn<Float> tsysCollo ;
     3859      tsysCollo.attach( ssig->table(), "TSYS" ) ;
     3860      ArrayColumn<Float> tsysColhi ;
     3861      tsysColhi.attach( sref->table(), "TSYS" ) ;
     3862      for ( int i = 0 ; i < ssig->nrow() ; i++ ) {
     3863        vector< CountedPtr<Scantable> > sky( 2 ) ;
     3864        sky[0] = askylo ;
     3865        sky[1] = askyhi ;
     3866        vector< CountedPtr<Scantable> > hot( 2 ) ;
     3867        hot[0] = ahotlo ;
     3868        hot[1] = ahothi ;
     3869        vector< CountedPtr<Scantable> > cold( 2 ) ;
     3870        //cold[0] = acoldlo ;
     3871        //cold[1] = acoldhi ;
     3872        vector<float> sp = getFSCalibratedSpectra( ssig, sref, sky, hot, cold, i ) ;
     3873        ssig->setSpectrum( sp, i ) ;
     3874        string reftime = ssig->getTime( i ) ;
     3875        vector<int> ii( 1, ssig->getIF( i ) ) ;
     3876        vector<int> ib( 1, ssig->getBeam( i ) ) ;
     3877        vector<int> ip( 1, ssig->getPol( i ) ) ;
     3878        sel.setIFs( ii ) ;
     3879        sel.setBeams( ib ) ;
     3880        sel.setPolarizations( ip ) ;
     3881        askylo->setSelection( sel ) ;
     3882        vector<float> sptsys = getTsysFromTime( reftime, askylo, "linear" ) ;
     3883        const Vector<Float> Vtsyslo( sptsys ) ;
     3884        tsysCollo.put( i, Vtsyslo ) ;
     3885        askylo->unsetSelection() ;
     3886        sel.reset() ;
     3887        sky[0] = askyhi ;
     3888        sky[1] = askylo ;
     3889        hot[0] = ahothi ;
     3890        hot[1] = ahotlo ;
     3891        cold[0] = acoldhi ;
     3892        cold[1] = acoldlo ;
     3893        sp = getFSCalibratedSpectra( sref, ssig, sky, hot, cold, i ) ;
     3894        sref->setSpectrum( sp, i ) ;
     3895        reftime = sref->getTime( i ) ;
     3896        ii[0] = sref->getIF( i )  ;
     3897        ib[0] = sref->getBeam( i ) ;
     3898        ip[0] = sref->getPol( i ) ;
     3899        sel.setIFs( ii ) ;
     3900        sel.setBeams( ib ) ;
     3901        sel.setPolarizations( ip ) ;
     3902        askyhi->setSelection( sel ) ;   
     3903        sptsys = getTsysFromTime( reftime, askyhi, "linear" ) ;
     3904        const Vector<Float> Vtsyshi( sptsys ) ;
     3905        tsysColhi.put( i, Vtsyshi ) ;
     3906        askyhi->unsetSelection() ;
     3907        sel.reset() ;
     3908      }
     3909    }
     3910    else if ( apexcalmode == 1 ) {
     3911      // APEX fs data with off scan
     3912      // off scan
     3913      types.push_back( SrcType::FLOOFF ) ;
     3914      sel.setTypes( types ) ;
     3915      s->setSelection( sel ) ;
     3916      tmp.clear() ;
     3917      tmp.push_back( getScantable( s, false ) ) ;
     3918      CountedPtr<Scantable> aofflo = average( tmp, masks, "TINT", "SCAN" ) ;
     3919      s->unsetSelection() ;
    38603920      sel.reset() ;
    3861       sky[0] = askyhi ;
    3862       sky[1] = askylo ;
    3863       hot[0] = ahothi ;
    3864       hot[1] = ahotlo ;
    3865       cold[0] = acoldhi ;
    3866       cold[1] = acoldlo ;
    3867       sp = getFSCalibratedSpectra( sref, ssig, sky, hot, cold, i ) ;
    3868       sref->setSpectrum( sp, i ) ;
    3869       reftime = sref->getTime( i ) ;
    3870       ii[0] = sref->getIF( i )  ;
    3871       ib[0] = sref->getBeam( i ) ;
    3872       ip[0] = sref->getPol( i ) ;
    3873       sel.setIFs( ii ) ;
    3874       sel.setBeams( ib ) ;
    3875       sel.setPolarizations( ip ) ;
    3876       askyhi->setSelection( sel ) ;   
    3877       sptsys = getTsysFromTime( reftime, askyhi, "linear" ) ;
    3878       const Vector<Float> Vtsyshi( sptsys ) ;
    3879       tsysColhi.put( i, Vtsyshi ) ;
    3880       askyhi->unsetSelection() ;
     3921      types.clear() ;
     3922      types.push_back( SrcType::FHIOFF ) ;
     3923      sel.setTypes( types ) ;
     3924      s->setSelection( sel ) ;
     3925      tmp.clear() ;
     3926      tmp.push_back( getScantable( s, false ) ) ;
     3927      CountedPtr<Scantable> aoffhi = average( tmp, masks, "TINT", "SCAN" ) ;
     3928      s->unsetSelection() ;
    38813929      sel.reset() ;
    3882     }
    3883 
    3884   }
    3885   else if ( antname.find( "APEX" ) != string::npos && apexcalmode == 1 ) {
    3886     // APEX fs data with off scan
    3887     // sky scan
    3888     STSelector sel = STSelector() ;
    3889     sel.setName( skystr1 ) ;
    3890     s->setSelection( sel ) ;
    3891     vector< CountedPtr<Scantable> > tmp( 1, getScantable( s, false ) ) ;
    3892     CountedPtr<Scantable> askylo = average( tmp, masks, "TINT", "SCAN" ) ;
    3893     s->unsetSelection() ;
    3894     sel.reset() ;
    3895     sel.setName( skystr2 ) ;
    3896     s->setSelection( sel ) ;
    3897     tmp[0] = getScantable( s, false ) ;
    3898     CountedPtr<Scantable> askyhi = average( tmp, masks, "TINT", "SCAN" ) ;
    3899     s->unsetSelection() ;
    3900     sel.reset() ;
    3901    
    3902     // hot scan
    3903     sel.setName( hotstr1 ) ;
    3904     s->setSelection( sel ) ;
    3905     tmp[0] = getScantable( s, false ) ;
    3906     CountedPtr<Scantable> ahotlo = average( tmp, masks, "TINT", "SCAN" ) ;
    3907     s->unsetSelection() ;
    3908     sel.reset() ;
    3909     sel.setName( hotstr2 ) ;
    3910     s->setSelection( sel ) ;
    3911     tmp[0] = getScantable( s, false ) ;
    3912     CountedPtr<Scantable> ahothi = average( tmp, masks, "TINT", "SCAN" ) ;
    3913     s->unsetSelection() ;
    3914     sel.reset() ;
    3915    
    3916     // cold scan
    3917     sel.setName( coldstr1 ) ;
    3918     s->setSelection( sel ) ;
    3919     tmp[0] = getScantable( s, false ) ;
    3920     CountedPtr<Scantable> acoldlo = average( tmp, masks, "TINT", "SCAN" ) ;
    3921     s->unsetSelection() ;
    3922     sel.reset() ;
    3923     sel.setName( coldstr2 ) ;
    3924     s->setSelection( sel ) ;
    3925     tmp[0] = getScantable( s, false ) ;
    3926     CountedPtr<Scantable> acoldhi = average( tmp, masks, "TINT", "SCAN" ) ;
    3927     s->unsetSelection() ;
    3928     sel.reset() ;
    3929 
    3930     // off scan
    3931     sel.setName( offstr1 ) ;
    3932     s->setSelection( sel ) ;
    3933     tmp[0] = getScantable( s, false ) ;
    3934     CountedPtr<Scantable> aofflo = average( tmp, masks, "TINT", "SCAN" ) ;
    3935     s->unsetSelection() ;
    3936     sel.reset() ;
    3937     sel.setName( offstr2 ) ;
    3938     s->setSelection( sel ) ;
    3939     tmp[0] = getScantable( s, false ) ;
    3940     CountedPtr<Scantable> aoffhi = average( tmp, masks, "TINT", "SCAN" ) ;
    3941     s->unsetSelection() ;
    3942     sel.reset() ;
    3943    
    3944     // ref scan
    3945     bool insitu = insitu_ ;
    3946     insitu_ = false ;
    3947     sref = getScantable( s, true ) ;
    3948     insitu_ = insitu ;
    3949     sel.setName( refstr ) ;
    3950     s->setSelection( sel ) ;
    3951     TableCopy::copyRows( sref->table(), s->table() ) ;
    3952     s->unsetSelection() ;
    3953     sel.reset() ;
    3954    
    3955     // sig scan
    3956     insitu_ = false ;
    3957     ssig = getScantable( s, true ) ;
    3958     insitu_ = insitu ;
    3959     sel.setName( sigstr ) ;
    3960     s->setSelection( sel ) ;
    3961     TableCopy::copyRows( ssig->table(), s->table() ) ;
    3962     s->unsetSelection() ;
    3963     sel.reset() ;
    3964 
    3965     // process each sig and ref scan
    3966     ArrayColumn<Float> tsysCollo ;
    3967     tsysCollo.attach( ssig->table(), "TSYS" ) ;
    3968     ArrayColumn<Float> tsysColhi ;
    3969     tsysColhi.attach( sref->table(), "TSYS" ) ;
    3970     for ( int i = 0 ; i < ssig->nrow() ; i++ ) {
    3971       vector<float> sp = getCalibratedSpectra( ssig, aofflo, askylo, ahotlo, acoldlo, i, antname ) ;
    3972       ssig->setSpectrum( sp, i ) ;
    3973       sp = getCalibratedSpectra( sref, aoffhi, askyhi, ahothi, acoldhi, i, antname ) ;
    3974       string reftime = ssig->getTime( i ) ;
    3975       vector<int> ii( 1, ssig->getIF( i ) ) ;
    3976       vector<int> ib( 1, ssig->getBeam( i ) ) ;
    3977       vector<int> ip( 1, ssig->getPol( i ) ) ;
    3978       sel.setIFs( ii ) ;
    3979       sel.setBeams( ib ) ;
    3980       sel.setPolarizations( ip ) ;
    3981       askylo->setSelection( sel ) ;
    3982       vector<float> sptsys = getTsysFromTime( reftime, askylo, "linear" ) ;
    3983       const Vector<Float> Vtsyslo( sptsys ) ;
    3984       tsysCollo.put( i, Vtsyslo ) ;
    3985       askylo->unsetSelection() ;
    3986       sel.reset() ;
    3987       sref->setSpectrum( sp, i ) ;
    3988       reftime = sref->getTime( i ) ;
    3989       ii[0] = sref->getIF( i )  ;
    3990       ib[0] = sref->getBeam( i ) ;
    3991       ip[0] = sref->getPol( i ) ;
    3992       sel.setIFs( ii ) ;
    3993       sel.setBeams( ib ) ;
    3994       sel.setPolarizations( ip ) ;
    3995       askyhi->setSelection( sel ) ;   
    3996       sptsys = getTsysFromTime( reftime, askyhi, "linear" ) ;
    3997       const Vector<Float> Vtsyshi( sptsys ) ;
    3998       tsysColhi.put( i, Vtsyshi ) ;
    3999       askyhi->unsetSelection() ;
    4000       sel.reset() ;
    4001     }
    4002   }
    4003   else if ( antname.find( "APEX" ) == string::npos ) {
     3930      types.clear() ;
     3931     
     3932      // process each sig and ref scan
     3933      ArrayColumn<Float> tsysCollo ;
     3934      tsysCollo.attach( ssig->table(), "TSYS" ) ;
     3935      ArrayColumn<Float> tsysColhi ;
     3936      tsysColhi.attach( sref->table(), "TSYS" ) ;
     3937      for ( int i = 0 ; i < ssig->nrow() ; i++ ) {
     3938        vector<float> sp = getCalibratedSpectra( ssig, aofflo, askylo, ahotlo, acoldlo, i, antname ) ;
     3939        ssig->setSpectrum( sp, i ) ;
     3940        sp = getCalibratedSpectra( sref, aoffhi, askyhi, ahothi, acoldhi, i, antname ) ;
     3941        string reftime = ssig->getTime( i ) ;
     3942        vector<int> ii( 1, ssig->getIF( i ) ) ;
     3943        vector<int> ib( 1, ssig->getBeam( i ) ) ;
     3944        vector<int> ip( 1, ssig->getPol( i ) ) ;
     3945        sel.setIFs( ii ) ;
     3946        sel.setBeams( ib ) ;
     3947        sel.setPolarizations( ip ) ;
     3948        askylo->setSelection( sel ) ;
     3949        vector<float> sptsys = getTsysFromTime( reftime, askylo, "linear" ) ;
     3950        const Vector<Float> Vtsyslo( sptsys ) ;
     3951        tsysCollo.put( i, Vtsyslo ) ;
     3952        askylo->unsetSelection() ;
     3953        sel.reset() ;
     3954        sref->setSpectrum( sp, i ) ;
     3955        reftime = sref->getTime( i ) ;
     3956        ii[0] = sref->getIF( i )  ;
     3957        ib[0] = sref->getBeam( i ) ;
     3958        ip[0] = sref->getPol( i ) ;
     3959        sel.setIFs( ii ) ;
     3960        sel.setBeams( ib ) ;
     3961        sel.setPolarizations( ip ) ;
     3962        askyhi->setSelection( sel ) ;   
     3963        sptsys = getTsysFromTime( reftime, askyhi, "linear" ) ;
     3964        const Vector<Float> Vtsyshi( sptsys ) ;
     3965        tsysColhi.put( i, Vtsyshi ) ;
     3966        askyhi->unsetSelection() ;
     3967        sel.reset() ;
     3968      }
     3969    }
     3970  }
     3971  else {
    40043972    // non-APEX fs data
    40053973    // sky scan
    40063974    STSelector sel = STSelector() ;
    4007     sel.setName( skystr ) ;
     3975    types.push_back( SrcType::SKY ) ;
     3976    sel.setTypes( types ) ;
    40083977    s->setSelection( sel ) ;
    40093978    vector< CountedPtr<Scantable> > tmp( 1, getScantable( s, false ) ) ;
     
    40113980    s->unsetSelection() ;
    40123981    sel.reset() ;
     3982    types.clear() ;
    40133983   
    40143984    // hot scan
    4015     sel.setName( hotstr ) ;
     3985    types.push_back( SrcType::HOT ) ;
     3986    sel.setTypes( types ) ;
    40163987    s->setSelection( sel ) ;
    4017     tmp[0] = getScantable( s, false ) ;
     3988    tmp.clear() ;
     3989    tmp.push_back( getScantable( s, false ) ) ;
    40183990    CountedPtr<Scantable> ahot = average( tmp, masks, "TINT", "SCAN" ) ;
    40193991    s->unsetSelection() ;
    40203992    sel.reset() ;
    4021 
    4022      // cold scan
    4023     sel.setName( coldstr ) ;
    4024     s->setSelection( sel ) ;
    4025     tmp[0] = getScantable( s, false ) ;
    4026     CountedPtr<Scantable> acold = average( tmp, masks, "TINT", "SCAN" ) ;
    4027     s->unsetSelection() ;
    4028     sel.reset() ;
     3993    types.clear() ;
     3994
     3995    // cold scan
     3996    CountedPtr<Scantable> acold ;
     3997//     types.push_back( SrcType::COLD ) ;
     3998//     sel.setTypes( types ) ;
     3999//     s->setSelection( sel ) ;
     4000//     tmp.clear() ;
     4001//     tmp.push_back( getScantable( s, false ) ) ;
     4002//     CountedPtr<Scantable> acold = average( tmp, masks, "TINT", "SCAN" ) ;
     4003//     s->unsetSelection() ;
     4004//     sel.reset() ;
     4005//     types.clear() ;
    40294006   
    40304007    // ref scan
     
    40334010    sref = getScantable( s, true ) ;
    40344011    insitu_ = insitu ;
    4035     sel.setName( refstr ) ;
     4012    types.push_back( SrcType::FSOFF ) ;
     4013    sel.setTypes( types ) ;
    40364014    s->setSelection( sel ) ;
    40374015    TableCopy::copyRows( sref->table(), s->table() ) ;
    40384016    s->unsetSelection() ;
    40394017    sel.reset() ;
     4018    types.clear() ;
    40404019   
    40414020    // sig scan
     
    40434022    ssig = getScantable( s, true ) ;
    40444023    insitu_ = insitu ;
    4045     sel.setName( sigstr ) ;
     4024    types.push_back( SrcType::FSON ) ;
     4025    sel.setTypes( types ) ;
    40464026    s->setSelection( sel ) ;
    40474027    TableCopy::copyRows( ssig->table(), s->table() ) ;
    40484028    s->unsetSelection() ;
    40494029    sel.reset() ;
     4030    types.clear() ;
    40504031
    40514032    // process each sig and ref scan
     
    41414122          tmp[i] = dofold( ssig, sref, doffset ) ;
    41424123        }
    4143         // remove additional string from SRCNAME
    4144         ScalarColumn<String> srcnameCol ;
    4145         srcnameCol.attach( tmp[i]->table(), "SRCNAME" ) ;
    4146         Vector<String> srcnames( srcnameCol.getColumn() ) ;
    4147         for ( uInt i = 0 ; i < srcnames.nelements() ; i++ ) {
    4148           srcnames[i] = srcnames[i].substr( 0, srcnames[i].find( sigstr.substr(1,sigstr.size()-1) ) ) ;
    4149         }
    4150         srcnameCol.putColumn( srcnames ) ;
    41514124        ssig->unsetSelection() ;
    41524125        sref->unsetSelection() ;
     
    46214594  sky->setSelection( sel ) ;
    46224595  hot->setSelection( sel ) ;
    4623   cold->setSelection( sel ) ;
     4596  //cold->setSelection( sel ) ;
    46244597  off->setSelection( sel ) ;
    46254598  vector<float> spsky = getSpectrumFromTime( reftime, sky, "linear" ) ;
    46264599  vector<float> sphot = getSpectrumFromTime( reftime, hot, "linear" ) ;
    4627   vector<float> spcold = getSpectrumFromTime( reftime, cold, "linear" ) ;
     4600  //vector<float> spcold = getSpectrumFromTime( reftime, cold, "linear" ) ;
    46284601  vector<float> spoff = getSpectrumFromTime( reftime, off, "linear" ) ;
    46294602  vector<float> spec = on->getSpectrum( index ) ;
     
    46384611    }
    46394612  }
    4640   else if ( antname.find( "ALMA" ) != string::npos ) {
    4641     // two-load calibration
    4642     // from equation 5 and 12 of ALMA memo 318 (Mangum 2000)
    4643     //
    4644     // 2009/09/09 Takeshi Nakazato
    4645     for ( unsigned int j = 0 ; j < tcal.size() ; j++ ) {
    4646       //
    4647       // in case that Tcal is assumed as signal gain
    4648       //
    4649       //float K = ( sphot[j] - spcold[j] ) / ( thot - tcold ) ;
    4650       //float v = ( spec[j] - spoff[j] ) * exp( tsig ) / ( K * tcal[j] * eta ) ;
    4651       //
    4652       // in case that Tcal is defined as
    4653       //
    4654       //    Tcal = ( K * Gs * eta_l * exp( - tau_s ) )^-1
    4655       //
    4656       float v = tcal[j] * ( spec[j] - spsky[j] ) ;
    4657       sp[j] = v ;
    4658     }
    4659   }
    46604613  else {
    46614614    // Chopper-Wheel calibration (Ulich & Haas 1976)
     
    46684621  sky->unsetSelection() ;
    46694622  hot->unsetSelection() ;
    4670   cold->unsetSelection() ;
     4623  //cold->unsetSelection() ;
    46714624  off->unsetSelection() ;
    46724625
     
    47354688  sky->setSelection( sel ) ;
    47364689  hot->setSelection( sel ) ;
    4737   cold->setSelection( sel ) ;
     4690  //cold->setSelection( sel ) ;
    47384691  vector<float> spsky = getSpectrumFromTime( reftime, sky, "linear" ) ;
    47394692  vector<float> sphot = getSpectrumFromTime( reftime, hot, "linear" ) ;
    4740   vector<float> spcold = getSpectrumFromTime( reftime, cold, "linear" ) ;
     4693  //vector<float> spcold = getSpectrumFromTime( reftime, cold, "linear" ) ;
    47414694  vector<float> spref = ref->getSpectrum( index ) ;
    47424695  vector<float> spsig = sig->getSpectrum( index ) ;
     
    47504703  sky->unsetSelection() ;
    47514704  hot->unsetSelection() ;
    4752   cold->unsetSelection() ;
     4705  //cold->unsetSelection() ;
    47534706
    47544707  return sp ;
     
    47734726  sky[0]->setSelection( sel ) ;
    47744727  hot[0]->setSelection( sel ) ;
    4775   cold[0]->setSelection( sel ) ;
     4728  //cold[0]->setSelection( sel ) ;
    47764729  vector<float> spskys = getSpectrumFromTime( reftime, sky[0], "linear" ) ;
    47774730  vector<float> sphots = getSpectrumFromTime( reftime, hot[0], "linear" ) ;
    4778   vector<float> spcolds = getSpectrumFromTime( reftime, cold[0], "linear" ) ;
     4731  //vector<float> spcolds = getSpectrumFromTime( reftime, cold[0], "linear" ) ;
    47794732  vector<float> tcals = getTcalFromTime( reftime, sky[0], "linear" ) ;
    47804733  sel.reset() ;
     
    47854738  sky[1]->setSelection( sel ) ;
    47864739  hot[1]->setSelection( sel ) ;
    4787   cold[1]->setSelection( sel ) ;
     4740  //cold[1]->setSelection( sel ) ;
    47884741  vector<float> spskyr = getSpectrumFromTime( reftime, sky[1], "linear" ) ;
    47894742  vector<float> sphotr = getSpectrumFromTime( reftime, hot[1], "linear" ) ;
    4790   vector<float> spcoldr = getSpectrumFromTime( reftime, cold[1], "linear" ) ;
     4743  //vector<float> spcoldr = getSpectrumFromTime( reftime, cold[1], "linear" ) ;
    47914744  vector<float> tcalr = getTcalFromTime( reftime, sky[1], "linear" ) ; 
    47924745  vector<float> spref = ref->getSpectrum( index ) ;
     
    48004753  sky[0]->unsetSelection() ;
    48014754  hot[0]->unsetSelection() ;
    4802   cold[0]->unsetSelection() ;
     4755  //cold[0]->unsetSelection() ;
    48034756  sky[1]->unsetSelection() ;
    48044757  hot[1]->unsetSelection() ;
    4805   cold[1]->unsetSelection() ;
     4758  //cold[1]->unsetSelection() ;
    48064759
    48074760  return sp ;
  • branches/alma/src/STSelector.cpp

    r1639 r1693  
    8585  std::string sql = "SELECT FROM $1 WHERE SRCNAME == pattern('"+sname+"')";
    8686  setTaQL(sql);
     87}
     88
     89void STSelector::setTypes( const std::vector< int >& types )
     90{
     91  setint("SRCTYPE", types);
    8792}
    8893
     
    260265}
    261266
     267std::vector< int > asap::STSelector::getTypes( ) const
     268{
     269  return getint("SRCTYPE") ;
     270}
     271
    262272std::string asap::STSelector::print( )
    263273{
  • branches/alma/src/STSelector.h

    r1639 r1693  
    4545  void setCycles(const std::vector<int>& cycs);
    4646  void setName(const std::string&);
     47  void setTypes(const std::vector<int>& types);
    4748  virtual void setTaQL(const std::string& taql);
    4849
     
    5556  std::vector<int> getPols() const;
    5657  std::vector<int> getCycles() const;
     58  std::vector<int> getTypes() const;
    5759  std::vector<std::string> getPolTypes() const;
    5860  std::string getTaQL() const { return taql_; }
  • branches/alma/src/python_STSelector.cpp

    r1639 r1693  
    2929        .def("_getscans", &STSelector::getScans)
    3030        .def("_getcycles", &STSelector::getCycles)
     31        .def("_gettypes", &STSelector::getTypes)
    3132        .def("_gettaql", &STSelector::getTaQL)
    3233        .def("_getorder", &STSelector::getSortOrder)
     
    4243        .def("_setorder", &STSelector::setSortOrder)
    4344        .def("_setrows", &STSelector::setRows)
     45        .def("_settypes", &STSelector::setTypes)
    4446        .def("_empty", &STSelector::empty)
    4547      ;
  • branches/alma/src/python_asap.cpp

    r1603 r1693  
    7575  asap::python::python_LineCatalog();
    7676  asap::python::python_Logger();
     77  asap::python::python_SrcType();
    7778
    7879#ifndef HAVE_LIBPYRAP
  • branches/alma/src/python_asap.h

    r1126 r1693  
    4747    void python_LineCatalog();
    4848    void python_Logger();
     49    void python_SrcType();
    4950
    5051  } // python
Note: See TracChangeset for help on using the changeset viewer.