Changeset 1697 for trunk/python/scantable.py
- Timestamp:
- 02/11/10 11:46:14 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r1691 r1697 1 import os 1 2 try: 2 3 from functools import wraps as wraps_dec … … 22 23 return val 23 24 return wrap 25 26 27 def is_scantable(filename): 28 return (os.path.isdir(filename) 29 and not os.path.exists(filename+'/table.f1') 30 and os.path.exists(filename+'/table.info')) 24 31 25 32 … … 59 66 Scantable.__init__(self, filename) 60 67 else: 61 if isinstance(filename, str):# or \ 62 # (isinstance(filename, list) or isinstance(filename, tuple)) \ 63 # and isinstance(filename[-1], str): 64 import os.path 68 if isinstance(filename, str): 65 69 filename = os.path.expandvars(filename) 66 70 filename = os.path.expanduser(filename) … … 69 73 if rcParams['verbose']: 70 74 asaplog.push(s) 71 #print asaplog.pop().strip()72 75 return 73 76 raise IOError(s) 74 if os.path.isdir(filename) \ 75 and not os.path.exists(filename+'/table.f1'): 76 # crude check if asap table 77 if os.path.exists(filename+'/table.info'): 78 ondisk = rcParams['scantable.storage'] == 'disk' 79 Scantable.__init__(self, filename, ondisk) 80 if unit is not None: 81 self.set_fluxunit(unit) 82 self.set_freqframe(rcParams['scantable.freqframe']) 83 else: 84 msg = "The given file '%s'is not a valid " \ 85 "asap table." % (filename) 86 if rcParams['verbose']: 87 print msg 88 return 89 else: 90 raise IOError(msg) 77 if is_scantable(filename): 78 ondisk = rcParams['scantable.storage'] == 'disk' 79 Scantable.__init__(self, filename, ondisk) 80 if unit is not None: 81 self.set_fluxunit(unit) 82 self.set_freqframe(rcParams['scantable.freqframe']) 91 83 else: 92 84 self._fill([filename], unit, average) … … 260 252 filename: the name of a file to write the putput to 261 253 Default - no file output 262 verbose: print extra info such as the frequency table263 The default (False) is taken from .asaprc264 254 """ 265 255 info = Scantable._summary(self, True) … … 347 337 are only applied to thi selection. 348 338 Parameters: 349 selection: a selector object (default unset the selection) 339 selection: a selector object (default unset the selection), 340 341 or 342 343 any combination of 344 "pols", "ifs", "beams", "scans", "cycles", "name", "query" 345 350 346 Examples: 351 347 sel = selector() # create a selection object 352 348 self.set_scans([0, 3]) # select SCANNO 0 and 3 353 349 scan.set_selection(sel) # set the selection 350 scan.summary() # will only print summary of scanno 0 an 3 351 scan.set_selection() # unset the selection 352 # or the equivalent 353 scan.set_selection(scans=[0,3]) 354 354 scan.summary() # will only print summary of scanno 0 an 3 355 355 scan.set_selection() # unset the selection
Note: See TracChangeset
for help on using the changeset viewer.