Changeset 411 for trunk/python/scantable.py
- Timestamp:
- 02/11/05 14:37:03 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r407 r411 35 35 self.set_fluxunit(unit) 36 36 else: 37 try: 38 mode = st(filename)[stat.ST_MODE] 39 except OSError: 40 print "File not found" 37 import os.path 38 if not os.path.exists(filename): 39 print "File '%s' not found." % (filename) 41 40 return 42 if stat.S_ISDIR(mode): 41 filename = os.path.expandvars(filename) 42 if os.path.isdir(filename): 43 43 # crude check if asap table 44 if stat.S_ISREG(st(filename+'/table.info')[stat.ST_MODE]):44 if os.path.exists(filename+'/table.info'): 45 45 sdtable.__init__(self, filename) 46 46 if unit is not None: 47 47 self.set_fluxunit(unit) 48 48 else: 49 print 'The given file is not a valid asap table'49 print "The given file '%s'is not a valid asap table." % (filename) 50 50 return 51 51 else: … … 57 57 r = sdreader(filename,ifSel,beamSel) 58 58 print 'Importing data...' 59 r. read([-1])60 tbl = r. getdata()59 r._read([-1]) 60 tbl = r._getdata() 61 61 if unit is not None: 62 62 tbl.set_fluxunit(unit) … … 86 86 'MS2' (saves as an aips++ 87 87 MeasurementSet V2) 88 overwrite: if the file should be overwritten if it exists.88 overwrite: If the file should be overwritten if it exists. 89 89 The default False is to return with warning 90 without writing the output 90 without writing the output. USE WITH CARE. 91 91 Example: 92 92 scan.save('myscan.asap') 93 93 scan.save('myscan.sdfits','SDFITS') 94 94 """ 95 from os import path 95 96 if format is None: format = rcParams['scantable.save'] 96 97 suffix = '.'+format.lower() … … 98 99 name = 'scantable'+suffix 99 100 print "No filename given. Using default name %s..." % name 100 from os import path101 name = path.expandvars(name) 101 102 if path.isfile(name) or path.isdir(name): 102 103 if not overwrite: … … 166 167 if filename is "": 167 168 filename = 'scantable_summary.txt' 169 from os.path import expandvars 170 filename = expandvars(filename) 168 171 data = open(filename, 'w') 169 172 data.write(info)
Note: See TracChangeset
for help on using the changeset viewer.