Changeset 1686 for branches/alma


Ignore:
Timestamp:
02/08/10 16:22:11 (14 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready to Release: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Changed splitant() to use new scantable constructor.


File:
1 edited

Legend:

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

    r1682 r1686  
    950950    # Import the table toolkit from CASA
    951951    try:
    952         import casac
     952       import casac
    953953    except ImportError:
    954         if rcParams['verbose']:
    955             #print "failed to load casa"
    956             print_log()
    957             asaplog.push("failed to load casa")
    958             print_log('ERROR')
    959         else: raise
    960         return False
     954       if rcParams['verbose']:
     955           #print "failed to load casa"
     956           print_log()
     957           asaplog.push("failed to load casa")
     958           print_log('ERROR')
     959       else: raise
     960       return False
    961961    try:
    962         tbtool = casac.homefinder.find_home_by_name('tableHome')
    963         tb = tbtool.create()
    964         tb2 = tbtool.create()
     962       tbtool = casac.homefinder.find_home_by_name('tableHome')
     963       tb = tbtool.create()
     964       tb2 = tbtool.create()
    965965    except:
    966         if rcParams['verbose']:
    967             #print "failed to load a table tool:\n", e
    968             print_log()
    969             asaplog.push("failed to load table tool")
    970             print_log('ERROR')
    971         else: raise
    972         return False
     966       if rcParams['verbose']:
     967           #print "failed to load a table tool:\n", e
     968           print_log()
     969           asaplog.push("failed to load table tool")
     970           print_log('ERROR')
     971       else: raise
     972       return False
    973973    # Check the input filename
    974974    if isinstance(filename, str):
     
    10071007    if len(outprefix) > 0: prefix=outprefix+'.'
    10081008    else:
    1009         prefix=filename
     1009        prefix=filename.rstrip('/')
    10101010    # Now do the actual splitting.
    10111011    outfiles=[]
    1012     tmpms="temp_antsplit.ms"
    1013     if os.path.exists(tmpms):
    1014         ans=raw_input('Temporal file '+tmpms+' exists. Delete it and continue? [y/N]: ')
    1015         if ans.upper() == 'Y':
    1016             os.system('rm -rf '+tmpms)
    1017             asaplog.push('The file '+tmpms+' deleted.')
    1018         else:
    1019             asaplog.push('Exit without splitting.')
    1020             return
    10211012    tb.open(tablename=filename+'/ANTENNA',nomodify=True)
    10221013    nant=tb.nrows()
     
    10261017    tb.open(tablename=filename,nomodify=True)
    10271018    ant1=tb.getcol('ANTENNA1',0,-1,1)
     1019    tb.close()
    10281020    for antid in set(ant1):
    1029         qstr="ANTENNA1 == "+str(antid)
    1030         stab = tb.queryC(qstr)
    1031         ctab = stab.copy(tmpms,deep=True)
    1032         stab.close()
    1033         ctab.close()
    1034         scan=scantable(tmpms,average=False,getpt=True)
     1021        scan=scantable(filename,average=False,getpt=True,antenna=int(antid))
    10351022        outname=prefix+antnames[antid]+'.asap'
    10361023        scan.save(outname,format='ASAP',overwrite=overwrite)
    1037         # Modify scantable header
    1038         tb2.open(tablename=outname,nomodify=False)
    1039         tb2.putkeyword(keyword='AntennaName',value=antnames[antid])
    1040         tb2.putkeyword(keyword='AntennaPosition',value=antpos[antid])
    1041         tb2.flush()
    1042         tb2.close()
    1043         del scan, ctab, stab
     1024        del scan
    10441025        outfiles.append(outname)
    1045     tb.close()
    10461026    del tb, tb2
    1047     os.system('rm -rf '+tmpms)
    10481027    return outfiles
    10491028
Note: See TracChangeset for help on using the changeset viewer.