Index: tags/asap0019/Makefile
===================================================================
--- branches/Release-1-fixes/Makefile	(revision 624)
+++ 	(revision )
@@ -1,15 +1,0 @@
-
-# directoty to install ASAP and the source directory
-ifdef NARRABRI_ASAP
-ASAPDIR := /DATA/KAPUTAR_2/vor010/ASAP/site-packages/asap
-else
-ASAPDIR := /usr/local/lib/python2.3/site-packages/asap
-endif
-
-SRCDIR := $(shell pwd)
-
-all:
-	cd src; make
-
-install: all
-	sh - bin/install.sh $(ASAPDIR) $(SRCDIR)
Index: tags/asap0019/python/__init__.py
===================================================================
--- branches/Release-1-fixes/python/__init__.py	(revision 624)
+++ 	(revision )
@@ -1,394 +1,0 @@
-"""
-This is the ATNF Single Dish Analysis package.
-
-"""
-import os,sys
-
-def _validate_bool(b):
-    'Convert b to a boolean or raise'
-    bl = b.lower()
-    if bl in ('f', 'no', 'false', '0', 0): return False
-    elif bl in ('t', 'yes', 'true', '1', 1): return True
-    else:
-        raise ValueError('Could not convert "%s" to boolean' % b)
-
-def _validate_int(s):
-    'convert s to int or raise'
-    try: return int(s)
-    except ValueError:
-        raise ValueError('Could not convert "%s" to int' % s)
-
-def _asap_fname():
-    """
-    Return the path to the rc file
-
-    Search order:
-
-     * current working dir
-     * environ var ASAPRC
-     * HOME/.asaprc
-     
-    """
-
-    fname = os.path.join( os.getcwd(), '.asaprc')
-    if os.path.exists(fname): return fname
-
-    if os.environ.has_key('ASAPRC'):
-        path =  os.environ['ASAPRC']
-        if os.path.exists(path):
-            fname = os.path.join(path, '.asaprc')
-            if os.path.exists(fname):
-                return fname
-
-    if os.environ.has_key('HOME'):
-        home =  os.environ['HOME']
-        fname = os.path.join(home, '.asaprc')
-        if os.path.exists(fname):
-            return fname
-    return None
-        
-
-defaultParams = {
-    # general
-    'verbose'             : [True, _validate_bool],
-    'useplotter'          : [True, _validate_bool],
-    'insitu'              : [True, _validate_bool],
-    
-    # plotting
-    'plotter.stacking'    : ['p', str],
-    'plotter.panelling'   : ['s', str],
-    
-    # scantable
-    'scantable.save'      : ['ASAP', str],
-    'scantable.autoaverage'      : [True, _validate_bool],
-    'scantable.freqframe' : ['LSRK', str],  #default frequency frame
-    'scantable.allaxes'   : [True, _validate_bool],  # apply action to all axes
-    'scantable.plotter'   : [True, _validate_bool], # use internal plotter
-    'scantable.verbosesummary'   : [False, _validate_bool]
-
-    # fitter
-    }
-
-def list_rcparameters():
-    
-    print """
-    # general
-    # print verbose output
-    verbose                    : True
-
-    # preload a default plotter
-    useplotter                 : True
-
-    # apply operations on the input scantable or return new one
-    insitu                     : True
-    
-    # plotting
-    # default mode for colour stacking
-    plotter.stacking           : Pol
-
-    # default mode for panelling
-    plotter.panelling          : scan
-
-    # scantable
-    # default ouput format when saving
-    scantable.save             : ASAP
-    # auto averaging on read
-    scantable.autoaverage      : True
-
-    # default frequency frame to set when function
-    # scantable.set_freqfrmae is called
-    scantable.freqframe        : LSRK
-
-    # apply action to all axes not just the cursor location
-    scantable.allaxes          : True 
-
-    # use internal plotter
-    scantable.plotter          : True
-
-    # Control the level of information printed by summary
-    scantable.verbosesummary   : False
-    
-    # Fitter    
-    """
-    
-def rc_params():
-    'Return the default params updated from the values in the rc file'
-    
-    fname = _asap_fname()
-    
-    if fname is None or not os.path.exists(fname):
-        message = 'could not find rc file; returning defaults'
-        ret =  dict([ (key, tup[0]) for key, tup in defaultParams.items()])
-        #print message
-        return ret
-        
-    cnt = 0
-    for line in file(fname):
-        cnt +=1
-        line = line.strip()
-        if not len(line): continue
-        if line.startswith('#'): continue
-        tup = line.split(':',1)
-        if len(tup) !=2:
-            print ('Illegal line #%d\n\t%s\n\tin file "%s"' % (cnt, line, fname))
-            continue
-        
-        key, val = tup
-        key = key.strip()
-        if not defaultParams.has_key(key):
-            print ('Bad key "%s" on line %d in %s' % (key, cnt, fname))
-            continue
-        
-        default, converter =  defaultParams[key]
-
-        ind = val.find('#')
-        if ind>=0: val = val[:ind]   # ignore trailing comments
-        val = val.strip()
-        try: cval = converter(val)   # try to convert to proper type or raise
-        except Exception, msg:
-            print ('Bad val "%s" on line #%d\n\t"%s"\n\tin file "%s"\n\t%s' % (val, cnt, line, fname, msg))
-            continue
-        else:
-            # Alles Klar, update dict
-            defaultParams[key][0] = cval
-
-    # strip the conveter funcs and return
-    ret =  dict([ (key, tup[0]) for key, tup in defaultParams.items()])
-    print ('loaded rc file %s'%fname)
-
-    return ret
-
-
-# this is the instance used by the asap classes
-rcParams = rc_params() 
-
-rcParamsDefault = dict(rcParams.items()) # a copy
-
-def rc(group, **kwargs):
-    """
-    Set the current rc params.  Group is the grouping for the rc, eg
-    for scantable.save the group is 'scantable', for plotter.stacking, the
-    group is 'plotter', and so on.  kwargs is a list of attribute
-    name/value pairs, eg
-
-      rc('scantable', save='SDFITS')
-
-    sets the current rc params and is equivalent to
-    
-      rcParams['scantable.save'] = 'SDFITS'
-
-    Use rcdefaults to restore the default rc params after changes.
-    """
-
-    aliases = {}
-    
-    for k,v in kwargs.items():
-        name = aliases.get(k) or k
-        key = '%s.%s' % (group, name)
-        if not rcParams.has_key(key):
-            raise KeyError('Unrecognized key "%s" for group "%s" and name "%s"' % (key, group, name))
-        
-        rcParams[key] = v
-
-
-def rcdefaults():
-    """
-    Restore the default rc params - the ones that were created at
-    asap load time
-    """
-    rcParams.update(rcParamsDefault)
-
-
-def _is_sequence_or_number(param, ptype=int):
-    if isinstance(param,tuple) or isinstance(param,list):
-        out = True
-        for p in param:
-            out &= isinstance(p,ptype)
-        return out
-    elif isinstance(param, ptype):
-        return True
-    return False
-
-from asapfitter import *
-from asapreader import reader
-from asapmath import *
-from scantable import *
-from asaplinefind import *
-from asapfit import *
-
-from numarray import logical_and as mask_and
-from numarray import logical_or as mask_or
-from numarray import logical_not as mask_not
-
-if rcParams['useplotter']:
-    if os.environ.has_key('DISPLAY'):
-        print "Initialising asapplotter with the name 'plotter' ..."
-        import asapplotter 
-        plotter = asapplotter.asapplotter()
-    else:
-        print "No $DISPLAY set. Disabling plotter.\n"
-
-#from numarray ones,zeros
-
-
-__date__ = '$Date$'
-__version__  = '1.0'
-
-def list_scans(t = scantable):
-    import sys, types
-    #meta_t = type(t)
-    #if meta_t == types.InstanceType:
-    #    t = t.__class__
-    #elif meta_t not in [types.ClassType, types.TypeType]:
-    #    t = meta_t
-    globs = sys.modules['__main__'].__dict__.iteritems()
-    print "The user created scantables are:"
-    sts = map(lambda x: x[0], filter(lambda x: isinstance(x[1], t), globs))
-    print filter(lambda x: not x.startswith('_'), sts)
-
-def commands():
-    x = """    
-    [The scan container]
-        scantable           - a container for integrations/scans
-                              (can open asap/rpfits/sdfits and ms files)
-            copy            - returns a copy of a scan
-            get_scan        - gets a specific scan out of a scantable
-            summary         - print info about the scantable contents
-            set_cursor      - set a specific Beam/IF/Pol 'cursor' for
-                              further use
-            get_cursor      - print out the current cursor position
-            stats           - get specified statistic of the spectra in
-                              the scantable
-            stddev          - get the standard deviation of the spectra
-                              in the scantable
-            get_tsys        - get the TSys
-            get_time        - get the timestamps of the integrations
-            get_unit        - get the currnt unit
-            set_unit        - set the abcissa unit to be used from this
-                              point on
-            get_abcissa     - get the abcissa values and name for a given
-                              row (time)
-            set_freqframe   - set the frame info for the Spectral Axis
-                              (e.g. 'LSRK')
-            set_doppler     - set the doppler to be used from this point on
-            set_instrument  - set the instrument name
-            get_fluxunit    - get the brightness flux unit
-            set_fluxunit    - set the brightness flux unit
-            create_mask     - return an mask in the current unit
-                              for the given region. The specified regions
-                              are NOT masked
-            get_restfreqs   - get the current list of rest frequencies
-            set_restfreqs   - set a list of rest frequencies
-            lines           - print list of known spectral lines
-            flag_spectrum   - flag a whole Beam/IF/Pol
-            save            - save the scantable to disk as either 'ASAP'
-                              or 'SDFITS'
-            nbeam,nif,nchan,npol - the number of beams/IFs/Pols/Chans
-            history         - print the history of the scantable
-            get_fit         - get a fit which has been stored witnh the data
-            average_time    - return the (weighted) time average of a scan 
-                              or a list of scans
-            average_pol     - average the polarisations together.
-                              The dimension won't be reduced and
-                              all polarisations will contain the
-                              averaged spectrum.
-            quotient        - return the on/off quotient
-            scale           - return a scan scaled by a given factor
-            add             - return a scan with given value added 
-            bin             - return a scan with binned channels
-            resample        - return a scan with resampled channels
-            smooth          - return the spectrally smoothed scan
-            poly_baseline   - fit a polynomial baseline to all Beams/IFs/Pols
-            auto_poly_baseline - automatically fit a polynomial baseline 
-            gain_el         - apply gain-elevation correction
-            opacity         - apply opacity correction
-            convert_flux    - convert to and from Jy and Kelvin brightness
-                              units
-            freq_align      - align spectra in frequency frame
-            rotate_xyphase  - rotate XY phase of cross correlation
-            rotate_linpolphase - rotate the phase of the complex
-                                 polarization O=Q+iU correlation
-     [Math] Mainly functions which operate on more than one scantable
-
-            average_time    - return the (weighted) time average 
-                              of a list of scans
-            quotient        - return the on/off quotient
-            simple_math     - simple mathematical operations on two scantables,
-                              'add', 'sub', 'mul', 'div'
-     [Fitting]
-        fitter
-            auto_fit        - return a scan where the function is
-                              applied to all Beams/IFs/Pols.
-            commit          - return a new scan where the fits have been
-                              commited.
-            fit             - execute the actual fitting process
-            store_fit       - store the fit paramaters in the data (scantable)
-            get_chi2        - get the Chi^2
-            set_scan        - set the scantable to be fit
-            set_function    - set the fitting function
-            set_parameters  - set the parameters for the function(s), and
-                              set if they should be held fixed during fitting
-            set_gauss_parameters - same as above but specialised for individual
-                                   gaussian components
-            get_parameters  - get the fitted parameters
-            plot            - plot the resulting fit and/or components and
-                              residual
-    [Plotter]
-        asapplotter         - a plotter for asap, default plotter is
-                              called 'plotter'
-            plot            - plot a (list of) scantable
-            save            - save the plot to a file ('png' ,'ps' or 'eps')
-            set_mode        - set the state of the plotter, i.e.
-                              what is to be plotted 'colour stacked'
-                              and what 'panelled'
-            set_cursor      - only plot a selected part of the data
-            set_range       - set a 'zoom' window
-            set_legend      - specify user labels for the legend indeces
-            set_title       - specify user labels for the panel indeces
-            set_ordinate    - specify a user label for the ordinate
-            set_abcissa     - specify a user label for the abcissa
-            set_layout      - specify the multi-panel layout (rows,cols)
-            
-    [Reading files]
-        reader              - access rpfits/sdfits files
-            read            - read in integrations
-            summary         - list info about all integrations
-
-    [General]
-        commands            - this command
-        print               - print details about a variable
-        list_scans          - list all scantables created bt the user
-        del                 - delete the given variable from memory
-        range               - create a list of values, e.g.
-                              range(3) = [0,1,2], range(2,5) = [2,3,4]
-        help                - print help for one of the listed functions
-        execfile            - execute an asap script, e.g. execfile('myscript')
-        list_rcparameters   - print out a list of possible values to be
-                              put into $HOME/.asaprc
-        mask_and,mask_or,
-        mask_not            - boolean operations on masks created with
-                              scantable.create_mask
-        
-    Note:
-        How to use this with help:
-                                         # function 'summary'
-        [xxx] is just a category
-        Every 'sub-level' in this list should be replaces by a '.' Period when
-        using help 
-        Example:
-            ASAP> help scantable # to get info on ths scantable
-            ASAP> help scantable.summary # to get help on the scantable's
-            ASAP> help average_time
-
-    """
-    print x
-    return
-
-print """Welcome to ASAP v%s - the ATNF Spectral Analysis Package
-
-Please report any bugs to:
-asap@atnf.csiro.au
-
-[IMPORTANT: ASAP is 0-based]
-Type commands() to get a list of all available ASAP commands.
-""" % (__version__)
Index: tags/asap0019/python/asapfit.py
===================================================================
--- branches/Release-1-fixes/python/asapfit.py	(revision 624)
+++ 	(revision )
@@ -1,73 +1,0 @@
-from _asap import sdfit
-from asap import rcParams
-
-class asapfit(sdfit):
-    
-    def __init__(self, other):        
-        sdfit.__init__(self,other)
-
-    def __str__(self):
-        if self.__len__() == 0:
-            return "No fits"
-        out = ""
-        for i in range(self.__len__()):
-            out += "Fit No %d:" % (i)
-            pars = self.getparameters(i)
-            mask = self.getfixedparameters(i)
-            funcs = self.getfunctions(i)
-            comps = self.getcomponents(i)
-            finfo = self.getframeinfo(i)
-            pos=0
-            k = 0
-            for f in funcs:
-                out += "\n Type:         "
-                out += f
-                s = pos
-                pos += comps[k]
-                ps = pars[s:pos]
-                out += "\n  Parameters:  "                
-                out += self._format_pars(pars[s:pos],f, finfo[0])
-                out += "\n  Fixed Parms: "
-                out += str(mask[s:pos])
-                out += "\n  Frame:       "
-                out += str(finfo)
-                out += "\n"
-            out += "\n"
-        return out
-
-    def as_dict(self):
-        out = []
-        for i in range(self.__len__()):
-            pars = self.getparameters(i)
-            mask = self.getfixedparameters(i)
-            funcs = self.getfunctions(i)
-            comps = self.getcomponents(i)
-            pos=0
-            k=0
-            comp = []
-            for f in funcs:
-                s = pos
-                pos += comps[k]
-                ps = pars[s:pos]
-                d = {'function' : f,
-                     'parameters' : pars[s:pos],
-                     'fixed' : mask[s:pos],
-                     'frame' : self.getframeinfo(i)
-                     }
-                comp.append(d)
-            out.append(comp)
-        return out
-
-    
-    def _format_pars(self, pars, ftype, unit):
-        out = ''
-        if ftype == 'poly':
-            i = 0
-            for p in pars:
-                out += ' p%d = %3.3f %s,' % (i,p,unit)
-                i+=1
-            out = out[1:-1]
-        elif ftype == 'gauss':            
-            out += 'peak = %3.3f , centre = %3.3f %s, FWHM = %3.3f %s' % (pars[0],pars[1],unit,pars[2],unit)
-
-        return out
Index: tags/asap0019/python/asaplinefind.py
===================================================================
--- branches/Release-1-fixes/python/asaplinefind.py	(revision 624)
+++ 	(revision )
@@ -1,132 +1,0 @@
-import _asap
-
-class linefinder:
-    """
-    The class for automated spectral line search in ASAP.
-
-    Example:
-       fl=linefinder()
-       fl.set_scan(sc,edge=(50,))
-       fl.set_options(threshold=3)
-       nlines=fl.find_lines()
-       if nlines!=0:
-          print "Found ",nlines," spectral lines"
-          print fl.get_ranges(False)
-       else:
-          print "No lines found!"
-       sc2=sc.poly_baseline(fl.get_mask(),7)
-    
-    The algorithm involves a simple threshold criterion. The line is
-    considered to be detected if a specified number of consequtive
-    channels (default is 3) is brighter (with respect to the current baseline
-    estimate) than the threshold times the noise level. This criterion is
-    applied in the iterative procedure updating baseline estimate and trying
-    reduced spectral resolutions to detect broad lines as well. The off-line
-    noise level is determined at each iteration as an average of 80% of the
-    lowest variances across the spectrum (i.e. histogram equalization is
-    used to avoid missing weak lines if strong ones are present). For
-    bad baseline shapes it is reccommended to increase the threshold and 
-    possibly switch the averaging option off (see set_options) to
-    detect strong lines only, fit a high order baseline and repeat the line
-    search. 
-
-    """
-
-    def __init__(self):
-	"""
-	Create a line finder object.
-	"""
-	self.finder = _asap.linefinder()
-	return
-
-    def set_options(self,threshold=1.7320508075688772,min_nchan=3,
-        avg_limit=8,box_size=0.2):
-	"""
-	Set the parameters of the algorithm
-	Parameters:
-	     threshold    a single channel S/N ratio above which the 
-	                  channel is considered to be a detection
-			  Default is sqrt(3), which together with
-			  min_nchan=3 gives a 3-sigma criterion
-	     min_nchan    a minimal number of consequtive channels, 
-                          which should satisfy a threshold criterion to
-			  be a detection. Default is 3.
-	     avg_limit    A number of consequtive channels not greater than
-	                  this parameter can be averaged to search for
-			  broad lines. Default is 8.
-	     box_size     A running mean box size specified as a fraction
-                          of the total spectrum length. Default is 1/5
-	Note:  For bad baselines threshold should be increased, 
-	       and avg_limit decreased (or even switched off completely by
-	       setting this parameter to 1) to avoid detecting baseline
-	       undulations instead of real lines.  
-        """
-        self.finder.setoptions(threshold,min_nchan,avg_limit,box_size)
-	return
-	     
-    def set_scan(self,scan,mask=None,edge=(0,0)):
-	"""
-	Set the 'data' (scantable) to work with.
-	Parameters:
-	     scan:    a scantable
-	     mask:       an optional mask retreived from scantable
-	     edge:       an optional number of channel to drop at
-			 the edge of spectrum. If only one value is
-			 specified, the same number will be dropped from
-			 both sides of the spectrum. Default is to keep
-			 all channels
-        """
-	if not scan:
-	   raise RuntimeError, 'Please give a correct scan'
- 
-	if isinstance(edge,int):
-	   edge=(edge,)
-
-        from asap import _is_sequence_or_number as _is_valid
-
-        if not _is_valid(edge, int):
-           raise RuntimeError, "Parameter 'edge' has to be an integer or \
-           a pair of integers specified as a tuple"
-
-	if len(edge)>2:
-	   raise RuntimeError, "The edge parameter should have two \
-           or less elements"
-	if mask is None:
-	    from numarray import ones
-	    self.finder.setscan(scan,ones(scan.nchan()),tuple(edge))
-	else:    
-	    self.finder.setscan(scan,mask,tuple(edge))
-	return 
-    def find_lines(self,nRow=0):
-	"""
-	Search for spectral lines in the scan assigned in set_scan.
-	Current Beam/IF/Pol is used, Row is specified by parameter
-	A number of lines found will be returned
-	"""
-	return self.finder.findlines(nRow)
-    def get_mask(self,invert=False):
-	"""
-	Get the mask to mask out all lines that have been found (default)
-
-	Parameters:
-	      invert  if True, only channels belong to lines will be unmasked
-
-	Note: all channels originally masked by the input mask or
-	      dropped out by the edge parameter will still be excluded
-	      regardless on the invert option
-        """
-	return self.finder.getmask(invert)
-    def get_ranges(self,defunits=True):
-	"""
-	Get ranges (start and end channels or velocities) for all spectral
-	lines found. 
-
-	Parameters:
-	      defunits  if True (default), the range will use the same units
-		        as set for the scan (e.g. LSR velocity)
-			if False, the range will be expressed in channels 
-	"""
-	if (defunits):
-	    return self.finder.getlineranges()
-	else:
-	    return self.finder.getlinerangesinchannels()
Index: tags/asap0019/python/asaplot.py
===================================================================
--- branches/Release-1-fixes/python/asaplot.py	(revision 624)
+++ 	(revision )
@@ -1,805 +1,0 @@
-"""
-ASAP plotting class based on matplotlib.
-"""
-
-import sys
-from re import match
-import Tkinter as Tk
-
-import matplotlib
-matplotlib.use("TkAgg")
-
-from matplotlib.backends import new_figure_manager, show
-from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, \
-	FigureManagerTkAgg
-from matplotlib.figure import Figure, Text
-from matplotlib.font_manager import FontProperties
-from matplotlib.numerix import sqrt
-from matplotlib import rc, rcParams
-
-# Force use of the newfangled toolbar.
-matplotlib.rcParams['toolbar'] = 'toolbar2'
-
-# Colour dictionary.
-colours = {}
-
-class ASAPlot:
-    """
-    ASAP plotting class based on matplotlib.
-    """
-
-    def __init__(self, rows=1, cols=0, title='', size=(8,6), buffering=False):
-	"""
-	Create a new instance of the ASAPlot plotting class.
-
-	If rows < 1 then a separate call to set_panels() is required to define
-	the panel layout; refer to the doctext for set_panels().
-	"""
-	self.window = Tk.Tk()
-	self.is_dead = False
-	def dest_callback():
-	    self.is_dead = True
-	    self.window.destroy()
-
-	self.window.protocol("WM_DELETE_WINDOW", dest_callback)
-
-	self.figure = Figure(figsize=size, facecolor='#ddddee')
-	self.canvas = FigureCanvasTkAgg(self.figure, master=self.window)
-	self.canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
-
-	# Simply instantiating this is enough to get a working toolbar.
-	self.figmgr = FigureManagerTkAgg(self.canvas, 1, self.window)
-	self.window.wm_title('ASAPlot graphics window')
-
-	self.events = {'button_press':None,
-		       'button_release':None,
-		       'motion_notify':None}
-
-	self.set_title(title)
-	self.subplots = []
-	if rows > 0:
-	    self.set_panels(rows, cols)
-
-
-	# Set matplotlib default colour sequence.
-	self.colours = [1, 'b', 'g', 'r', 'c', 'm', 'y', 'k']
-	self.attributes = {}
-	self.loc = 0
-
-	matplotlib.interactive = True
-	self.buffering = buffering
-
-	self.canvas.show()
-
-
-    def clear(self):
-	"""
-	Delete all lines from the plot.  Line numbering will restart from 1.
-	"""
-
-	for i in range(1,len(self.lines)+1):
-	   self.delete(i)
-	self.axes.clear()
-	self.colours[0] = 1
-	self.lines = []
-
-
-    def delete(self, numbers=None):
-	"""
-	Delete the 0-relative line number, default is to delete the last.
-	The remaining lines are NOT renumbered.
-	"""
-
-	if numbers is None: numbers = [len(self.lines)-1]
-
-	if not hasattr(numbers, '__iter__'):
-	    numbers = [numbers]
-
-	for number in numbers:
-	    if 0 <= number < len(self.lines):
-		if self.lines[number] is not None:
-		    for line in self.lines[number]:
-			line.set_linestyle('None')
-			self.lines[number] = None
-        self.show()        
-
-    def get_line(self):
-	"""
-	Get the current default line attributes.
-	"""
-	return self.attributes
-
-
-    def hist(self, x=None, y=None, fmt=None):
-	"""
-	Plot a histogram.  N.B. the x values refer to the start of the
-	histogram bin.
-
-	fmt is the line style as in plot().
-	"""
-
-	if x is None:
-	    if y is None: return
-	    x = range(0,len(y))
-
-	if len(x) != len(y):
-	    return
-
-	l2 = 2*len(x)
-	x2 = range(0,l2)
-	y2 = range(0,l2)
-
-	for i in range(0,l2):
-	    x2[i] = x[i/2]
-
-	y2[0] = 0
-	for i in range(1,l2):
-	    y2[i] = y[(i-1)/2]
-
-	self.plot(x2, y2, fmt)
-
-
-    def hold(self, hold=True):
-	"""
-	Buffer graphics until subsequently released.
-	"""
-	self.buffering = hold
-
-
-    def legend(self, loc=None):
-	"""
-	Add a legend to the plot.
-
-	Any other value for loc else disables the legend:
-	     1: upper right
-	     2: upper left
-	     3: lower left
-	     4: lower right
-	     5: right
-	     6: center left
-	     7: center right
-	     8: lower center
-	     9: upper center
-	    10: center
-
-	"""
-        if isinstance(loc,int):
-            if 0 > loc > 10: loc = 0
-            self.loc = loc
-	self.show()
-
-
-    def map(self):
-	"""
-	Reveal the ASAPlot graphics window and bring it to the top of the
-	window stack.
-	"""
-	self.window.wm_deiconify()
-	self.window.lift()
-
-
-    def palette(self, pen=None, colours=None):
-	"""
-	Redefine the colour sequence.
-
-	pen is the pen number to use for the next plot; this will be auto-
-	incremented.
-
-	colours is the list of pen colours.  Colour may be specified via
-	the single letter values understood by matplotlib:
-
-	    b: blue
-	    g: green
-	    r: red
-	    c: cyan
-	    m: magenta
-	    y: yellow
-	    k: black
-	    w: white
-
-	or via the full name as listed in the colour dictionary which is
-	loaded by default by load_colours() from rgb.txt and listed by
-	list_colours().
-	"""
-
-	if pen is None and colours is None:
-	    self.colours = []
-	    return
-
-	if pen is None:
-	    if not len(self.colours):
-		self.colours = [1]
-	else:
-	    self.colours[0] = pen
-
-	if colours is None:
-	    return
-
-	cols = []
-	for col in colours:
-	    cols.append(get_colour(col))
-
-	self.colours[1:] = cols
-
-	if 0 > self.colours[0] > len(self.colours):
-	    self.colours[0] = 1
-
-
-    def plot(self, x=None, y=None, mask=None, fmt=None, add=None):
-	"""
-	Plot the next line in the current frame using the current line
-	attributes.  The ASAPlot graphics window will be mapped and raised.
-
-	The argument list works a bit like the matlab plot() function.
-	"""
-
-	if x is None:
-	    if y is None: return
-	    x = range(len(y))
-
-	elif y is None:
-	    y = x
-	    x = range(len(y))
-
-	if mask is None:
-	    if fmt is None:
-		line = self.axes.plot(x, y)
-	    else:
-		line = self.axes.plot(x, y, fmt)
-	else:
-	    segments = []
-
-	    mask = list(mask)
-	    i = 0
-	    while mask[i:].count(1):
-		i += mask[i:].index(1)
-		if mask[i:].count(0):
-		    j = i + mask[i:].index(0)
-		else:
-		    j = len(mask)
-
-		segments.append(x[i:j])
-		segments.append(y[i:j])
-
-		i = j
-
-	    line = self.axes.plot(*segments)
-
-	# Add to an existing line?
-	if add is None or len(self.lines) < add < 0:
-	    # Don't add.
-	    self.lines.append(line)
-	    i = len(self.lines) - 1
-	else:
-	    if add == 0: add = len(self.lines)
-	    i = add - 1
-	    self.lines[i].extend(line)
-
-	# Set/reset attributes for the line.
-	gotcolour = False
-	for k, v in self.attributes.iteritems():
-	    if k == 'color': gotcolour = True
-	    for segment in self.lines[i]:
-		getattr(segment, "set_%s"%k)(v)
-
-	if not gotcolour and len(self.colours):
-	    for segment in self.lines[i]:
-		getattr(segment, "set_color")(self.colours[self.colours[0]])
-
-	    self.colours[0] += 1
-	    if self.colours[0] >= len(self.colours):
-		self.colours[0] = 1
-
-	self.show()
-
-
-    def position(self):
-	"""
-	Use the mouse to get a position from a graph.
-	"""
-
-	def position_disable(event):
-	    self.register('button_press', None)
-	    print '%.4f, %.4f' % (event.xdata, event.ydata)
-
-	print 'Press any mouse button...'
-	self.register('button_press', position_disable)
-
-
-    def quit(self):
-	"""
-	Destroy the ASAPlot graphics window.
-	"""
-	self.window.destroy()
-
-
-    def region(self):
-	"""
-	Use the mouse to get a rectangular region from a plot.
-
-	The return value is [x0, y0, x1, y1] in world coordinates.
-	"""
-
-	def region_start(event):
-	    height = self.canvas.figure.bbox.height()
-	    self.rect = {'fig': None, 'height': height,
-			 'x': event.x, 'y': height - event.y,
-			 'world': [event.xdata, event.ydata,
-				   event.xdata, event.ydata]}
-	    self.register('button_press', None)
-	    self.register('motion_notify', region_draw)
-	    self.register('button_release', region_disable)
-
-	def region_draw(event):
-	    self.canvas._tkcanvas.delete(self.rect['fig'])
-	    self.rect['fig'] = self.canvas._tkcanvas.create_rectangle(
-				self.rect['x'], self.rect['y'],
-				event.x, self.rect['height'] - event.y)
-
-	def region_disable(event):
-	    self.register('motion_notify', None)
-	    self.register('button_release', None)
-
-	    self.canvas._tkcanvas.delete(self.rect['fig'])
-
-	    self.rect['world'][2:4] = [event.xdata, event.ydata]
-	    print '(%.2f, %.2f)  (%.2f, %.2f)' % (self.rect['world'][0],
-		self.rect['world'][1], self.rect['world'][2],
-		self.rect['world'][3])
-
-	self.register('button_press', region_start)
-
-	# This has to be modified to block and return the result (currently
-	# printed by region_disable) when that becomes possible in matplotlib.
-
-	return [0.0, 0.0, 0.0, 0.0]
-
-
-    def register(self, type=None, func=None):
-	"""
-	Register, reregister, or deregister events of type 'button_press',
-	'button_release', or 'motion_notify'.
-
-	The specified callback function should have the following signature:
-
-	    def func(event)
-
-	where event is an MplEvent instance containing the following data:
-
-	    name		# Event name.
-	    canvas		# FigureCanvas instance generating the event.
-	    x      = None	# x position - pixels from left of canvas.
-	    y      = None	# y position - pixels from bottom of canvas.
-	    button = None	# Button pressed: None, 1, 2, 3.
-	    key    = None	# Key pressed: None, chr(range(255)), shift,
-				  win, or control
-	    inaxes = None	# Axes instance if cursor within axes.
-	    xdata  = None	# x world coordinate.
-	    ydata  = None	# y world coordinate.
-
-	For example:
-
-	    def mouse_move(event):
-		print event.xdata, event.ydata
-
-	    a = asaplot()
-	    a.register('motion_notify', mouse_move)
-
-	If func is None, the event is deregistered.
-
-	Note that in TkAgg keyboard button presses don't generate an event.
-	"""
-
-	if not self.events.has_key(type): return
-
-	if func is None:
-	    if self.events[type] is not None:
-		# It's not clear that this does anything.
-		self.canvas.mpl_disconnect(self.events[type])
-		self.events[type] = None
-
-		# It seems to be necessary to return events to the toolbar.
-		if type == 'motion_notify':
-		    self.canvas.mpl_connect(type + '_event',
-			self.figmgr.toolbar.mouse_move)
-		elif type == 'button_press':
-		    self.canvas.mpl_connect(type + '_event',
-			self.figmgr.toolbar.press)
-		elif type == 'button_release':
-		    self.canvas.mpl_connect(type + '_event',
-			self.figmgr.toolbar.release)
-
-	else:
-	    self.events[type] = self.canvas.mpl_connect(type + '_event', func)
-
-
-    def release(self):
-	"""
-	Release buffered graphics.
-	"""
-	self.buffering = False
-	self.show()
-
-
-    def save(self, fname=None):
-	"""
-	Save the plot to a file.
-
-	fname is the name of the output file.  The image format is determined
-	from the file suffix; 'png', 'ps', and 'eps' are recognized.  If no
-	file name is specified 'yyyymmdd_hhmmss.png' is created in the current
-	directory.
-	"""
-	if fname is None:
-	    from datetime import datetime
-	    dstr = datetime.now().strftime('%Y%m%d_%H%M%S')
-	    fname = 'asap'+dstr+'.png'
-
-	d = ['png','.ps','eps']
-
-	from os.path import expandvars
-	fname = expandvars(fname)
-
-	if fname[-3:].lower() in d:
-	    try:
-		self.canvas.print_figure(fname)
-		print 'Written file %s' % (fname)
-	    except IOError, msg:
-		print 'Failed to save %s: Error msg was\n\n%s' % (fname, err)
-		return
-	else:
-	    print "Invalid image type. Valid types are:"
-	    print "ps, eps, png"
-
-
-    def set_axes(self, what=None, *args, **kwargs):
-	"""
-	Set attributes for the axes by calling the relevant Axes.set_*()
-	method.  Colour translation is done as described in the doctext
-	for palette().
-	"""
-
-	if what is None: return
-	if what[-6:] == 'colour': what = what[:-6] + 'color'
-
-	newargs = {}
-	for k, v in kwargs.iteritems():
-	    k = k.lower()
-	    if k == 'colour': k = 'color'
-
-	    if k == 'color':
-		v = get_colour(v)
-
-	    newargs[k] = v
-
-	getattr(self.axes, "set_%s"%what)(*args, **newargs)
-	self.show()
-
-
-    def set_figure(self, what=None, *args, **kwargs):
-	"""
-	Set attributes for the figure by calling the relevant Figure.set_*()
-	method.  Colour translation is done as described in the doctext
-	for palette().
-	"""
-
-	if what is None: return
-	if what[-6:] == 'colour': what = what[:-6] + 'color'
-	if what[-5:] == 'color' and len(args):
-	    args = (get_colour(args[0]),)
-
-	newargs = {}
-	for k, v in kwargs.iteritems():
-	    k = k.lower()
-	    if k == 'colour': k = 'color'
-
-	    if k == 'color':
-		v = get_colour(v)
-
-	    newargs[k] = v
-
-	getattr(self.figure, "set_%s"%what)(*args, **newargs)
-	self.show()
-
-
-    def set_limits(self, xlim=None, ylim=None):
-	"""
-	Set x-, and y-limits for each subplot.
-
-	xlim = [xmin, xmax] as in axes.set_xlim().
-	ylim = [ymin, ymax] as in axes.set_ylim().
-	"""
-	for s in self.subplots:
-	    self.axes  = s['axes']
-	    self.lines = s['lines']
-            oldxlim =  list(self.axes.get_xlim())
-            oldylim =  list(self.axes.get_ylim())
-            if xlim is not None:
-                for i in range(len(xlim)):
-                    if xlim[i] is not None:
-                        oldxlim[i] = xlim[i]
-            if ylim is not None:                        
-                for i in range(len(ylim)):
-                    if ylim[i] is not None:
-                        oldylim[i] = ylim[i]
-            self.axes.set_xlim(oldxlim)
-            self.axes.set_ylim(oldylim)
-        return
-
-
-    def set_line(self, number=None, **kwargs):
-	"""
-	Set attributes for the specified line, or else the next line(s)
-	to be plotted.
-
-	number is the 0-relative number of a line that has already been
-	plotted.  If no such line exists, attributes are recorded and used
-	for the next line(s) to be plotted.
-
-	Keyword arguments specify Line2D attributes, e.g. color='r'.  Do
-
-	    import matplotlib
-	    help(matplotlib.lines)
-
-	The set_* methods of class Line2D define the attribute names and
-	values.  For non-US usage, "colour" is recognized as synonymous with
-	"color".
-
-	Set the value to None to delete an attribute.
-
-	Colour translation is done as described in the doctext for palette().
-	"""
-
-	redraw = False
-	for k, v in kwargs.iteritems():
-	    k = k.lower()
-	    if k == 'colour': k = 'color'
-
-	    if k == 'color':
-		v = get_colour(v)
-
-	    if 0 <= number < len(self.lines):
-		if self.lines[number] is not None:
-		    for line in self.lines[number]:
-			getattr(line, "set_%s"%k)(v)
-		    redraw = True
-	    else:
-		if v is None:
-		    del self.attributes[k]
-		else:
-		    self.attributes[k] = v
-
-	if redraw: self.show()
-
-
-    def set_panels(self, rows=1, cols=0, n=-1, nplots=-1, ganged=True):
-	"""
-	Set the panel layout.
-
-	rows and cols, if cols != 0, specify the number of rows and columns in
-	a regular layout.   (Indexing of these panels in matplotlib is row-
-	major, i.e. column varies fastest.)
-
-	cols == 0 is interpreted as a retangular layout that accomodates
-	'rows' panels, e.g. rows == 6, cols == 0 is equivalent to
-	rows == 2, cols == 3.
-
-	0 <= n < rows*cols is interpreted as the 0-relative panel number in
-	the configuration specified by rows and cols to be added to the
-	current figure as its next 0-relative panel number (i).  This allows
-	non-regular panel layouts to be constructed via multiple calls.  Any
-	other value of n clears the plot and produces a rectangular array of
-	empty panels.  The number of these may be limited by nplots.
-	"""
-	if n < 0 and len(self.subplots):
-	    self.figure.clear()
-	    self.set_title()
-
-	if rows < 1: rows = 1
-
-	if cols <= 0:
-	    i = int(sqrt(rows))
-	    if i*i < rows: i += 1
-	    cols = i
-
-	    if i*(i-1) >= rows: i -= 1
-	    rows = i
-
-	if 0 <= n < rows*cols:
-	    i = len(self.subplots)
-	    self.subplots.append({})
-
-	    self.subplots[i]['axes']  = self.figure.add_subplot(rows,
-					    cols, n+1)
-	    self.subplots[i]['lines'] = []
-
-	    if i == 0: self.subplot(0)
-
-	    self.rows = 0
-	    self.cols = 0
-
-	else:
-	    self.subplots = []
-
-	    if nplots < 1 or rows*cols < nplots:
-		nplots = rows*cols
-
-	    for i in range(nplots):
-		self.subplots.append({})
-
-		self.subplots[i]['axes']  = self.figure.add_subplot(rows,
-						cols, i+1)
-		self.subplots[i]['lines'] = []
-                xfsize = self.subplots[i]['axes'].xaxis.label.get_size()-cols/2
-                yfsize = self.subplots[i]['axes'].yaxis.label.get_size()-rows/2
-                self.subplots[i]['axes'].xaxis.label.set_size(xfsize)
-                self.subplots[i]['axes'].yaxis.label.set_size(yfsize)
-                
-                if ganged:
-                    if rows > 1 or cols > 1:
-                        # Squeeze the plots together.
-                        pos = self.subplots[i]['axes'].get_position()
-                        if cols > 1: pos[2] *= 1.2
-                        if rows > 1: pos[3] *= 1.2
-                        self.subplots[i]['axes'].set_position(pos)
-
-                    # Suppress tick labelling for interior subplots.
-                    if i <= (rows-1)*cols - 1:
-                        if i+cols < nplots:
-                            # Suppress x-labels for frames width
-                            # adjacent frames
-                            for tick in \
-                                    self.subplots[i]['axes'].xaxis.majorTicks:
-                                tick.label1On = False
-                                self.subplots[i]['axes'].xaxis.label.set_visible(False)
-                    if i%cols:
-                        # Suppress y-labels for frames not in the left column.
-                        for tick in self.subplots[i]['axes'].yaxis.majorTicks:
-                            tick.label1On = False
-                        self.subplots[i]['axes'].yaxis.label.set_visible(False)
-                        
-
-		self.rows = rows
-		self.cols = cols
-
-	    self.subplot(0)
-
-    def set_title(self, title=None):
-	"""
-	Set the title of the plot window.  Use the previous title if title is
-	omitted.
-	"""
-	if title is not None:
-	    self.title = title
-
-	self.figure.text(0.5, 0.95, self.title, horizontalalignment='center')
-
-
-    def show(self):
-	"""
-	Show graphics dependent on the current buffering state.
-	"""
-	if not self.buffering:
-	    if self.loc is not None:
-		for j in range(len(self.subplots)):
-		    lines  = []
-		    labels = []
-		    i = 0
-		    for line in self.subplots[j]['lines']:
-			i += 1
-			if line is not None:
-			    lines.append(line[0])
-			    lbl = line[0].get_label()
-			    if lbl == '':
-				lbl = str(i)
-			    labels.append(lbl)
-
-		    if len(lines):
-			self.subplots[j]['axes'].legend(tuple(lines),
-							tuple(labels),
-							self.loc)
-		    else:
-			self.subplots[j]['axes'].legend((' '))
-
-	    self.window.wm_deiconify()
-	    self.canvas.show()
-
-    def subplot(self, i=None, inc=None):
-	"""
-	Set the subplot to the 0-relative panel number as defined by one or
-	more invokations of set_panels().
-	"""
-	l = len(self.subplots)
-	if l:
-	    if i is not None:
-		self.i = i
-
-	    if inc is not None:
-		self.i += inc
-
-	    self.i %= l
-	    self.axes  = self.subplots[self.i]['axes']
-	    self.lines = self.subplots[self.i]['lines']
-
-
-    def terminate(self):
-	"""
-	Clear the figure.
-	"""
-	self.window.destroy()
-
-
-    def text(self, *args, **kwargs):
-	"""
-	Add text to the figure.
-	"""
-	self.figure.text(*args, **kwargs)
-	self.show()
-
-
-    def unmap(self):
-	"""
-	Hide the ASAPlot graphics window.
-	"""
-	self.window.wm_withdraw()
-
-
-def get_colour(colour='black'):
-    """
-    Look up a colour by name in the colour dictionary.  Matches are
-    case-insensitive, insensitive to blanks, and 'gray' matches 'grey'.
-    """
-
-    if colour is None: return None
-
-    if match('[rgbcmykw]$', colour): return colour
-    if match('#[\da-fA-F]{6}$', colour): return colour
-
-    if len(colours) == 0: load_colours()
-
-    # Try a quick match.
-    if colours.has_key(colour): return colours[colour]
-
-    colour = colour.replace(' ','').lower()
-    colour = colour.replace('gray','grey')
-    for name in colours.keys():
-	if name.lower() == colour:
-	    return colours[name]
-
-    return '#000000'
-
-
-def list_colours():
-    """
-    List the contents of the colour dictionary sorted by name.
-    """
-
-    if len(colours) == 0: load_colours()
-
-    names = colours.keys()
-    names.sort()
-    for name in names:
-	print colours[name], name
-
-
-def load_colours(filename='/usr/local/lib/rgb.txt'):
-    """
-    Load the colour dictionary from the specified file.
-    """
-    print 'Loading colour dictionary from', filename
-    from os.path import expandvars
-    filename = expandvars(filename)
-    rgb = open(filename, 'r')
-
-    while True:
-	line = rgb.readline()
-	if line == '': break
-	tmp = line.split()
-
-	if len(tmp) == 4:
-	    if tmp[3][:4] == 'gray': continue
-	    if tmp[3].lower().find('gray') != -1: continue
-
-	    name = tmp[3][0].upper() + tmp[3][1:]
-	    r, g, b = int(tmp[0]), int(tmp[1]), int(tmp[2])
-	    colours[name] = '#%2.2x%2.2x%2.2x' % (r, g, b)
Index: tags/asap0019/python/asapmath.py
===================================================================
--- branches/Release-1-fixes/python/asapmath.py	(revision 624)
+++ 	(revision )
@@ -1,90 +1,0 @@
-from scantable import scantable
-from asap import rcParams
-
-def average_time(*args, **kwargs):
-    """
-    Return the (time) average of a scan or list of scans. [in channels only]
-    The cursor of the output scan is set to 0
-    Parameters:
-        one scan or comma separated  scans
-        mask:     an optional mask (only used for 'var' and 'tsys' weighting)
-        scanav:   True averages each scan separately.
-                  False (default) averages all scans together,
-        weight:   Weighting scheme. 'none, 'var' (1/var(spec) 
-                  weighted), 'tsys' (1/Tsys**2 weighted), 'tint'
-                  (integration time weighted) or 'tintsys' (Tsys 
-                  and tint). The default is 'tint'
-    Example:
-        # return a time averaged scan from scana and scanb
-        # without using a mask
-        scanav = average_time(scana,scanb)
-        # return the (time) averaged scan, i.e. the average of
-        # all correlator cycles
-        scanav = average_time(scan, scanav=True)
-
-    """
-    scanAv = False
-    if kwargs.has_key('scanav'):
-       scanAv = kwargs.get('scanav')
-    weight = 'tint'
-    if kwargs.has_key('weight'):
-       weight = kwargs.get('weight')
-    mask = ()
-    if kwargs.has_key('mask'):
-        mask = kwargs.get('mask')
-    varlist = vars()
-    lst = tuple(args)
-    del varlist["kwargs"]
-    varlist["args"] = "%d scantables" % len(lst)
-    # need special formatting her for history...
-    
-    from asap._asap import average as _av
-    for s in lst:
-        if not isinstance(s,scantable):
-            print "Please give a list of scantables"
-            return
-    s = scantable(_av(lst, mask, scanAv, weight))
-    s._add_history("average_time",varlist)
-    return s
-
-def quotient(source, reference, preserve=True):
-    """
-    Return the quotient of a 'source' (signal) scan and a 'reference' scan.
-    The reference can have just one row, even if the signal has many. Otherwise
-    they must have the same number of rows.
-    The cursor of the output scan is set to 0
-    Parameters:
-        source:        the 'on' scan
-        reference:     the 'off' scan
-        preserve:      you can preserve (default) the continuum or 
-                       remove it.  The equations used are 
-                          preserve:  Output = Toff * (on/off) - Toff
-                          remove:    Output = Toff * (on/off) - Ton
-    """
-    varlist = vars()
-    from asap._asap import quotient as _quot
-    s = scantable(_quot(source, reference, preserve))
-    s._add_history("quotient",varlist)
-    return s
-
-def simple_math(left, right, op='add', tsys=True):
-    """
-    Apply simple mathematical binary operations to two 
-    scan tables,  returning the result in a new scan table.
-    The operation is applied to both the correlations and the TSys data
-    The cursor of the output scan is set to 0
-    Parameters:
-        left:          the 'left' scan
-        right:         the 'right' scan
-        op:            the operation: 'add' (default), 'sub', 'mul', 'div'
-        tsys:          if True (default) then apply the operation to Tsys
-                       as well as the data
-    """
-    varlist = vars()
-    if not isinstance(left,scantable) and not isinstance(right,scantable):
-        print "Please provide two scantables as input"
-        return
-    from asap._asap import b_operate as _bop
-    s = scantable(_bop(left, right, op, tsys))
-    s._add_history("simple_math", varlist)
-    return s
Index: tags/asap0019/python/asapreader.py
===================================================================
--- branches/Release-1-fixes/python/asapreader.py	(revision 624)
+++ 	(revision )
@@ -1,105 +1,0 @@
-from asap._asap import sdreader
-
-class reader(sdreader):
-    """
-    This class allows the user to import single dish files
-    (rpfits,sdfits,ms).
-    The reader reads in integrations from the file and reamins at
-    the fileposition afterwards.
-    Available functions are:
-
-    read(integrations)
-    summary    CURRENTLY DISABLED
-
-    Example:
-        r = reader('/tmp/P389.rpf')
-        scans r.read() # reads in the complete file into 'scans'
-        print scans    # summarises the contents
-        del r          # destroys the reader
-
-    IMPORTANT: Due to limitations in the rpfits library, only one reader
-               can be created at a time.
-               r = reader('XYZ.rpf')
-               r2 = reader('ABC.rpf')
-               is NOT possible. This is a limitation affecting
-               rpfits ONLY.
-    """
-
-    def __init__(self, filename, unit=None, theif=None, thebeam=None):
-        self.unit = unit
-        """
-        Parameters:
-            filename:    the name of an rpfits/sdfits/ms file on disk
-            unit:        brightness unit; must be consistent with K or Jy.
-                         The default is that a unit is set depending on
-                         the telescope.  Setting this over-rides that choice.
-            theif:       select a specific IF (default is all)
-            thebeam:     select a specific beam (default is all)
-        Example:
-            r = reader('/tmp/2001-09-01_0332_P363.rpf', theif=2)
-        """
-        if theif is None:
-            theif = -1
-        if thebeam is None:
-            thebeam = -1
-        from os.path import expandvars
-        filename = expandvars(filename)
-        sdreader.__init__(self, filename, theif, thebeam)
-
-    def read(self,integrations=None):
-        """
-        Reads in an returns a specified sequence of integrations.
-        If no list is given all integrations a read in.
-        Parameters:
-            integrations:    a 'range' of integration numbers, e.g.
-                             range(100) or [0,1,2,3,4,10,11,100]
-                             If not given (default) all integrations
-                             are read in
-        Example:
-            r.read([0,1,2,3,4])    # reads in the first 5 integatrions
-                                   # NOT scans
-            r.read(range(100))     # read in the first 100 integrations
-        """
-        from asap import scantable
-        if integrations is None:
-            integrations = [-1]
-        print "Reading integrations from disk..."
-        sdreader._read(self,integrations)
-        tbl = sdreader._getdata(self)
-        sdreader._reset(self) # reset to the beginning of the file
-        if self.unit is not None:
-            tbl.set_fluxunit(self.unit)
-        return scantable(tbl)
-
-    def summary(self, name=None):
-        """
-        Print a summary of all scans/integrations. This reads through the
-        whole file once.
-        Parameters:
-             None
-        Example:
-             r.summary()
-        """
-        sdreader._reset(self)
-        sdreader._read(self,[-1])
-        from asap import scantable
-        tbl = scantable(sdreader._getdata(self))
-        sdreader._reset(self)
-        tbl.summary(name)
-        return
-##     def reset(self):
-##         """
-##         [Advanced use]
-##         Reset to the beginning of the file.
-##         Parameters:
-##              none
-##         Examples:
-##              r = reader('xyz.sdfits')
-##              scans0 = r.read(range(10))
-##              r.reset()
-##              scans1 = r.read(range(5,15))
-##              # produces 2 scatables  one containing integrations(rows) 0-9
-##              # and a second one with rows 5-14
-##         """
-##        sdreader._reset(self)
-        
