Changeset 411
- Timestamp:
- 02/11/05 14:37:03 (20 years ago)
- Location:
- trunk/python
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asaplot.py
r376 r411 626 626 627 627 d = ['png','.ps','eps'] 628 629 from os.path import expandvars 630 fname = expandvars(fname) 631 628 632 if fname[-3:].lower() in d: 629 633 try: … … 676 680 677 681 678 def load_colours(file ='/usr/local/lib/rgb.txt'):682 def load_colours(filename='/usr/local/lib/rgb.txt'): 679 683 """ 680 684 Load the colour dictionary from the specified file. 681 685 """ 682 686 print 'Loading colour dictionary from', file 683 rgb = open(file, 'r') 687 from os.path import expandvars 688 filename = expandvars(filename) 689 rgb = open(filename, 'r') 684 690 685 691 while True: -
trunk/python/asapmath.py
r399 r411 160 160 return 161 161 162 def gain_el(scan, poly=None, filename="", method="linear", insitu=None, allaxes=None): 162 def gain_el(scan, poly=None, filename="", method="linear", 163 insitu=None, allaxes=None): 163 164 """ 164 165 Return a scan after applying a gain-elevation correction. The correction … … 204 205 poly = () 205 206 if insitu is None: insitu = rcParams['insitu'] 207 from os.path import expandvars 208 filename = expandvars(filename) 206 209 if not insitu: 207 210 from asap._asap import gainel as _gainEl -
trunk/python/asapreader.py
r409 r411 36 36 if thebeam is None: 37 37 thebeam = -1 38 from os.path import expandvars 39 filename = expandvars(filename) 38 40 sdreader.__init__(self, filename, theif, thebeam) 39 41 … … 63 65 return scantable(tbl) 64 66 65 def summary(self ):67 def summary(self, name=None): 66 68 """ 67 69 Print a summary of all scans/integrations. This reads through the … … 74 76 sdreader._reset(self) 75 77 sdreader._read(self,[-1]) 76 tbl = sdreader._getdata(self) 78 from asap import scantable 79 tbl = scantable(sdreader._getdata(self)) 77 80 sdreader._reset(self) 78 print tbl. _summary()81 print tbl.summary(name=name) 79 82 return 80 83 ## def reset(self): -
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.