Index: tags/release_update1/bugs/asap0000.txt
===================================================================
--- tags/release_update1/bugs/asap0000.txt	(revision 632)
+++ tags/release_update1/bugs/asap0000.txt	(revision 632)
@@ -0,0 +1,145 @@
+asap0000
+========
+Hi
+
+Jim Lovell has discovered a strange corruption bug in asap.
+
+When we run:
+
+ scans = scantable('2005-03-09_172811_t002.rpf')
+ scans.summary(verbose=True)
+
+repeatably the source position become corrupted (generally it seems to be
+after the third "scantable" construction.
+
+The above data is in /DATA/VULCAN_1/cphillip/vulcan/data/asap, but I think
+any data will do.
+
+Cheers
+Chris
+
+
+---------------------------------------------------------
+**OK
+
+ASAP> scans.summary(verbose=True)
+
+--------------------------------------------------------------------------------
+ Scan Table Summary
+--------------------------------------------------------------------------------
+Beams:         1
+IFs:           2
+Polarisations: 1
+Channels:      4096
+
+Observer:      Auto_Spec
+Obs Date:      2005/03/09/17:29:22
+Project:       NGC6334Fw
+Obs. Type:
+Antenna Name:  DSS-43
+Flux Unit:     K
+Rest Freqs:    [2.39639e+10] [Hz]
+Abcissa:       Channel
+Cursor:        Beam[0] IF[0] Pol[0]
+
+Scan Source         Position (J2000)        Time      Integration
+FreqIDs
+--------------------------------------------------------------------------------
+  0  NGC6334Fw      17:18:23.4 -35.47.01.3  17:30:37    1 x    02:31.0
+[0, 1] [0]
+  1  NGC6334F       17:20:53.4 -35.47.01.3  17:33:43    1 x    02:33.9
+[0, 1] [0]
+  2  NGC6334F       17:20:53.4 -35.47.01.3  17:36:34    1 x    02:33.9
+[2, 3] [0]
+  3  NGC6334Fe      17:23:23.4 -35.47.01.3  17:39:40    1 x    02:33.9
+[2, 3] [0]
+  4  NGC6334Fw      17:18:23.4 -35.47.01.3  17:42:11    1 x    01:22.9
+[4, 5] [0]
+
+Table contains 5 integration(s) in 5 scan(s).
+
+
+FreqID  Frame   RefFreq(Hz)     RefPix   Increment(Hz)
+--------------------------------------------------------------------------------
+0       TOPO    2.396822e+10    2048      3906.25
+1       TOPO    2.4143763e+10   2048      3906.25
+2       TOPO    2.3968219e+10   2048      3906.25
+3       TOPO    2.4143763e+10   2048      3906.25
+4       TOPO    2.3968219e+10   2048      3906.25
+5       TOPO    2.4143762e+10   2048      3906.25
+--------------------------------------------------------------------------------
+
+
+**BAD
+
+ASAP> scans = scantable('2005-03-09_172811_t002.rpf')
+Importing data...
+Auto averaging integrations...
+Weighting type selected : None
+
+ASAP> scans.summary(verbose=True)
+
+--------------------------------------------------------------------------------
+ Scan Table Summary
+--------------------------------------------------------------------------------
+Beams:         1
+IFs:           2
+Polarisations: 1
+Channels:      4096
+
+Observer:      Auto_Spec
+Obs Date:      2005/03/09/17:29:22
+Project:       NGC6334Fw
+Obs. Type:
+Antenna Name:  DSS-43
+Flux Unit:     K
+Rest Freqs:    [2.39639e+10] [Hz]
+Abcissa:       Channel
+Cursor:        Beam[0] IF[0] Pol[0]
+
+Scan Source         Position (J2000)        Time      Integration
+FreqIDs
+--------------------------------------------------------------------------------
+  0  NGC6334Fw      17:47:49.9 +16.00.27.6  17:30:37    1 x    02:31.0
+[0, 1] [0]
+  1  NGC6334F       17:03:08.2 -44.33.03.4  17:33:43    1 x    02:33.9
+[0, 1] [0]
+  2  NGC6334F       03:46:52.4 +56.43.05.6  17:36:34    1 x    02:33.9
+[2, 3] [0]
+  3  NGC6334Fe      17:47:49.9 +16.00.27.6  17:39:40    1 x    02:33.9
+[2, 3] [0]
+  4  NGC6334Fw      17:03:08.2 -44.33.03.4  17:42:11    1 x    01:22.9
+[4, 5] [0]
+
+Table contains 5 integration(s) in 5 scan(s).
+
+
+FreqID  Frame   RefFreq(Hz)     RefPix   Increment(Hz)
+--------------------------------------------------------------------------------
+0       TOPO    2.396822e+10    2048      3906.25
+1       TOPO    2.4143763e+10   2048      3906.25
+2       TOPO    2.3968219e+10   2048      3906.25
+3       TOPO    2.4143763e+10   2048      3906.25
+4       TOPO    2.3968219e+10   2048      3906.25
+5       TOPO    2.4143762e+10   2048      3906.25
+--------------------------------------------------------------------------------
+
+
+Seems to be a good old rpfits (fortran) memory problem.
+
+repeatedly opening an rpfits file with the read buggers up the refbeam field.
+as the summary function looks at the refbeam to determine the positions it 
+fails as the reader returns a "random" value.
+
+I have a chat to Mark.
+
+Malte.
+
+Mark,
+
+The attached data has only one beam.
+This only occurs on this data set.
+If I convert it to sdfits the problem is solved as you don't write this column 
+out unless it is MX data.
+For now I have put a kludge in, which checks nBeam >1 and only then gets the 
+refbeam from the data.
Index: tags/release_update1/bugs/asap0001.txt
===================================================================
--- tags/release_update1/bugs/asap0001.txt	(revision 632)
+++ tags/release_update1/bugs/asap0001.txt	(revision 632)
@@ -0,0 +1,12 @@
+asap0001
+========
+Bug: restfrequency in header unreadable
+
+From: 
+Malte Marquarding <Malte.Marquarding@atnf.csiro.au>
+
+Date: 
+Today 09:55:07
+
+Change scantable.summary()
+to show restfreq with more (full) precision.
Index: tags/release_update1/bugs/asap0002.txt
===================================================================
--- tags/release_update1/bugs/asap0002.txt	(revision 632)
+++ tags/release_update1/bugs/asap0002.txt	(revision 632)
@@ -0,0 +1,12 @@
+asap0002
+========
+Bug: list_scans list ipython variables
+
+From: 
+Malte Marquarding <Malte.Marquarding@atnf.csiro.au>
+
+
+Date: 
+Today 09:55:42
+
+Filter out all _* vars.
Index: tags/release_update1/bugs/asap0003.txt
===================================================================
--- tags/release_update1/bugs/asap0003.txt	(revision 632)
+++ tags/release_update1/bugs/asap0003.txt	(revision 632)
@@ -0,0 +1,16 @@
+asap0003
+========
+Bug: quotient help not consistent
+
+From: 
+Malte Marquarding <Malte.Marquarding@atnf.csiro.au>
+
+
+To: 
+asap@atnf.csiro.au
+
+
+Date: 
+Today 09:56:36
+
+on/off and sig/ref used intermixed
Index: tags/release_update1/bugs/asap0004.txt
===================================================================
--- tags/release_update1/bugs/asap0004.txt	(revision 632)
+++ tags/release_update1/bugs/asap0004.txt	(revision 632)
@@ -0,0 +1,15 @@
+asap0004
+========
+Bug: scantable.set_freqframe help doesn't list available frames
+
+From: 
+Malte Marquarding <Malte.Marquarding@atnf.csiro.au>
+
+
+To: 
+asap@atnf.csiro.au
+
+
+Date: 
+Today 09:57:32
+
Index: tags/release_update1/bugs/asap0005.txt
===================================================================
--- tags/release_update1/bugs/asap0005.txt	(revision 632)
+++ tags/release_update1/bugs/asap0005.txt	(revision 632)
@@ -0,0 +1,17 @@
+asap0005
+========
+Bug: scantable.poly_baseline doesn't work
+
+From: 
+Malte Marquarding <Malte.Marquarding@csiro.au>  (ATNF)
+
+
+To: 
+asap@atnf.csiro.au
+
+
+Date: 
+Yesterday 15:16:10
+
+A simple paste error in the source code.
+There is some non-sensicla text pasted in right after the closing """
Index: tags/release_update1/bugs/asap0006.txt
===================================================================
--- tags/release_update1/bugs/asap0006.txt	(revision 632)
+++ tags/release_update1/bugs/asap0006.txt	(revision 632)
@@ -0,0 +1,13 @@
+asap0006
+========
+
+enhancement/bugs from session with Malte on Mopra data
+
+From: 
+Juergen Ott <Juergen.Ott@atnf.csiro.au>
+
+
+To: 
+<asap@atnf.csiro.au>
+
+average_time loses unit km/s
Index: tags/release_update1/bugs/asap0007.txt
===================================================================
--- tags/release_update1/bugs/asap0007.txt	(revision 632)
+++ tags/release_update1/bugs/asap0007.txt	(revision 632)
@@ -0,0 +1,14 @@
+asap0007
+========
+
+enhancement/bugs from session with Malte on Mopra data
+
+From: 
+Juergen Ott <Juergen.Ott@atnf.csiro.au>
+
+
+To: 
+<asap@atnf.csiro.au>
+
+help in average_pol has scantable argument
+
Index: tags/release_update1/bugs/asap0008.txt
===================================================================
--- tags/release_update1/bugs/asap0008.txt	(revision 632)
+++ tags/release_update1/bugs/asap0008.txt	(revision 632)
@@ -0,0 +1,14 @@
+asap0008
+========
+
+enhancement/bugs from session with Malte on Mopra data
+
+From: 
+Juergen Ott <Juergen.Ott@atnf.csiro.au>
+
+
+To: 
+<asap@atnf.csiro.au>
+
+set_range in plotter doesn't default to ymin ymax if only x(min,max)
+are given
Index: tags/release_update1/bugs/asap0009.txt
===================================================================
--- tags/release_update1/bugs/asap0009.txt	(revision 632)
+++ tags/release_update1/bugs/asap0009.txt	(revision 632)
@@ -0,0 +1,14 @@
+asap0009
+========
+
+enhancement/bugs from session with Malte on Mopra data
+
+From: 
+Juergen Ott <Juergen.Ott@atnf.csiro.au>
+
+
+To: 
+<asap@atnf.csiro.au>
+
+plotter.save: ps files seemed to be saved as eps (no document format
+displayed etc.)
Index: tags/release_update1/bugs/asap0010.txt
===================================================================
--- tags/release_update1/bugs/asap0010.txt	(revision 632)
+++ tags/release_update1/bugs/asap0010.txt	(revision 632)
@@ -0,0 +1,14 @@
+asap0010
+========
+
+enhancement/bugs from session with Malte on Mopra data
+
+From: 
+Juergen Ott <Juergen.Ott@atnf.csiro.au>
+
+
+To: 
+<asap@atnf.csiro.au>
+
+
+scaling of data like: q*=2.0 doesn't work
Index: tags/release_update1/bugs/asap0011.txt
===================================================================
--- tags/release_update1/bugs/asap0011.txt	(revision 632)
+++ tags/release_update1/bugs/asap0011.txt	(revision 632)
@@ -0,0 +1,14 @@
+asap0011
+========
+
+enhancement/bugs from session with Malte on Mopra data
+
+From: 
+Juergen Ott <Juergen.Ott@atnf.csiro.au>
+
+
+To: 
+<asap@atnf.csiro.au>
+
+
+plotter: if multipanel y-axis is not labelled
Index: tags/release_update1/bugs/asap0012.txt
===================================================================
--- tags/release_update1/bugs/asap0012.txt	(revision 632)
+++ tags/release_update1/bugs/asap0012.txt	(revision 632)
@@ -0,0 +1,14 @@
+asap0012
+========
+
+enhancement/bugs from session with Malte on Mopra data
+
+From: 
+Juergen Ott <Juergen.Ott@atnf.csiro.au>
+
+
+To: 
+<asap@atnf.csiro.au>
+
+
+plotter: if multipanel text overlaps plots
Index: tags/release_update1/bugs/asap0013.txt
===================================================================
--- tags/release_update1/bugs/asap0013.txt	(revision 632)
+++ tags/release_update1/bugs/asap0013.txt	(revision 632)
@@ -0,0 +1,14 @@
+asap0013
+========
+
+enhancement/bugs from session with Malte on Mopra data
+
+From: 
+Juergen Ott <Juergen.Ott@atnf.csiro.au>
+
+
+To: 
+<asap@atnf.csiro.au>
+
+
+plotter: set_title doesn't work properly
Index: tags/release_update1/bugs/asap0014.txt
===================================================================
--- tags/release_update1/bugs/asap0014.txt	(revision 632)
+++ tags/release_update1/bugs/asap0014.txt	(revision 632)
@@ -0,0 +1,18 @@
+asap0014
+========
+Bug: Plotter takes a long time to replot on set_mode
+
+From: 
+Malte Marquarding <Malte.Marquarding@csiro.au>  (ATNF)
+
+
+To: 
+asap@atnf.csiro.au
+
+
+Date: 
+Today 13:27:23
+
+the last panel seems to be refreshing rather than being on "hold" and 
+"release"
+
Index: tags/release_update1/bugs/asap0015.txt
===================================================================
--- tags/release_update1/bugs/asap0015.txt	(revision 632)
+++ tags/release_update1/bugs/asap0015.txt	(revision 632)
@@ -0,0 +1,7 @@
+asap0015
+========
+Bug: plotter doesn't plot more than 9 panels even when cursor is set
+
+From: 
+Malte Marquarding <Malte.Marquarding@csiro.au>  (ATNF)
+
Index: tags/release_update1/bugs/asap0016.txt
===================================================================
--- tags/release_update1/bugs/asap0016.txt	(revision 632)
+++ tags/release_update1/bugs/asap0016.txt	(revision 632)
@@ -0,0 +1,7 @@
+asap0016 - CLOSED
+========
+Bug: plotter.set_legend doesn't work when "time" is selected
+
+From: 
+Malte Marquarding <Malte.Marquarding@csiro.au>  (ATNF)
+
Index: tags/release_update1/bugs/asap0017.txt
===================================================================
--- tags/release_update1/bugs/asap0017.txt	(revision 632)
+++ tags/release_update1/bugs/asap0017.txt	(revision 632)
@@ -0,0 +1,8 @@
+asap0017
+========
+
+Bug: Fitter crashes during fit when set_function(gauss=n) was called with different n's
+
+From: 
+Malte Marquarding <Malte.Marquarding@csiro.au>  (ATNF)
+
Index: tags/release_update1/bugs/asap0018.txt
===================================================================
--- tags/release_update1/bugs/asap0018.txt	(revision 632)
+++ tags/release_update1/bugs/asap0018.txt	(revision 632)
@@ -0,0 +1,14 @@
+asap0018
+========
+
+Bug: Missing template when buit against latest aips++
+
+From: 
+Malte Marquarding <Malte.Marquarding@csiro.au>  (ATNF)
+
+
+The template for 
+void Array<std::complex<float> >::reference(const Array<std::complex<float> >&)
+is missing from SDTemplates.cc
+
+Also, the footprint for median has changed.
Index: tags/release_update1/bugs/asap0019.txt
===================================================================
--- tags/release_update1/bugs/asap0019.txt	(revision 632)
+++ tags/release_update1/bugs/asap0019.txt	(revision 632)
@@ -0,0 +1,8 @@
+asap0019
+========
+
+Bug: ordinate label in plotter is not adjuting title to unit e.g
+Brightness Temp <-> K
+ 
+
+
Index: tags/release_update1/bugs/asap0020.txt
===================================================================
--- tags/release_update1/bugs/asap0020.txt	(revision 632)
+++ tags/release_update1/bugs/asap0020.txt	(revision 632)
@@ -0,0 +1,12 @@
+asap0020
+========
+Date: Sun, 8 May 2005 09:42:07 +1000 (EST)
+From: Malte Marquarding <Malte.Marquarding@atnf.csiro.au>
+To: asap@atnf.csiro.au
+Subject: Bug: SFITS written with asap is not read back in correctly by
+asap
+
+The scantable is corrupted and shows an extra row.
+ 
+
+
Index: tags/release_update1/python/__init__.py
===================================================================
--- trunk/python/__init__.py	(revision 560)
+++ tags/release_update1/python/__init__.py	(revision 632)
@@ -233,5 +233,5 @@
 
 __date__ = '$Date$'
-__version__  = '1.0'
+__version__  = '1.0.1'
 
 def list_scans(t = scantable):
@@ -244,6 +244,6 @@
     globs = sys.modules['__main__'].__dict__.iteritems()
     print "The user created scantables are:"
-    x = map(lambda x: x[0], filter(lambda x: isinstance(x[1], t), globs))
-    print x
+    sts = map(lambda x: x[0], filter(lambda x: isinstance(x[1], t), globs))
+    print filter(lambda x: not x.startswith('_'), sts)
 
 def commands():
Index: tags/release_update1/python/asapfitter.py
===================================================================
--- trunk/python/asapfitter.py	(revision 560)
+++ tags/release_update1/python/asapfitter.py	(revision 632)
@@ -132,5 +132,8 @@
             if len(ps) == 0:
                 self.fitter.estimate()
-        self.fitter.fit()
+        try:
+            self.fitter.fit()
+        except RuntimeError, msg:
+            print msg            
         self._fittedrow = row
         self.fitted = True
@@ -336,7 +339,7 @@
             xlab = self.data._getabcissalabel(self._fittedrow)
             m = self.data._getmask(self._fittedrow)
-            ylab = r'Flux'
-
-        colours = ["grey60","grey80","red","orange","purple","yellow","magenta", "cyan"]
+            ylab = self.data._get_ordinate_label()
+
+        colours = ["grey60","grey80","red","orange","purple","green","magenta", "cyan"]
         self._p.palette(1,colours)
         self._p.set_line(label='Spectrum')
Index: tags/release_update1/python/asaplot.py
===================================================================
--- trunk/python/asaplot.py	(revision 560)
+++ tags/release_update1/python/asaplot.py	(revision 632)
@@ -65,5 +65,5 @@
 	self.colours = [1, 'b', 'g', 'r', 'c', 'm', 'y', 'k']
 	self.attributes = {}
-	self.loc = 1
+	self.loc = 0
 
 	matplotlib.interactive = True
@@ -80,5 +80,4 @@
 	for i in range(1,len(self.lines)+1):
 	   self.delete(i)
-
 	self.axes.clear()
 	self.colours[0] = 1
@@ -103,7 +102,5 @@
 			line.set_linestyle('None')
 			self.lines[number] = None
-
-	self.show()
-
+        self.show()        
 
     def get_line(self):
@@ -150,5 +147,5 @@
 
 
-    def legend(self, loc=1):
+    def legend(self, loc=None):
 	"""
 	Add a legend to the plot.
@@ -167,6 +164,7 @@
 
 	"""
-	if 1 > loc > 10: loc = 0
-	self.loc = loc
+        if isinstance(loc,int):
+            if 0 > loc > 10: loc = 0
+            self.loc = loc
 	self.show()
 
@@ -512,13 +510,20 @@
 	ylim = [ymin, ymax] as in axes.set_ylim().
 	"""
-
 	for s in self.subplots:
 	    self.axes  = s['axes']
 	    self.lines = s['lines']
-	    if xlim is not None:
-		self.axes.set_xlim(xlim)
-	    if ylim is not None:
-		self.axes.set_ylim(ylim)
-	return
+            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
 
 
@@ -568,5 +573,5 @@
 
 
-    def set_panels(self, rows=1, cols=0, n=-1, nplots=-1):
+    def set_panels(self, rows=1, cols=0, n=-1, nplots=-1, ganged=True):
 	"""
 	Set the panel layout.
@@ -626,22 +631,32 @@
 						cols, i+1)
 		self.subplots[i]['lines'] = []
-
-		if rows > 1 or cols > 1:
-		    # Squeeze the plots together.
-		    pos = self.subplots[i]['axes'].get_position()
-		    if cols > 1: pos[2] *= 1.1
-		    if rows > 1: pos[3] *= 1.1
-		    self.subplots[i]['axes'].set_position(pos)
-
-		# Suppress tick labelling for interior subplots.
-		if i <= (rows-1)*cols - 1:
-		    # Suppress x-labels for frames not in the bottom row.
-		    for tick in self.subplots[i]['axes'].xaxis.majorTicks:
-			tick.label1On = 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
+                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
@@ -650,5 +665,4 @@
 	    self.subplot(0)
 
-
     def set_title(self, title=None):
 	"""
@@ -667,5 +681,5 @@
 	"""
 	if not self.buffering:
-	    if self.loc:
+	    if self.loc is not None:
 		for j in range(len(self.subplots)):
 		    lines  = []
@@ -691,5 +705,4 @@
 	    self.canvas.show()
 
-
     def subplot(self, i=None, inc=None):
 	"""
Index: tags/release_update1/python/asapmath.py
===================================================================
--- trunk/python/asapmath.py	(revision 560)
+++ tags/release_update1/python/asapmath.py	(revision 632)
@@ -59,6 +59,6 @@
         preserve:      you can preserve (default) the continuum or 
                        remove it.  The equations used are 
-                          preserve - Output = Tref * (sig/ref) - Tref
-                          remove   - Output = Tref * (sig/ref) - Tsig
+                          preserve:  Output = Toff * (on/off) - Toff
+                          remove:    Output = Toff * (on/off) - Ton
     """
     varlist = vars()
Index: tags/release_update1/python/asapplotter.py
===================================================================
--- trunk/python/asapplotter.py	(revision 560)
+++ tags/release_update1/python/asapplotter.py	(revision 632)
@@ -41,5 +41,5 @@
         self._minmaxy = None
         self._data = None
-        self._lmap = []
+        self._lmap = None
         self._title = None
         self._ordinate = None
@@ -68,6 +68,6 @@
         if self._plotter.is_dead:
             self._plotter = ASAPlot()
+        self._plotter.hold()
         self._plotter.clear()
-        self._plotter.hold()
         if len(args) > 0:
             if self._data is not None:                
@@ -80,9 +80,12 @@
                 self.set_cursor(refresh=False)
         if self._panelling == 't':
-            maxrows = 9
+            maxrows = 25
             if self._data[0].nrow() > maxrows:
-                print "Scan to be plotted contains more than %d rows.\n" \
-                      "Selecting first %d rows..." % (maxrows,maxrows)
-                self._cursor["t"] = range(maxrows)
+                if self._cursor["t"] is None or \
+                       (isinstance(self._cursor["t"],list) and \
+                        len(self._cursor["t"]) > maxrows ):
+                    print "Scan to be plotted contains more than %d rows.\n" \
+                          "Selecting first %d rows..." % (maxrows,maxrows)
+                    self._cursor["t"] = range(maxrows)
             self._plot_time(self._data[0], self._stacking)
         elif self._panelling == 's':
@@ -108,5 +111,4 @@
         if self._stacking is not None:
             ncol = eval(self._cdict.get(colmode))
-        self._plotter.set_panels()
         if n > 1:
             if self._rows and self._cols:
@@ -116,4 +118,6 @@
             else:
                 self._plotter.set_panels(rows=n,cols=0,nplots=n)
+        else:
+            self._plotter.set_panels()
         rows = self._cursor["t"]
         self._plotter.palette(1)
@@ -144,8 +148,8 @@
                 y = None
                 m = None
-                if not self._title:
+                if self._title is None:
                     tlab = scan._getsourcename(rowsel)                    
                 else:
-                    if len(self._title) == n:
+                    if len(self._title) >= n:
                         tlab = self._title[rowsel]
                     else:
@@ -165,5 +169,5 @@
                     ylab = self._ordinate
                 else:
-                    ylab = 'Flux ('+scan.get_fluxunit()+')'
+                    ylab = scan._get_ordinate_label()
                 m = scan._getmask(rowsel)
                 if self._lmap and len(self._lmap) > 0:
@@ -171,12 +175,5 @@
                 else:
                     if colmode == 'p':
-                        if polmode == "stokes":
-                            llab = scan._getpolarizationlabel(0,1,0)
-                        elif polmode == "stokes2":
-                            llab = scan._getpolarizationlabel(0,1,1)
-                        elif polmode == "circular":
-                            llab = scan._getpolarizationlabel(0,0,0)
-                        else:
-                            llab = scan._getpolarizationlabel(1,0,0)
+                        llab = self._get_pollabel(scan, polmode)
                     else:                    
                         llab = self._ldict.get(colmode)+' '+str(j)
@@ -206,12 +203,13 @@
             scan = scans[0]
             ncol = eval(self._cdict.get(colmode))
-        self._plotter.set_panels()
         if n > 1:
             if self._rows and self._cols:
                 n = min(n,self._rows*self._cols)
-                self._plotter.set_panel(rows=self._rows,cols=self._cols,
+                self._plotter.set_panels(rows=self._rows,cols=self._cols,
                                          nplots=n)
             else:
-                self._plotter.set_panel(rows=n,cols=0,nplots=n)
+                self._plotter.set_panels(rows=n,cols=0,nplots=n)
+        else:
+            self._plotter.set_panels()
         for scan in scans:
             self._plotter.palette(1)
@@ -257,5 +255,5 @@
                     ylab = self._ordinate
                 else:
-                    ylab = 'Flux ('+scan.get_fluxunit()+')'
+                    ylab = scan._get_ordinate_label()
                 m = scan._getmask(rowsel)
                 if self._lmap and len(self._lmap) > 0:
@@ -263,12 +261,5 @@
                 else:
                     if colmode == 'p':
-                        if polmode == "stokes":
-                            llab = scan._getpolarizationlabel(0,1,0)
-                        elif polmode == "stokes2":
-                            llab = scan._getpolarizationlabel(0,1,1)
-                        elif polmode == "circular":
-                            llab = scan._getpolarizationlabel(0,0,0)
-                        else:
-                            llab = scan._getpolarizationlabel(1,0,0)
+                        llab = self._get_pollabel(scan, polmode)
                     else:
                         llab = self._ldict.get(colmode)+' '+str(j)
@@ -299,5 +290,4 @@
         if self._stacking is not None:            
             ncol = eval(self._cdict.get(colmode))
-        self._plotter.set_panels()
         if n > 1:
             if self._rows and self._cols:
@@ -307,4 +297,6 @@
             else:
                 self._plotter.set_panels(rows=n,cols=0,nplots=n)
+        else:
+            self._plotter.set_panels()            
         panels = self._cursor[self._panelling]        
         for i in panels:
@@ -362,5 +354,5 @@
                     ylab = self._ordinate
                 else:
-                    ylab = 'Flux ('+scan.get_fluxunit()+')'
+                    ylab = scan._get_ordinate_label()
                 m = scan._getmask(rowsel)
                 if colmode == 's' or colmode == 't':
@@ -369,33 +361,23 @@
                     else:                        
                         tlab = self._ldict.get(self._panelling)+' '+str(i)
-                    llab = scan._getsourcename(rowsel)
+                    if self._lmap and len(self._lmap) > 0:
+                        llab = self._lmap[jj]
+                    else:
+                        llab = scan._getsourcename(rowsel)
                 else:
                     if self._title and len(self._title) > 0:
                         tlab = self._title[ii]
                     else:
-                        tlab = self._ldict.get(self._panelling)+' '+str(i)
+                        if self._panelling == 'p':
+                            tlab = self._get_pollabel(scan, polmode)
+                        else:
+                            tlab = self._ldict.get(self._panelling)+' '+str(i)
                     if self._lmap and len(self._lmap) > 0:
                         llab = self._lmap[jj]
                     else:
                         if colmode == 'p':
-                            if polmode == "stokes":
-                                llab = scan._getpolarizationlabel(0,1,0)
-                            elif polmode == "stokes2":
-                                llab = scan._getpolarizationlabel(0,1,1)
-                            elif polmode == "circular":
-                                llab = scan._getpolarizationlabel(0,0,0)
-                            else:
-                                llab = scan._getpolarizationlabel(1,0,0)
+                            llab = self._get_pollabel(scan, polmode)
                         else:
                             llab = self._ldict.get(colmode)+' '+str(j)
-                if self._panelling == 'p':
-                    if polmode == "stokes":
-                        tlab = scan._getpolarizationlabel(0,1,0)
-                    elif polmode == "stokes2":
-                        tlab = scan._getpolarizationlabel(0,1,1)
-                    elif polmode == "circular":
-                        tlab = scan._getpolarizationlabel(0,0,0)
-                    else:
-                        tlab = scan._getpolarizationlabel(1,0,0)
                 self._plotter.set_line(label=llab)
                 self._plotter.plot(x,y,m)
@@ -485,12 +467,10 @@
         if xstart is None and xend is None:
             self._minmaxx = None
-            if self._data: self.plot()
-            return
+        else:
+            self._minmaxx = [xstart,xend]
         if ystart is None and yend is None:
             self._minmaxy = None
-            if self._data: self.plot()
-            return
-        self._minmaxx = [xstart,xend]
-        self._minmaxy = [ystart,yend]
+        else:
+            self._minmaxy = [ystart,yend]            
         if self._data: self.plot()
         return
@@ -645,4 +625,15 @@
         if self._data and refresh: self.plot()
 
+    def _get_pollabel(self, scan, polmode):
+        tlab = ""
+        if polmode == "stokes":
+            tlab = scan._getpolarizationlabel(0,1,0)
+        elif polmode == "stokes2":
+            tlab = scan._getpolarizationlabel(0,1,1)
+        elif polmode == "circular":
+            tlab = scan._getpolarizationlabel(0,0,0)
+        else:
+            tlab = scan._getpolarizationlabel(1,0,0)
+        return tlab
             
 if __name__ == '__main__':
Index: tags/release_update1/python/scantable.py
===================================================================
--- trunk/python/scantable.py	(revision 560)
+++ tags/release_update1/python/scantable.py	(revision 632)
@@ -432,5 +432,7 @@
         Set the frame type of the Spectral Axis.
         Parameters:
-            frame:   an optional frame type, default 'LSRK'.
+            frame:   an optional frame type, default 'LSRK'. Valid frames are:
+                     'REST','TOPO','LSRD','LSRK','BARY',
+                     'GEO','GALACTO','LGROUP','CMB'
         Examples:
             scan.set_freqframe('BARY')
@@ -440,4 +442,5 @@
         valid = ['REST','TOPO','LSRD','LSRK','BARY', \
                    'GEO','GALACTO','LGROUP','CMB']
+
         if frame in valid:
             inf = list(self._getcoordinfo())
@@ -984,5 +987,4 @@
         The polarisation cursor of the output scan is set to 0
         Parameters:
-            scan:        The scantable
             mask:        An optional mask defining the region, where the
                          averaging will be applied. The output will have all
@@ -993,6 +995,4 @@
                          Otherwise, the scaling is done in-situ
                          The default is taken from .asaprc (False)
-        Example:
-            polav = average_pols(myscan)
         """
         if insitu is None: insitu = rcParams['insitu']
@@ -1061,10 +1061,10 @@
             # not using a mask
             bscan = scan.poly_baseline(order=3)
-        """('', 'TOPO', 'RADIO', 'TOPO')
+        """
         if insitu is None: insitu = rcParams['insitu']
         varlist = vars()
         if mask is None:
             from numarray import ones
-            mask = list(ones(scan.nchan()))
+            mask = list(ones(self.nchan()))
         from asap.asapfitter import fitter
         f = fitter()
@@ -1258,16 +1258,17 @@
     def quotient(self, other, isreference=True, preserve=True):
         """
-        Return the quotient of a 'source' (signal) scan and a 'reference' scan.
+        Return the quotient of a 'source' (on) scan and a 'reference' (off)
+        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 'other' scan
+            other:          the 'other' scan
             isreference:    if the 'other' scan is the reference (default)
                             or source
             preserve:       you can preserve (default) the continuum or 
                             remove it.  The equations used are 
-                            preserve - Output = Tref * (sig/ref) - Tref
-                            remove   - Output = Tref * (sig/ref) - Tsig
+                            preserve: Output = Toff * (on/off) - Toff
+                            remove:   Output = Tref * (on/off) - Ton
         Example:
             # src is a scantable for an 'on' scan, ref for an 'off' scantable
@@ -1427,2 +1428,12 @@
             i = j        
         return segments
+    def _get_ordinate_label(self):
+        fu = "("+self.get_fluxunit()+")"
+        import re
+        lbl = "Intensity"
+        if re.match(".K.",fu):
+            lbl = "Brightness Temperature "+ fu
+        elif re.match(".Jy.",fu):
+            lbl = "Flux density "+ fu
+        return lbl
+        
Index: tags/release_update1/src/SDFitter.cc
===================================================================
--- trunk/src/SDFitter.cc	(revision 560)
+++ tags/release_update1/src/SDFitter.cc	(revision 632)
@@ -61,4 +61,5 @@
     delete funcs_[i]; funcs_[i] = 0;
   }
+  funcs_.resize(0,True);
   parameters_.resize();
   error_.resize();
@@ -278,13 +279,15 @@
   NonLinearFitLM<Float> fitter;
   CompoundFunction<Float> func;
-  const uInt n = funcs_.nelements();
+
+  uInt n = funcs_.nelements();
   for (uInt i=0; i<n; ++i) {
     func.addFunction(*funcs_[i]);
   }
+
   fitter.setFunction(func);
   fitter.setMaxIter(50+n*10);
   // Convergence criterium
   fitter.setCriteria(0.001);
-  
+
   // Fit
   Vector<Float> sigma(x_.nelements());
@@ -296,7 +299,8 @@
   parameters_.tovector(ps);
   setParameters(ps);
+
   error_.resize();
   error_ = fitter.errors();
-  
+
   chisquared_ = fitter.getChi2();
   
@@ -304,5 +308,5 @@
   residual_ =  y_;
   fitter.residual(residual_,x_);
-  
+
   // use fitter.residual(model=True) to get the model
   thefit_.resize(x_.nelements());
Index: tags/release_update1/src/SDMemTable.cc
===================================================================
--- trunk/src/SDMemTable.cc	(revision 560)
+++ tags/release_update1/src/SDMemTable.cc	(revision 632)
@@ -1450,5 +1450,5 @@
   oss << setw(15) << "Rest Freqs:";
   if (vec.nelements() > 0) {
-      oss << setprecision(0) << vec << " [Hz]" << endl;
+      oss << setprecision(10) << vec << " [Hz]" << endl;
   } else {
       oss << "None set" << endl;
Index: tags/release_update1/src/SDReader.cc
===================================================================
--- trunk/src/SDReader.cc	(revision 560)
+++ tags/release_update1/src/SDReader.cc	(revision 632)
@@ -293,5 +293,9 @@
 	sc.tcaltime = tcalTime;
 	sc.parangle = parAngle;
-	sc.refbeam = refBeam-1;//make it 0-based; -1 if nbeams == 1
+	sc.refbeam = -1; //nbeams == 1
+	if (nBeam_ > 1) // circumvent a bug "asap0000" in read which
+			// returns a random refbema number on multiple
+			// reads
+	  sc.refbeam = refBeam-1;//make it 0-based;
         sc.scanid = scanNo-1;//make it 0-based
         if (haveXPol_) {
Index: tags/release_update1/src/SDTemplates.cc
===================================================================
--- trunk/src/SDTemplates.cc	(revision 560)
+++ tags/release_update1/src/SDTemplates.cc	(revision 632)
@@ -90,5 +90,5 @@
 template MaskedArray<Float> operator*<Float>(Array<Float> const&, MaskedArray<Float> const&);
 template Float stddev<Float>(MaskedArray<Float> const&);
-template Float median<Float>(MaskedArray<Float> const&);
+template Float median<Float>(MaskedArray<Float> const&, Bool, Bool);
 template Float sumsquares<Float>(MaskedArray<Float> const&);
 template Float avdev<Float>(MaskedArray<Float> const&);
@@ -107,4 +107,5 @@
 template void Array<Double>::tovector(vector<double> &) const;
 template void Array<Int>::tovector(vector<int> &) const;
+template void Array<std::complex<float> >::reference(const Array<std::complex<float> >&);
 template void LatticeUtilities::bin(MaskedArray<float>&, MaskedArray<float> const&, uInt, uInt);
 template class PtrHolder<Lattice<Float> >;
Index: tags/release_update1/src/SDWriter.cc
===================================================================
--- trunk/src/SDWriter.cc	(revision 560)
+++ tags/release_update1/src/SDWriter.cc	(revision 632)
@@ -282,5 +282,5 @@
         }
 //
-        if (status = cWriter->write(sd.scanid, cycleNo, sd.timestamp,
+        if (status = cWriter->write(sd.scanid+1, cycleNo, sd.timestamp,
                                     sd.interval, sd.fieldname, sd.sourcename,
                                     sd.getDirection(iBeam),
