Changeset 1295 for trunk/python/__init__.py
- Timestamp:
- 11/06/06 22:22:03 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/__init__.py
r1280 r1295 253 253 rcParams.update(rcParamsDefault) 254 254 255 def _n_bools(n, val): 256 return [ val for i in xrange(n) ] 255 257 256 258 def _is_sequence_or_number(param, ptype=int): … … 298 300 'data/Sgr_86p262_best_SPC.sdfits'] 299 301 """ 300 import os301 302 if not os.path.isdir(path): 302 303 return None 303 valid = "rpf sdf sdfits mbf asap".split()304 valid = "rpf rpf.1 rpf.2 sdf sdfits mbf asap".split() 304 305 if not suffix in valid: 305 306 return None … … 325 326 return 326 327 327 try: 328 import numpy.core as NUM 329 except ImportError: 330 try: 331 import numarray as NUM 332 except ImportError: 333 raise ImportError("You need to have numpy or numarray installed") 328 def mask_and(a, b): 329 assert(len(a)==len(b)) 330 return [ a[i] & b[i] for i in xrange(len(a)) ] 331 332 def mask_or(a, b): 333 assert(len(a)==len(b)) 334 return [ a[i] | b[i] for i in xrange(len(a)) ] 335 336 def mask_not(a): 337 return [ not i for i in a ] 334 338 335 339 from asapfitter import fitter … … 342 346 from linecatalog import linecatalog 343 347 344 mask_and = NUM.logical_and345 mask_or = NUM.logical_or346 mask_not = NUM.logical_not347 348 348 if rcParams['useplotter']: 349 from asapplotter import asapplotter 350 gui = os.environ.has_key('DISPLAY') and rcParams['plotter.gui'] 351 if gui: 352 import pylab as xyplotter 353 plotter = asapplotter(gui) 354 del gui 349 try: 350 from asapplotter import asapplotter 351 gui = os.environ.has_key('DISPLAY') and rcParams['plotter.gui'] 352 if gui: 353 import pylab as xyplotter 354 plotter = asapplotter(gui) 355 del gui 356 except ImportError: 357 print "Matplotlib not installed. No plotting available" 355 358 356 359 __date__ = '$Date$'.split()[1] … … 362 365 def version(): print "ASAP %s(%s)"% (__version__, __date__) 363 366 def list_scans(t = scantable): 364 import sys,types367 import types 365 368 globs = sys.modules['__main__'].__dict__.iteritems() 366 369 print "The user created scantables are:"
Note: See TracChangeset
for help on using the changeset viewer.