- Timestamp:
- 08/27/13 12:52:17 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapmath.py
r2818 r2843 950 950 951 951 @asaplog_post_dec 952 def splitant(filename, outprefix='',overwrite=False, getpt=True , freq_tolsr=False):952 def splitant(filename, outprefix='',overwrite=False, getpt=True): 953 953 """ 954 954 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. 956 957 Notice this method can only be available from CASA. 957 958 Prameter … … 966 967 getpt Whether to import direction from MS/POINTING 967 968 table or not. Default is True (import direction). 968 freq_tolsr Whether to convert frequency frame information969 to LSRK or not. Default is False (import as is).970 971 969 """ 972 970 # Import the table toolkit from CASA 973 from casac import casac971 from taskinit import gentools 974 972 from asap.scantable import is_ms 975 tb = casac.table()973 tb = gentools(['tb'])[0] 976 974 # Check the input filename 977 975 if isinstance(filename, str): … … 983 981 raise IOError(s) 984 982 # 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'):988 983 if not is_ms(filename): 989 984 s = "File '%s' is not a Measurement set." % (filename) … … 1001 996 tb.open(tablename=filename,nomodify=True) 1002 997 ant1=tb.getcol('ANTENNA1',0,-1,1) 1003 #anttab=tb.getkeyword('ANTENNA').split()[-1]1004 998 anttab=tb.getkeyword('ANTENNA').lstrip('Table: ') 1005 999 tb.close() 1006 #tb.open(tablename=filename+'/ANTENNA',nomodify=True)1007 1000 tb.open(tablename=anttab,nomodify=True) 1008 1001 nant=tb.nrows() 1009 1002 antnames=tb.getcol('NAME',0,nant,1) 1010 1003 tb.close() 1011 tmpname='asapmath.splitant.tmp'1012 1004 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) 1016 1006 outname=prefix+antnames[antid]+'.asap' 1017 1007 scan.save(outname,format='ASAP',overwrite=overwrite) 1018 tbsel.close()1019 tb.close()1020 del tbsel1021 1008 del scan 1022 1009 outfiles.append(outname) 1023 os.system('rm -rf '+tmpname)1024 del tb1025 1010 return outfiles 1026 1011
Note:
See TracChangeset
for help on using the changeset viewer.