source: branches/alma/python/__init__.py@ 1957

Last change on this file since 1957 was 1757, checked in by Kana Sugimoto, 15 years ago

New Development: Yes

JIRA Issue: Yes (CAS-2211)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: ASAP 3.0.0 interface changes

Test Programs:

Put in Release Notes: Yes

Module(s): all the CASA sd tools and tasks are affected.

Description: Merged ATNF-ASAP 3.0.0 developments to CASA (alma) branch.

Note you also need to update casa/code/atnf.


  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 26.5 KB
RevLine 
[100]1"""
2This is the ATNF Single Dish Analysis package.
3
4"""
[1080]5import os,sys,shutil, platform
[1757]6try:
7 from functools import wraps as wraps_dec
8except ImportError:
9 from asap.compatibility import wraps as wraps_dec
[226]10
[1456]11# Set up CASAPATH and first time use of asap i.e. ~/.asap/*
[1080]12plf = None
13if sys.platform == "linux2":
14 if platform.architecture()[0] == '64bit':
15 plf = 'linux_64b'
16 else:
17 plf = 'linux_gnu'
18elif sys.platform == 'darwin':
19 plf = 'darwin'
20else:
21 # Shouldn't happen - default to linux
22 plf = 'linux'
23asapdata = __path__[-1]
[1171]24# Allow user defined data location
25if os.environ.has_key("ASAPDATA"):
26 if os.path.exists(os.environ["ASAPDATA"]):
27 asapdata = os.environ["ASAPDATA"]
[1456]28# use CASAPATH if defined and "data" dir present
29if not os.environ.has_key("CASAPATH") or \
30 not os.path.exists(os.environ["CASAPATH"].split()[0]+"/data"):
31 os.environ["CASAPATH"] = "%s %s somwhere" % ( asapdata, plf)
[1171]32# set up user space
[1080]33userdir = os.environ["HOME"]+"/.asap"
34if not os.path.exists(userdir):
35 print 'First time ASAP use. Setting up ~/.asap'
36 os.mkdir(userdir)
[1445]37 #shutil.copyfile(asapdata+"/data/ipythonrc-asap", userdir+"/ipythonrc-asap")
[1603]38 # commented out by TT on 2009.06.23 for casapy use
[1757]39 ##shutil.copyfile(asapdata+"/data/ipy_user_conf.py",
[1603]40 ## userdir+"/ipy_user_conf.py")
[1080]41 f = file(userdir+"/asapuserfuncs.py", "w")
42 f.close()
43 f = file(userdir+"/ipythonrc", "w")
44 f.close()
[1603]45# commented out by TT on 2009.06.23 for casapy use
46##else:
47 # upgrade to support later ipython versions
48 ##if not os.path.exists(userdir+"/ipy_user_conf.py"):
[1757]49 ## shutil.copyfile(asapdata+"/data/ipy_user_conf.py",
[1603]50 ## userdir+"/ipy_user_conf.py")
51
[1171]52# remove from namespace
[1080]53del asapdata, userdir, shutil, platform
54
[513]55def _validate_bool(b):
[226]56 'Convert b to a boolean or raise'
57 bl = b.lower()
58 if bl in ('f', 'no', 'false', '0', 0): return False
59 elif bl in ('t', 'yes', 'true', '1', 1): return True
60 else:
61 raise ValueError('Could not convert "%s" to boolean' % b)
62
[513]63def _validate_int(s):
[226]64 'convert s to int or raise'
65 try: return int(s)
66 except ValueError:
67 raise ValueError('Could not convert "%s" to int' % s)
68
[513]69def _asap_fname():
[226]70 """
71 Return the path to the rc file
72
73 Search order:
74
75 * current working dir
76 * environ var ASAPRC
[274]77 * HOME/.asaprc
[706]78
[226]79 """
80 fname = os.path.join( os.getcwd(), '.asaprc')
81 if os.path.exists(fname): return fname
82
83 if os.environ.has_key('ASAPRC'):
84 path = os.environ['ASAPRC']
85 if os.path.exists(path):
86 fname = os.path.join(path, '.asaprc')
87 if os.path.exists(fname):
88 return fname
89
90 if os.environ.has_key('HOME'):
91 home = os.environ['HOME']
92 fname = os.path.join(home, '.asaprc')
93 if os.path.exists(fname):
94 return fname
95 return None
96
[706]97
[226]98defaultParams = {
99 # general
[513]100 'verbose' : [True, _validate_bool],
101 'useplotter' : [True, _validate_bool],
[542]102 'insitu' : [True, _validate_bool],
[706]103
[226]104 # plotting
[706]105 'plotter.gui' : [True, _validate_bool],
[226]106 'plotter.stacking' : ['p', str],
107 'plotter.panelling' : ['s', str],
[700]108 'plotter.colours' : ['', str],
109 'plotter.linestyles' : ['', str],
[710]110 'plotter.decimate' : [False, _validate_bool],
111 'plotter.ganged' : [True, _validate_bool],
[1022]112 'plotter.histogram' : [False, _validate_bool],
[1097]113 'plotter.papertype' : ['A4', str],
[1757]114 ## for older Matplotlib version
115 #'plotter.axesformatting' : ['mpl', str],
116 'plotter.axesformatting' : ['asap', str],
[710]117
[226]118 # scantable
119 'scantable.save' : ['ASAP', str],
[513]120 'scantable.autoaverage' : [True, _validate_bool],
[226]121 'scantable.freqframe' : ['LSRK', str], #default frequency frame
[1076]122 'scantable.verbosesummary' : [False, _validate_bool],
[1603]123 'scantable.storage' : ['memory', str],
124 'scantable.history' : [True, _validate_bool],
[1757]125 'scantable.reference' : ['.*(e|w|_R)$', str],
126 'scantable.parallactify' : [False, _validate_bool]
[226]127 # fitter
128 }
129
[255]130def list_rcparameters():
[706]131
[255]132 print """
[737]133# general
134# print verbose output
135verbose : True
[255]136
[737]137# preload a default plotter
138useplotter : True
[255]139
[737]140# apply operations on the input scantable or return new one
141insitu : True
[706]142
[737]143# plotting
[710]144
[737]145# do we want a GUI or plot to a file
146plotter.gui : True
[710]147
[737]148# default mode for colour stacking
149plotter.stacking : Pol
[255]150
[737]151# default mode for panelling
152plotter.panelling : scan
[255]153
[1757]154# push panels together, to share axis labels
[737]155plotter.ganged : True
[710]156
[1603]157# decimate the number of points plotted by a factor of
[737]158# nchan/1024
159plotter.decimate : False
[733]160
[737]161# default colours/linestyles
162plotter.colours :
163plotter.linestyles :
[700]164
[1022]165# enable/disable histogram plotting
166plotter.histogram : False
167
[1097]168# ps paper type
169plotter.papertype : A4
170
[1603]171# The formatting style of the xaxis
[1757]172plotter.axesformatting : 'mpl' (default) or 'asap' (for old versions of matplotlib)
[1603]173
[737]174# scantable
[1076]175
[1259]176# default storage of scantable ('memory'/'disk')
[1076]177scantable.storage : memory
[1603]178
179# write history of each call to scantable
180scantable.history : True
181
[737]182# default ouput format when saving
183scantable.save : ASAP
[1603]184
[737]185# auto averaging on read
186scantable.autoaverage : True
[255]187
[737]188# default frequency frame to set when function
[1097]189# scantable.set_freqframe is called
[737]190scantable.freqframe : LSRK
[255]191
[737]192# Control the level of information printed by summary
193scantable.verbosesummary : False
[706]194
[1603]195# Control the identification of reference (off) scans
196# This is has to be a regular expression
[1757]197scantable.reference : .*(e|w|_R)$
198
199# Indicate whether the data was parallactified (total phase offest == 0.0)
200scantable.parallactify : False
201
[737]202# Fitter
203"""
[706]204
[226]205def rc_params():
206 'Return the default params updated from the values in the rc file'
[706]207
[513]208 fname = _asap_fname()
[706]209
[226]210 if fname is None or not os.path.exists(fname):
211 message = 'could not find rc file; returning defaults'
212 ret = dict([ (key, tup[0]) for key, tup in defaultParams.items()])
213 #print message
214 return ret
[706]215
[226]216 cnt = 0
217 for line in file(fname):
218 cnt +=1
219 line = line.strip()
220 if not len(line): continue
221 if line.startswith('#'): continue
222 tup = line.split(':',1)
223 if len(tup) !=2:
[1612]224 #print ('Illegal line #%d\n\t%s\n\tin file "%s"' % (cnt, line, fname))
[1614]225 asaplog.push('Illegal line #%d\n\t%s\n\tin file "%s"' % (cnt, line, fname))
226 print_log('WARN')
[226]227 continue
[706]228
[226]229 key, val = tup
230 key = key.strip()
231 if not defaultParams.has_key(key):
[1612]232 #print ('Bad key "%s" on line %d in %s' % (key, cnt, fname))
[1614]233 asaplog.push('Bad key "%s" on line %d in %s' % (key, cnt, fname))
234 print_log('WARN')
[226]235 continue
[706]236
[226]237 default, converter = defaultParams[key]
238
239 ind = val.find('#')
240 if ind>=0: val = val[:ind] # ignore trailing comments
241 val = val.strip()
242 try: cval = converter(val) # try to convert to proper type or raise
[1080]243 except ValueError, msg:
[1612]244 #print ('Bad val "%s" on line #%d\n\t"%s"\n\tin file "%s"\n\t%s' % (val, cnt, line, fname, msg))
[1676]245 asaplog.push('Bad val "%s" on line #%d\n\t"%s"\n\tin file "%s"\n\t%s' % (val, cnt, line, fname, str(msg)))
[1614]246 print_log('WARN')
[226]247 continue
248 else:
249 # Alles Klar, update dict
250 defaultParams[key][0] = cval
251
252 # strip the conveter funcs and return
253 ret = dict([ (key, tup[0]) for key, tup in defaultParams.items()])
[466]254 print ('loaded rc file %s'%fname)
[226]255
256 return ret
257
258
259# this is the instance used by the asap classes
[706]260rcParams = rc_params()
[226]261
262rcParamsDefault = dict(rcParams.items()) # a copy
263
264def rc(group, **kwargs):
265 """
266 Set the current rc params. Group is the grouping for the rc, eg
[379]267 for scantable.save the group is 'scantable', for plotter.stacking, the
268 group is 'plotter', and so on. kwargs is a list of attribute
[226]269 name/value pairs, eg
270
[379]271 rc('scantable', save='SDFITS')
[226]272
273 sets the current rc params and is equivalent to
[706]274
[379]275 rcParams['scantable.save'] = 'SDFITS'
[226]276
277 Use rcdefaults to restore the default rc params after changes.
278 """
279
[379]280 aliases = {}
[706]281
[226]282 for k,v in kwargs.items():
283 name = aliases.get(k) or k
[1603]284 if len(group):
285 key = '%s.%s' % (group, name)
286 else:
287 key = name
[226]288 if not rcParams.has_key(key):
289 raise KeyError('Unrecognized key "%s" for group "%s" and name "%s"' % (key, group, name))
[706]290
[226]291 rcParams[key] = v
292
293
294def rcdefaults():
295 """
296 Restore the default rc params - the ones that were created at
297 asap load time
298 """
299 rcParams.update(rcParamsDefault)
300
[1295]301def _n_bools(n, val):
[1757]302 return [ val for i in xrange(n) ]
[513]303
304def _is_sequence_or_number(param, ptype=int):
305 if isinstance(param,tuple) or isinstance(param,list):
[928]306 if len(param) == 0: return True # empty list
[513]307 out = True
308 for p in param:
309 out &= isinstance(p,ptype)
310 return out
311 elif isinstance(param, ptype):
312 return True
313 return False
314
[928]315def _to_list(param, ptype=int):
316 if isinstance(param, ptype):
317 if ptype is str: return param.split()
318 else: return [param]
319 if _is_sequence_or_number(param, ptype):
320 return param
321 return None
[715]322
[944]323def unique(x):
[992]324 """
325 Return the unique values in a list
326 Parameters:
327 x: the list to reduce
328 Examples:
329 x = [1,2,3,3,4]
330 print unique(x)
331 [1,2,3,4]
332 """
[944]333 return dict([ (val, 1) for val in x]).keys()
334
[992]335def list_files(path=".",suffix="rpf"):
336 """
337 Return a list files readable by asap, such as rpf, sdfits, mbf, asap
338 Parameters:
339 path: The directory to list (default '.')
340 suffix: The file extension (default rpf)
341 Example:
342 files = list_files("data/","sdfits")
343 print files
344 ['data/2001-09-01_0332_P363.sdfits',
345 'data/2003-04-04_131152_t0002.sdfits',
346 'data/Sgr_86p262_best_SPC.sdfits']
347 """
348 if not os.path.isdir(path):
349 return None
[1295]350 valid = "rpf rpf.1 rpf.2 sdf sdfits mbf asap".split()
[992]351 if not suffix in valid:
352 return None
353 files = [os.path.expanduser(os.path.expandvars(path+"/"+f)) for f in os.listdir(path)]
354 return filter(lambda x: x.endswith(suffix),files)
355
[715]356# workaround for ipython, which redirects this if banner=0 in ipythonrc
357sys.stdout = sys.__stdout__
358sys.stderr = sys.__stderr__
359
360# Logging
361from asap._asap import Log as _asaplog
362global asaplog
[710]363asaplog=_asaplog()
[715]364if rcParams['verbose']:
365 asaplog.enable()
366else:
367 asaplog.disable()
368
[1757]369
370def print_log_dec(f):
371 @wraps_dec(f)
372 def wrap_it(*args, **kw):
373 val = f(*args, **kw)
374 print_log()
375 return val
376 return wrap_it
377
[1614]378def print_log(level='INFO'):
[1660]379 from taskinit import casalog
[715]380 log = asaplog.pop()
[1612]381 #if len(log) and rcParams['verbose']: print log
[1614]382 if len(log) and rcParams['verbose']: casalog.post( log, priority=level )
[715]383 return
384
[1295]385def mask_and(a, b):
386 assert(len(a)==len(b))
387 return [ a[i] & b[i] for i in xrange(len(a)) ]
[1134]388
[1295]389def mask_or(a, b):
390 assert(len(a)==len(b))
391 return [ a[i] | b[i] for i in xrange(len(a)) ]
392
393def mask_not(a):
394 return [ not i for i in a ]
395
[1117]396from asapfitter import fitter
[895]397from asapreader import reader
[944]398from selector import selector
[710]399
[100]400from asapmath import *
[1080]401from scantable import scantable
[1097]402from asaplinefind import linefinder
[1757]403from simplelinefinder import simplelinefinder
[1134]404from linecatalog import linecatalog
[1460]405from interactivemask import interactivemask
[1757]406from opacity import skydip
407from opacity import model as opacity_model
[285]408
[928]409if rcParams['useplotter']:
[1295]410 try:
[1603]411 from asapplotter import asapplotter
412 gui = os.environ.has_key('DISPLAY') and rcParams['plotter.gui']
413 if gui:
414 import matplotlib
[1729]415 if not matplotlib.sys.modules['matplotlib.backends']: matplotlib.use("TkAgg")
[1757]416 from matplotlib import pylab
[1603]417 xyplotter = pylab
418 plotter = asapplotter(gui)
419 del gui
[1295]420 except ImportError:
[1612]421 #print "Matplotlib not installed. No plotting available"
[1614]422 asaplog.post( "Matplotlib not installed. No plotting available")
423 print_log('WARN')
[285]424
[574]425__date__ = '$Date: 2010-06-09 09:03:06 +0000 (Wed, 09 Jun 2010) $'.split()[1]
[1757]426__version__ = '3.0.0 alma'
[1445]427# nrao casapy specific, get revision number
[1494]428#__revision__ = ' unknown '
[1456]429casapath=os.environ["CASAPATH"].split()
[1624]430#svninfo.txt path
431if os.path.isdir(casapath[0]+'/'+casapath[1]+'/python/2.5/asap'):
432 # for casa developer environment (linux or darwin)
433 revinfo=casapath[0]+'/'+casapath[1]+'/python/2.5/asap/svninfo.txt'
434else:
435 # for end-user environments
436 if casapath[1]=='darwin':
437 revinfo=casapath[0]+'/Resources/python/asap/svninfo.txt'
438 else:
439 revinfo=casapath[0]+'/lib/python2.5/asap/svninfo.txt'
[1445]440if os.path.isfile(revinfo):
441 f = file(revinfo)
[1605]442 f.readline()
[1445]443 revsionno=f.readline()
444 f.close()
[1662]445 del f
[1445]446 __revision__ = revsionno.rstrip()
[1494]447else:
448 __revision__ = ' unknown '
[100]449
[1193]450def is_ipython():
[1757]451 return 'IPython' in sys.modules.keys()
[1193]452if is_ipython():
[1014]453 def version(): print "ASAP %s(%s)"% (__version__, __date__)
[1757]454
[706]455 def list_scans(t = scantable):
[1757]456 import inspect
457 print "The user created scantables are: ",
458 globs=inspect.currentframe().f_back.f_locals.copy()
459 out = [ k for k,v in globs.iteritems() \
460 if isinstance(v, scantable) and not k.startswith("_") ]
461 print out
462 return out
[100]463
[715]464 def commands():
465 x = """
[113]466 [The scan container]
467 scantable - a container for integrations/scans
[182]468 (can open asap/rpfits/sdfits and ms files)
[113]469 copy - returns a copy of a scan
470 get_scan - gets a specific scan out of a scantable
[984]471 (by name or number)
[1093]472 drop_scan - drops a specific scan out of a scantable
473 (by number)
[984]474 set_selection - set a new subselection of the data
475 get_selection - get the current selection object
[113]476 summary - print info about the scantable contents
[182]477 stats - get specified statistic of the spectra in
478 the scantable
479 stddev - get the standard deviation of the spectra
480 in the scantable
[113]481 get_tsys - get the TSys
482 get_time - get the timestamps of the integrations
[1351]483 get_inttime - get the integration time
[733]484 get_sourcename - get the source names of the scans
[794]485 get_azimuth - get the azimuth of the scans
486 get_elevation - get the elevation of the scans
487 get_parangle - get the parallactic angle of the scans
[1757]488 get_coordinate - get the spectral coordinate for the given row,
489 which can be used for coordinate conversions
490 get_weather - get the weather condition parameters
[876]491 get_unit - get the current unit
[513]492 set_unit - set the abcissa unit to be used from this
493 point on
[255]494 get_abcissa - get the abcissa values and name for a given
495 row (time)
[1259]496 get_column_names - get the names of the columns in the scantable
497 for use with selector.set_query
[113]498 set_freqframe - set the frame info for the Spectral Axis
499 (e.g. 'LSRK')
[276]500 set_doppler - set the doppler to be used from this point on
[984]501 set_dirframe - set the frame for the direction on the sky
[240]502 set_instrument - set the instrument name
[1190]503 set_feedtype - set the feed type
[255]504 get_fluxunit - get the brightness flux unit
[240]505 set_fluxunit - set the brightness flux unit
[1603]506 set_sourcetype - set the type of the source - source or reference
[188]507 create_mask - return an mask in the current unit
508 for the given region. The specified regions
509 are NOT masked
[255]510 get_restfreqs - get the current list of rest frequencies
511 set_restfreqs - set a list of rest frequencies
[1603]512 shift_refpix - shift the reference pixel of the IFs
513 set_spectrum - overwrite the spectrum for a given row
514 get_spectrum - retrieve the spectrum for a given
515 get_mask - retrieve the mask for a given
[1012]516 flag - flag selected channels in the data
[1192]517 lag_flag - flag specified frequency in the data
[1151]518 save - save the scantable to disk as either 'ASAP',
519 'SDFITS' or 'ASCII'
[486]520 nbeam,nif,nchan,npol - the number of beams/IFs/Pols/Chans
[733]521 nscan - the number of scans in the scantable
[1603]522 nrow - the number of spectra in the scantable
[486]523 history - print the history of the scantable
[530]524 get_fit - get a fit which has been stored witnh the data
[706]525 average_time - return the (weighted) time average of a scan
[513]526 or a list of scans
527 average_pol - average the polarisations together.
[1144]528 average_beam - average the beams together.
[992]529 convert_pol - convert to a different polarisation type
[690]530 auto_quotient - return the on/off quotient with
[1069]531 automatic detection of the on/off scans (closest
532 in time off is selected)
[1144]533 mx_quotient - Form a quotient using MX data (off beams)
[1014]534 scale, *, / - return a scan scaled by a given factor
[1757]535 add, + - return a scan with given value added
536 sub, - - return a scan with given value subtracted
[513]537 bin - return a scan with binned channels
538 resample - return a scan with resampled channels
539 smooth - return the spectrally smoothed scan
540 poly_baseline - fit a polynomial baseline to all Beams/IFs/Pols
[706]541 auto_poly_baseline - automatically fit a polynomial baseline
[780]542 recalc_azel - recalculate azimuth and elevation based on
543 the pointing
[513]544 gain_el - apply gain-elevation correction
545 opacity - apply opacity correction
546 convert_flux - convert to and from Jy and Kelvin brightness
[255]547 units
[513]548 freq_align - align spectra in frequency frame
[1014]549 invert_phase - Invert the phase of the cross-correlation
[1351]550 swap_linears - Swap XX and YY (or RR LL)
[513]551 rotate_xyphase - rotate XY phase of cross correlation
552 rotate_linpolphase - rotate the phase of the complex
553 polarization O=Q+iU correlation
[733]554 freq_switch - perform frequency switching on the data
555 stats - Determine the specified statistic, e.g. 'min'
556 'max', 'rms' etc.
557 stddev - Determine the standard deviation of the current
558 beam/if/pol
[1757]559 get_row_selector - get the selection object for a specified row
560 number
[1014]561 [Selection]
562 selector - a selection object to set a subset of a scantable
563 set_scans - set (a list of) scans by index
564 set_cycles - set (a list of) cycles by index
565 set_beams - set (a list of) beamss by index
566 set_ifs - set (a list of) ifs by index
567 set_polarisations - set (a list of) polarisations by name
568 or by index
569 set_names - set a selection by name (wildcards allowed)
570 set_tsys - set a selection by tsys thresholds
[1259]571 set_query - set a selection by SQL-like query, e.g. BEAMNO==1
[1351]572 ( also get_ functions for all these )
[1014]573 reset - unset all selections
[1351]574 + - merge two selections
[733]575
[513]576 [Math] Mainly functions which operate on more than one scantable
[100]577
[706]578 average_time - return the (weighted) time average
[513]579 of a list of scans
580 quotient - return the on/off quotient
581 simple_math - simple mathematical operations on two scantables,
582 'add', 'sub', 'mul', 'div'
[1069]583 quotient - build quotient of the given on and off scans
[1351]584 (matched pairs and 1 off - n on are valid)
[1117]585 merge - merge a list of scantables
[1069]586
[1151]587 [Line Catalog]
588 linecatalog - a linecatalog wrapper, taking an ASCII or
589 internal format table
590 summary - print a summary of the current selection
591 set_name - select a subset by name pattern, e.g. '*OH*'
592 set_strength_limits - select a subset by line strength limits
593 set_frequency_limits - select a subset by frequency limits
594 reset - unset all selections
595 save - save the current subset to a table (internal
596 format)
597 get_row - get the name and frequency from a specific
598 row in the table
[513]599 [Fitting]
[113]600 fitter
601 auto_fit - return a scan where the function is
602 applied to all Beams/IFs/Pols.
603 commit - return a new scan where the fits have been
604 commited.
605 fit - execute the actual fitting process
[984]606 store_fit - store the fit parameters in the data (scantable)
[113]607 get_chi2 - get the Chi^2
608 set_scan - set the scantable to be fit
609 set_function - set the fitting function
610 set_parameters - set the parameters for the function(s), and
611 set if they should be held fixed during fitting
[513]612 set_gauss_parameters - same as above but specialised for individual
613 gaussian components
[113]614 get_parameters - get the fitted parameters
[513]615 plot - plot the resulting fit and/or components and
616 residual
[210]617 [Plotter]
618 asapplotter - a plotter for asap, default plotter is
619 called 'plotter'
[984]620 plot - plot a scantable
[1151]621 plot_lines - plot a linecatalog overlay
[1757]622 plotazel - plot azimuth and elevation versus time
623 plotpointing - plot telescope pointings
[378]624 save - save the plot to a file ('png' ,'ps' or 'eps')
[210]625 set_mode - set the state of the plotter, i.e.
626 what is to be plotted 'colour stacked'
627 and what 'panelled'
[984]628 set_selection - only plot a selected part of the data
[733]629 set_range - set a 'zoom' window [xmin,xmax,ymin,ymax]
[255]630 set_legend - specify user labels for the legend indeces
631 set_title - specify user labels for the panel indeces
[733]632 set_abcissa - specify a user label for the abcissa
[255]633 set_ordinate - specify a user label for the ordinate
[378]634 set_layout - specify the multi-panel layout (rows,cols)
[733]635 set_colors - specify a set of colours to use
636 set_linestyles - specify a set of linestyles to use if only
637 using one color
[1151]638 set_font - set general font properties, e.g. 'family'
[1054]639 set_histogram - plot in historam style
[733]640 set_mask - set a plotting mask for a specific polarization
[1171]641 text - draw text annotations either in data or relative
642 coordinates
643 arrow - draw arrow annotations either in data or relative
644 coordinates
645 axhline,axvline - draw horizontal/vertical lines
646 axhspan,axvspan - draw horizontal/vertical regions
[1757]647 annotate - draw an arrow with label
648 create_mask - create a scnatble mask interactively
[1175]649
650 xyplotter - matplotlib/pylab plotting functions
651
[113]652 [General]
653 commands - this command
654 print - print details about a variable
[1757]655 list_scans - list all scantables created by the user
[992]656 list_files - list all files readable by asap (default rpf)
[113]657 del - delete the given variable from memory
658 range - create a list of values, e.g.
659 range(3) = [0,1,2], range(2,5) = [2,3,4]
660 help - print help for one of the listed functions
661 execfile - execute an asap script, e.g. execfile('myscript')
[255]662 list_rcparameters - print out a list of possible values to be
[274]663 put into $HOME/.asaprc
[1171]664 rc - set rc parameters from within asap
[466]665 mask_and,mask_or,
666 mask_not - boolean operations on masks created with
667 scantable.create_mask
[1757]668 skydip - gain opacity values from a sky dip observation
669 opacity_model - compute opacities fro given frequencies based on
670 atmospheric model
[706]671
[210]672 Note:
673 How to use this with help:
674 # function 'summary'
675 [xxx] is just a category
676 Every 'sub-level' in this list should be replaces by a '.' Period when
[706]677 using help
[210]678 Example:
679 ASAP> help scantable # to get info on ths scantable
680 ASAP> help scantable.summary # to get help on the scantable's
681 ASAP> help average_time
682
[715]683 """
[1151]684 if rcParams['verbose']:
685 try:
686 from IPython.genutils import page as pager
687 except ImportError:
688 from pydoc import pager
689 pager(x)
690 else:
691 print x
[715]692 return
[113]693
[706]694def welcome():
695 return """Welcome to ASAP v%s (%s) - the ATNF Spectral Analysis Package
[100]696
[1035]697Please report any bugs via:
[1378]698http://svn.atnf.csiro.au/trac/asap/simpleticket
[100]699
[378]700[IMPORTANT: ASAP is 0-based]
[706]701Type commands() to get a list of all available ASAP commands.""" % (__version__, __date__)
Note: See TracBrowser for help on using the repository browser.