Index: plottools/src/danse/common/plottools/fitDialog.py
===================================================================
--- plottools/src/danse/common/plottools/fitDialog.py	(revision ffdfd2333ba7860a2e7d4e44465eca48d8a2effb)
+++ plottools/src/danse/common/plottools/fitDialog.py	(revision 3b2b031f8a2088d22b4b7177f55326ca97866f06)
@@ -99,4 +99,5 @@
         
         # Buttons on the bottom
+        self.bg_on = False
         self.static_line_1 = wx.StaticLine(self, -1)
         self.btFit = wx.Button(self, -1, 'Fit')
@@ -105,7 +106,16 @@
         self.btClose =wx.Button(self, wx.ID_CANCEL, 'Close')
         self.btClose.Bind(wx.EVT_BUTTON, self._on_close)
-        
+        if RG_ON:
+            if (self.yLabel == "ln(y)" or self.yLabel == "ln(y*x)") and \
+                    (self.xLabel == "x^(2)"):
+                self.rg_on = True
+            if (self.xLabel == "x^(4)") and (self.yLabel == "y*x^(4)"):
+                self.bg_on = True
         # Intro
         explanation = "Perform fit for y(x) = ax + b"
+        if self.bg_on:
+            param_a = 'Background (= Parameter a)'
+        else:
+            param_a = 'Parameter a'
         vbox.Add(sizer)
         ix = 0
@@ -114,5 +124,5 @@
                  (1, 1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         iy += 2
-        sizer.Add(wx.StaticText(self, -1, 'Parameter a'), (iy, ix),
+        sizer.Add(wx.StaticText(self, -1, param_a), (iy, ix),
                  (1, 1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
@@ -175,105 +185,102 @@
         ix += 2
         sizer.Add(self.xmaxFit, (iy, ix), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        if RG_ON:
-            if (self.yLabel == "ln(y)" or self.yLabel == "ln(y*x)") and \
-                    (self.xLabel == "x^(2)"):
-                self.rg_on = True
-                self.SetSize((PNL_WIDTH, PNL_HEIGHT))
-                I0_stxt = wx.StaticText(self, -1, 'I(q=0)')
-                self.I0_tctr = wx.TextCtrl(self, -1, '')
-                self.I0_tctr.SetEditable(False)
-                self.I0_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
-                self.I0err_tctr = wx.TextCtrl(self, -1, '')
-                self.I0err_tctr.SetEditable(False)
-                self.I0err_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
-                Rg_stxt = wx.StaticText(self, -1, 'Rg [A]')
-                Rg_stxt.Show(self.yLabel == "ln(y)" )
-                self.Rg_tctr = wx.TextCtrl(self, -1, '')
-                self.Rg_tctr.SetEditable(False)
-                self.Rg_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
-                self.Rg_tctr.Show(self.yLabel == "ln(y)" )
-                self.Rgerr_tctr = wx.TextCtrl(self, -1, '')
-                self.Rgerr_tctr.SetEditable(False)
-                self.Rgerr_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
-                self.Rgerr_tctr.Show(self.yLabel == "ln(y)" )
-                self.Rgerr_pm = wx.StaticText(self, -1, '+/-')
-                self.Rgerr_pm.Show(self.yLabel == "ln(y)" )
-                Diameter_stxt = wx.StaticText(self, -1, 'Rod Diameter [A]')
-                Diameter_stxt.Show(self.yLabel == "ln(y*x)")
-                self.Diameter_tctr = wx.TextCtrl(self, -1, '')
-                self.Diameter_tctr.SetEditable(False)
-                self.Diameter_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
-                self.Diameter_tctr.Show(self.yLabel == "ln(y*x)")
-                self.Diameter_pm = wx.StaticText(self, -1, '+/-')
-                self.Diameter_pm.Show(self.yLabel == "ln(y*x)")
-                self.Diametererr_tctr = wx.TextCtrl(self, -1, '')
-                self.Diametererr_tctr.SetEditable(False)
-                self.Diametererr_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
-                self.Diametererr_tctr.Show(self.yLabel == "ln(y*x)")
-                RgQmin_stxt = wx.StaticText(self, -1, 'Rg*Qmin')
-                self.RgQmin_tctr = wx.TextCtrl(self, -1, '')
-                self.RgQmin_tctr.SetEditable(False)
-                self.RgQmin_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
-                RgQmax_stxt = wx.StaticText(self, -1, 'Rg*Qmax')
-                self.RgQmax_tctr = wx.TextCtrl(self, -1, '')
-                self.RgQmax_tctr.SetEditable(False)
-                self.RgQmax_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
+        if self.rg_on:
+            self.SetSize((PNL_WIDTH, PNL_HEIGHT))
+            I0_stxt = wx.StaticText(self, -1, 'I(q=0)')
+            self.I0_tctr = wx.TextCtrl(self, -1, '')
+            self.I0_tctr.SetEditable(False)
+            self.I0_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
+            self.I0err_tctr = wx.TextCtrl(self, -1, '')
+            self.I0err_tctr.SetEditable(False)
+            self.I0err_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
+            Rg_stxt = wx.StaticText(self, -1, 'Rg [A]')
+            Rg_stxt.Show(self.yLabel == "ln(y)" )
+            self.Rg_tctr = wx.TextCtrl(self, -1, '')
+            self.Rg_tctr.SetEditable(False)
+            self.Rg_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
+            self.Rg_tctr.Show(self.yLabel == "ln(y)" )
+            self.Rgerr_tctr = wx.TextCtrl(self, -1, '')
+            self.Rgerr_tctr.SetEditable(False)
+            self.Rgerr_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
+            self.Rgerr_tctr.Show(self.yLabel == "ln(y)" )
+            self.Rgerr_pm = wx.StaticText(self, -1, '+/-')
+            self.Rgerr_pm.Show(self.yLabel == "ln(y)" )
+            Diameter_stxt = wx.StaticText(self, -1, 'Rod Diameter [A]')
+            Diameter_stxt.Show(self.yLabel == "ln(y*x)")
+            self.Diameter_tctr = wx.TextCtrl(self, -1, '')
+            self.Diameter_tctr.SetEditable(False)
+            self.Diameter_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
+            self.Diameter_tctr.Show(self.yLabel == "ln(y*x)")
+            self.Diameter_pm = wx.StaticText(self, -1, '+/-')
+            self.Diameter_pm.Show(self.yLabel == "ln(y*x)")
+            self.Diametererr_tctr = wx.TextCtrl(self, -1, '')
+            self.Diametererr_tctr.SetEditable(False)
+            self.Diametererr_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
+            self.Diametererr_tctr.Show(self.yLabel == "ln(y*x)")
+            RgQmin_stxt = wx.StaticText(self, -1, 'Rg*Qmin')
+            self.RgQmin_tctr = wx.TextCtrl(self, -1, '')
+            self.RgQmin_tctr.SetEditable(False)
+            self.RgQmin_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
+            RgQmax_stxt = wx.StaticText(self, -1, 'Rg*Qmax')
+            self.RgQmax_tctr = wx.TextCtrl(self, -1, '')
+            self.RgQmax_tctr.SetEditable(False)
+            self.RgQmax_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
 
-                iy += 2
-                ix = 0
-                sizer.Add(I0_stxt, (iy, ix), (1,1),
-                                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-                ix += 1
-                sizer.Add(self.I0_tctr, (iy, ix), (1,1),
-                                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                ix += 1
-                sizer.Add(wx.StaticText(self, -1, '+/-'), (iy, ix),
-                                        (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                ix += 1
-                sizer.Add(self.I0err_tctr, (iy, ix), (1,1), 
-                                        wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                
-                iy += 1
-                ix = 0
-                sizer.Add(Rg_stxt, (iy, ix),(1,1),
-                                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-                ix += 1
-                sizer.Add(self.Rg_tctr, (iy, ix), (1,1),
-                                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        
-                ix += 1
-                sizer.Add(self.Rgerr_pm, (iy, ix),
-                                        (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                ix += 1
-                sizer.Add(self.Rgerr_tctr, (iy, ix), (1,1), 
-                                        wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                iy += 1
-                ix = 0
-                sizer.Add(Diameter_stxt, (iy, ix),(1,1),
-                                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-                ix += 1
-                sizer.Add(self.Diameter_tctr, (iy, ix), (1,1),
-                                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        
-                ix += 1
-                sizer.Add(self.Diameter_pm, (iy, ix),
-                                        (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                ix += 1
-                sizer.Add(self.Diametererr_tctr, (iy, ix), (1,1), 
-                                        wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                iy += 1
-                ix = 0
-                sizer.Add(RgQmin_stxt, (iy, ix),(1,1),
-                                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-                ix += 1
-                sizer.Add(self.RgQmin_tctr, (iy, ix), (1,1),
-                                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                iy += 1
-                ix = 0
-                sizer.Add(RgQmax_stxt, (iy, ix),(1,1),
-                                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-                ix += 1
-                sizer.Add(self.RgQmax_tctr, (iy, ix), (1,1),
-                                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            iy += 2
+            ix = 0
+            sizer.Add(I0_stxt, (iy, ix), (1,1),
+                                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+            ix += 1
+            sizer.Add(self.I0_tctr, (iy, ix), (1,1),
+                                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            ix += 1
+            sizer.Add(wx.StaticText(self, -1, '+/-'), (iy, ix),
+                                    (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            ix += 1
+            sizer.Add(self.I0err_tctr, (iy, ix), (1,1), 
+                                    wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            
+            iy += 1
+            ix = 0
+            sizer.Add(Rg_stxt, (iy, ix),(1,1),
+                                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+            ix += 1
+            sizer.Add(self.Rg_tctr, (iy, ix), (1,1),
+                                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+    
+            ix += 1
+            sizer.Add(self.Rgerr_pm, (iy, ix),
+                                    (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            ix += 1
+            sizer.Add(self.Rgerr_tctr, (iy, ix), (1,1), 
+                                    wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            iy += 1
+            ix = 0
+            sizer.Add(Diameter_stxt, (iy, ix),(1,1),
+                                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+            ix += 1
+            sizer.Add(self.Diameter_tctr, (iy, ix), (1,1),
+                                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+    
+            ix += 1
+            sizer.Add(self.Diameter_pm, (iy, ix),
+                                    (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            ix += 1
+            sizer.Add(self.Diametererr_tctr, (iy, ix), (1,1), 
+                                    wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            iy += 1
+            ix = 0
+            sizer.Add(RgQmin_stxt, (iy, ix),(1,1),
+                                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+            ix += 1
+            sizer.Add(self.RgQmin_tctr, (iy, ix), (1,1),
+                                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            iy += 1
+            ix = 0
+            sizer.Add(RgQmax_stxt, (iy, ix),(1,1),
+                                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+            ix += 1
+            sizer.Add(self.RgQmax_tctr, (iy, ix), (1,1),
+                                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
             
         iy += 1
@@ -372,5 +379,5 @@
         tempy = []
         tempdy = []
-       
+            
         # Check if View contains a x array .we online fit when x exits
         # makes transformation for y as a line to fit
