Changeset 2843 for trunk


Ignore:
Timestamp:
08/27/13 12:52:17 (11 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-5535

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: No

Module(s): sd

Description: Describe your changes here...

Removed freq_tolsr option from sd.splitant.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapmath.py

    r2818 r2843  
    950950
    951951@asaplog_post_dec
    952 def splitant(filename, outprefix='',overwrite=False, getpt=True, freq_tolsr=False):
     952def splitant(filename, outprefix='',overwrite=False, getpt=True):
    953953    """
    954954    Split Measurement set by antenna name, save data as a scantables,
    955     and return a list of filename.
     955    and return a list of filename. Note that frequency reference frame
     956    is imported as it is in Measurement set.
    956957    Notice this method can only be available from CASA.
    957958    Prameter
     
    966967       getpt        Whether to import direction from MS/POINTING
    967968                    table or not. Default is True (import direction).
    968        freq_tolsr   Whether to convert frequency frame information
    969                     to LSRK or not. Default is False (import as is).
    970 
    971969    """
    972970    # Import the table toolkit from CASA
    973     from casac import casac
     971    from taskinit import gentools
    974972    from asap.scantable import is_ms
    975     tb = casac.table()
     973    tb = gentools(['tb'])[0]
    976974    # Check the input filename
    977975    if isinstance(filename, str):
     
    983981            raise IOError(s)
    984982        # check if input file is MS
    985         #if not os.path.isdir(filename) \
    986         #       or not os.path.exists(filename+'/ANTENNA') \
    987         #       or not os.path.exists(filename+'/table.f1'):
    988983        if not is_ms(filename):
    989984            s = "File '%s' is not a Measurement set." % (filename)
     
    1001996    tb.open(tablename=filename,nomodify=True)
    1002997    ant1=tb.getcol('ANTENNA1',0,-1,1)
    1003     #anttab=tb.getkeyword('ANTENNA').split()[-1]
    1004998    anttab=tb.getkeyword('ANTENNA').lstrip('Table: ')
    1005999    tb.close()
    1006     #tb.open(tablename=filename+'/ANTENNA',nomodify=True)
    10071000    tb.open(tablename=anttab,nomodify=True)
    10081001    nant=tb.nrows()
    10091002    antnames=tb.getcol('NAME',0,nant,1)
    10101003    tb.close()
    1011     tmpname='asapmath.splitant.tmp'
    10121004    for antid in set(ant1):
    1013         tb.open(tablename=filename,nomodify=True)
    1014         tbsel=tb.query('ANTENNA1 == %s && ANTENNA2 == %s'%(antid,antid),tmpname)
    1015         scan=scantable(tmpname,average=False,antenna=int(antid),getpt=getpt,freq_tolsr=freq_tolsr,)
     1005        scan=scantable(filename,average=False,antenna=int(antid),getpt=getpt)
    10161006        outname=prefix+antnames[antid]+'.asap'
    10171007        scan.save(outname,format='ASAP',overwrite=overwrite)
    1018         tbsel.close()
    1019         tb.close()
    1020         del tbsel
    10211008        del scan
    10221009        outfiles.append(outname)
    1023         os.system('rm -rf '+tmpname)
    1024     del tb
    10251010    return outfiles
    10261011
Note: See TracChangeset for help on using the changeset viewer.