Changeset 1880 for trunk/python


Ignore:
Timestamp:
08/20/10 12:53:05 (14 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: 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...

An implementation of asapmath.splitant() is changed since
the new filler doesn't support antenna parameter at the
moment.

The default behavior of MS filler also changed.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapmath.py

    r1862 r1880  
    945945    """
    946946    # Import the table toolkit from CASA
    947 
    948947    import casac
    949948    tbtool = casac.homefinder.find_home_by_name('tableHome')
    950949    tb = tbtool.create()
    951     tb2 = tbtool.create()
    952950    # Check the input filename
    953951    if isinstance(filename, str):
     
    973971        prefix=filename.rstrip('/')
    974972    # Now do the actual splitting.
     973    # 2010/08/20 TN
     974    # The antenna parameter for scantable constructor is ineffective at the moemnt.
     975    # Thus, we should go back to original implementation of splitant.
     976##     outfiles=[]
     977##     tb.open(tablename=filename+'/ANTENNA',nomodify=True)
     978##     nant=tb.nrows()
     979##     antnames=tb.getcol('NAME',0,nant,1)
     980##     antpos=tb.getcol('POSITION',0,nant,1).transpose()
     981##     tb.close()
     982##     tb.open(tablename=filename,nomodify=True)
     983##     ant1=tb.getcol('ANTENNA1',0,-1,1)
     984##     tb.close()
     985##     for antid in set(ant1):
     986##         scan=scantable(filename,average=False,getpt=True,antenna=int(antid))
     987##         outname=prefix+antnames[antid]+'.asap'
     988##         scan.save(outname,format='ASAP',overwrite=overwrite)
     989##         del scan
     990##         outfiles.append(outname)
    975991    outfiles=[]
    976992    tb.open(tablename=filename+'/ANTENNA',nomodify=True)
    977993    nant=tb.nrows()
    978994    antnames=tb.getcol('NAME',0,nant,1)
    979     antpos=tb.getcol('POSITION',0,nant,1).transpose()
    980995    tb.close()
    981996    tb.open(tablename=filename,nomodify=True)
    982997    ant1=tb.getcol('ANTENNA1',0,-1,1)
    983     tb.close()
     998    tmpname='asapmath.splitant.tmp'
    984999    for antid in set(ant1):
    985         scan=scantable(filename,average=False,getpt=True,antenna=int(antid))
     1000        tbsel=tb.query('ANTENNA1 == %s && ANTENNA2 == %s'%(antid,antid))
     1001        tbsel.copy(tmpname,deep=True)
     1002        #tbsel=tb.query('ANTENNA1 == %s && ANTENNA2 == %s'%(antid,antid),tmpname)
     1003        tbsel.close()
     1004        del tbsel
     1005        scan=scantable(tmpname,average=False,getpt=True,antenna=int(antid))
    9861006        outname=prefix+antnames[antid]+'.asap'
    9871007        scan.save(outname,format='ASAP',overwrite=overwrite)
    9881008        del scan
    9891009        outfiles.append(outname)
    990     del tb, tb2
     1010        os.system('rm -rf '+tmpname)
     1011    tb.close()
     1012    del tb
    9911013    return outfiles
    9921014
Note: See TracChangeset for help on using the changeset viewer.