Index: sansview/perspectives/fitting/fitpage1D.py
===================================================================
--- sansview/perspectives/fitting/fitpage1D.py	(revision bcd6d51ec9434da3082881dfdfb88a73950d810c)
+++ sansview/perspectives/fitting/fitpage1D.py	(revision 9d31a8b73e768aee2608c8a0172d85e8dae7f31a)
@@ -39,5 +39,5 @@
     
     
-    def __init__(self, parent, *args, **kwargs):
+    def __init__(self, parent,data, *args, **kwargs):
         wx.Panel.__init__(self, parent, *args, **kwargs)
         """ 
@@ -55,4 +55,5 @@
         self.DataSource      = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
         self.DataSource.SetToolTipString("name of data to fit")
+        self.DataSource.SetValue(str(data.name))
         self.modelbox = wx.ComboBox(self, -1)
         id = wx.NewId()
@@ -83,15 +84,5 @@
         ix += 1
         self.sizer3.Add(self.modelbox,(iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        ix = 1
-        iy = 1
-        self.text4_1 = wx.StaticText(self, -1, 'Min')
-        self.sizer4.Add(self.text4_1,(iy, ix),(1,1),\
-                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        self.text4_1.Hide()
-        ix += 2
-        self.text4_2 = wx.StaticText(self, -1, 'Max')
-        self.sizer4.Add(self.text4_2,(iy, ix),(1,1),\
-                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        self.text4_2.Hide()
+        
         ix = 0
         iy += 1
@@ -100,19 +91,36 @@
         self.sizer4.Add(self.text4_3,(iy,ix),(1,1),\
                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        self.text4_3.Hide()
+        
         ix += 1
+        self.text4_1 = wx.StaticText(self, -1, 'Min')
+        self.sizer4.Add(self.text4_1,(iy, ix),(1,1),\
+                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        
+        ix += 2
+        self.text4_2 = wx.StaticText(self, -1, 'Max')
+        self.sizer4.Add(self.text4_2,(iy, ix),(1,1),\
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        ix = 0
+        iy += 1
+        self.text4_4 = wx.StaticText(self, -1, 'x range')
+        self.sizer4.Add(self.text4_4,(iy, ix),(1,1),\
+                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix += 1
+        
         self.xmin    = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
+        self.xmin.SetValue(format_number(numpy.min(data.x)))
         self.xmin.SetToolTipString("Minimun value of x in linear scale.")
         self.sizer4.Add(self.xmin,(iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         self.xmin.Bind(wx.EVT_KILL_FOCUS, self._onTextEnter)
         self.xmin.Bind(wx.EVT_TEXT_ENTER, self._onTextEnter)
-        self.xmin.Hide()
+        
         ix += 2
         self.xmax    = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
+        self.xmax.SetValue(format_number(numpy.max(data.x)))
         self.xmax.SetToolTipString("Maximum value of x in linear scale.")
         self.sizer4.Add(self.xmax,(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         self.xmax.Bind(wx.EVT_KILL_FOCUS, self._onTextEnter)
         self.xmax.Bind(wx.EVT_TEXT_ENTER, self._onTextEnter)
-        self.xmax.Hide()
+       
         #Set chisqr  result into TextCtrl
         ix = 0
@@ -136,19 +144,16 @@
         # model on which the fit would be performed
         self.model=None
-        # preview selected model name
-        self.prevmodel_name=None
-        # flag to check if the user has selected a new model in the combox box
-        self.model_hasChanged=False
-        
+       
+    
         #dictionary of model name and model class
         self.model_list_box={}
-        #  comparison between 2 group_id for checking data changes
-        self.prev_group_id= None
-        
-        self.data=None
+      
+        self.data=data
         self.vbox.Layout()
+        self.GrandParent.GetSizer().Layout()
         self.vbox.Fit(self) 
         self.SetSizer(self.vbox)
         self.Centre()
+        
         
         
@@ -168,24 +173,4 @@
         self.manager = manager
  
-         
-    def _DataNameEnter(self):
-        """
-            reset the panel when a new data is selected
-        """
-        if len(self.parameters )>0:
-            for item in self.parameters:
-                item[0].SetValue(False)
-                wx.EVT_CHECKBOX(self, item[0].GetId(), self.select_param)
-                item[2].Hide()
-                item[3].Clear()
-                item[3].Hide()
-                self.xmax.Disable()
-                self.xmin.Disable()
-                self.text1_1.Hide()
-                self.tcChi.Clear()
-                self.vbox.Layout() 
-                self.GrandParent.GetSizer().Layout()
-                
-  
         
     def onClose(self,event):
@@ -322,57 +307,5 @@
         return flag
     
-   
-                    
-    def set_data_name(self,dataset):
-        """ 
-            set data's name.if data has changed reset the panel and xmin and xmax
-            @param name: data 's name
-            @attention:  still  haven't find a better way to display Q name and unit
-            for xmin and xmax range sizer
-        """
-        
-        if self.prev_group_id !=dataset.group_id:
-            self._DataNameEnter()
-        self.data = dataset
-        self.prev_group_id=dataset.group_id
-        #Displaying Data information
-        self.DataSource.SetValue(str(dataset.name))
-        self._xaxis,self._xunit=dataset.get_xaxis()
-        self.text4_3.SetLabel(self._xaxis+"["+self._xunit+"]")
-        self.text4_1.Show()
-        self.text4_2.Show()
-        self.text4_3.Show()
-       
-        self.xmin.SetValue(format_number(min(dataset.x)))
-        self.xmin.Show()
-        self.xmax.SetValue(format_number(max(dataset.x)))
-        self.xmax.Show()
-        
-        if ((len(self.param_toFit ) >0) and self.DataSource.GetValue()and \
-            self.modelbox.GetValue() and (self.model_hasChanged ==False)):
-            self.xmin.Enable()
-            self.xmax.Enable()
-        else:
-            self.xmin.Disable()
-            self.xmax.Disable()
-            
-        self.vbox.Layout()
-        self.GrandParent.GetSizer().Layout()
-        
-        
-    def set_model_name(self,name):
-        """ 
-            set model name. set also self.model_hasChanged to true is the model 
-            type has changed or false if it didn't
-            @param name: model 's name
-        """
-        self.model_hasChanged=False
-        if (name != self.prevmodel_name):
-            self.model_hasChanged=True
-        self.tcChi.Clear()
-        #self.modelbox.SetValue(str(name))
-        self.prevmodel_name=self.modelbox.GetValue()
-       
-            
+
     def get_model_box(self): 
         """ return reference to combox box self.model"""
@@ -470,15 +403,12 @@
                 self.text2_4.Hide()
         #Disable or enable fit button
-        if (self.modelbox.GetValue() and self.DataSource.GetValue()):
-            if not (len(self.param_toFit ) >0):
-                self.xmin.Disable()
-                self.xmax.Disable()
-            else:
-                self.xmin.Enable()
-                self.xmax.Enable()
-        else:
+        
+        if not (len(self.param_toFit ) >0):
             self.xmin.Disable()
             self.xmax.Disable()
-        
+        else:
+            self.xmin.Enable()
+            self.xmax.Enable()
+       
         self.compute_chisqr()
         self.vbox.Layout()
@@ -522,11 +452,11 @@
                     list= [item[0],item[1],item[2],item[3]]
                     self.param_toFit.append(list )
-                if (self.modelbox.GetValue() and self.DataSource.GetValue()):
-                    if not (len(self.param_toFit ) >0):
-                        self.xmin.Disable()
-                        self.xmax.Disable()
-                    else:
-                        self.xmin.Enable()
-                        self.xmax.Enable()
+               
+                if not (len(self.param_toFit ) >0):
+                    self.xmin.Disable()
+                    self.xmax.Disable()
+                else:
+                    self.xmin.Enable()
+                    self.xmax.Enable()
             else:
                 for item in self.parameters:
@@ -555,14 +485,12 @@
         else:
             self.cb1.SetValue(False)
-        if (self.modelbox.GetValue() and self.DataSource.GetValue()):
-            if not (len(self.param_toFit ) >0):
-                self.xmin.Disable()
-                self.xmax.Disable()
-            else:
-                self.xmin.Enable()
-                self.xmax.Enable()
-        else:
+        
+        if not (len(self.param_toFit ) >0):
             self.xmin.Disable()
             self.xmax.Disable()
+        else:
+            self.xmin.Enable()
+            self.xmax.Enable()
+  
    
        
Index: sansview/perspectives/fitting/fitpage2D.py
===================================================================
--- sansview/perspectives/fitting/fitpage2D.py	(revision e1a310f0194e409e95996be6b18ad2889d138464)
+++ sansview/perspectives/fitting/fitpage2D.py	(revision 9d31a8b73e768aee2608c8a0172d85e8dae7f31a)
@@ -39,5 +39,5 @@
     
     
-    def __init__(self, parent, *args, **kwargs):
+    def __init__(self, parent,data, *args, **kwargs):
         wx.Panel.__init__(self, parent, *args, **kwargs)
         """ 
@@ -54,4 +54,5 @@
         self.sizer1 = wx.GridBagSizer(5,5)
         self.DataSource      = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
+        self.DataSource.SetValue(str(data.name))
         self.DataSource.SetToolTipString("name of data to fit")
         self.modelbox = wx.ComboBox(self, -1)
@@ -83,6 +84,12 @@
         ix += 1
         self.sizer3.Add(self.modelbox,(iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        ix = 1
+        
+        ix = 0
         iy = 1
+        #set maximum range for x in linear scale
+        self.text4_3 = wx.StaticText(self, -1, 'Maximum Data\n Range (Linear)', style=wx.ALIGN_LEFT)
+        self.sizer4.Add(self.text4_3,(iy,ix),(1,1),\
+                   wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix += 1
         self.text4_1 = wx.StaticText(self, -1, 'Min')
         self.sizer4.Add(self.text4_1,(iy, ix),(1,1),\
@@ -94,13 +101,14 @@
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         #self.text4_2.Hide()
+       
+        #self.text4_3.Hide()
         ix = 0
         iy += 1
-        #set maximum range for x in linear scale
-        self.text4_3 = wx.StaticText(self, -1, 'Maximum Data\n Range (Linear)', style=wx.ALIGN_LEFT)
-        self.sizer4.Add(self.text4_3,(iy,ix),(1,1),\
-                   wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        #self.text4_3.Hide()
+        self.text4_4 = wx.StaticText(self, -1, 'x range')
+        self.sizer4.Add(self.text4_4,(iy, ix),(1,1),\
+                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
         self.xmin    = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
+        self.xmin.SetValue(format_number(data.xmin))
         self.xmin.SetToolTipString("Minimun value of x in linear scale.")
         self.sizer4.Add(self.xmin,(iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
@@ -110,4 +118,5 @@
         ix += 2
         self.xmax    = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
+        self.xmax.SetValue(format_number(data.xmax))
         self.xmax.SetToolTipString("Maximum value of x in linear scale.")
         self.sizer4.Add(self.xmax,(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
@@ -116,6 +125,11 @@
         
         iy +=1
-        ix = 1
+        ix = 0
+        self.text4_5 = wx.StaticText(self, -1, 'y range')
+        self.sizer4.Add(self.text4_5,(iy, ix),(1,1),\
+                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix += 1
         self.ymin    = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
+        self.ymin.SetValue(format_number(data.ymin))
         self.ymin.SetToolTipString("Minimun value of y in linear scale.")
         self.sizer4.Add(self.ymin,(iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
@@ -125,4 +139,5 @@
         ix += 2
         self.ymax    = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
+        self.ymax.SetValue(format_number(data.ymax))
         self.ymax.SetToolTipString("Maximum value of y in linear scale.")
         self.sizer4.Add(self.ymax,(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
@@ -152,14 +167,10 @@
         self.model=None
         # preview selected model name
-        self.prevmodel_name=None
-        # flag to check if the user has selected a new model in the combox box
-        self.model_hasChanged=False
+       
         
         #dictionary of model name and model class
         self.model_list_box={}
-        #  comparison between 2 group_id for checking data changes
-        self.prev_group_id= None
-        
-        self.data=None
+       
+        self.data = data
         self.vbox.Layout()
         self.vbox.Fit(self) 
@@ -183,24 +194,4 @@
         self.manager = manager
  
-         
-    def _DataNameEnter(self):
-        """
-            reset the panel when a new data is selected
-        """
-        if len(self.parameters )>0:
-            for item in self.parameters:
-                item[0].SetValue(False)
-                wx.EVT_CHECKBOX(self, item[0].GetId(), self.select_param)
-                item[2].Hide()
-                item[3].Clear()
-                item[3].Hide()
-                self.xmax.Disable()
-                self.xmin.Disable()
-                self.text1_1.Hide()
-                self.tcChi.Clear()
-                self.vbox.Layout() 
-                self.GrandParent.GetSizer().Layout()
-                
-  
         
     def onClose(self,event):
@@ -214,18 +205,21 @@
         """
         flag=self.checkFitRange()
+        res=[]
         if flag== True:
             try:
-                qmin = float(self.xmin.GetValue())
-                qmax = float(self.xmax.GetValue())
-                res=[]
-                if qmin==None and qmax==None: 
-                    for i in range(len(self.data.x_bins)):
-                        res.append( (self.data.image[i][i]- fn([self.data.x_bins[i],self.data.y_bins[i]]))\
-                                    /self.data.err_image[i][i] )
-                else:
-                    for i in range(len(self.data.x_bins)):
-                        res.append( (self.data.image[i][i]- fn([self.data.x_bins[i],self.data.y_bins[i]]))\
-                                    /self.data.err_image[i][i] )
+                xmin = float(self.xmin.GetValue())
+                xmax = float(self.xmax.GetValue())
+                ymin = float(self.ymin.GetValue())
+                ymax = float(self.ymax.GetValue())
+               
+                for i in range(len(self.data.y_bins)):
+                    if self.data.y_bins[i]>= ymin and self.data.y_bins[i]<= ymax:
+                        for j in range(len(self.data.x_bins)):
+                            if self.data.x_bins[j]>= xmin and self.data.x_bins[j]<= xmax:
+                                res.append( (self.data.image[j][i]- self.model.runXY(\
+                                 [self.data.x_bins[j],self.data.y_bins[i]]))\
+                                    /self.data.err_image[j][i] )
                 sum=0
+               
                 for item in res:
                     if numpy.isfinite(item):
@@ -335,59 +329,5 @@
         return flag
     
-   
-                    
-    def set_data_name(self,dataset):
-        """ 
-            set data's name.if data has changed reset the panel and xmin and xmax
-            @param name: data 's name
-            @attention:  still  haven't find a better way to display Q name and unit
-            for xmin and xmax range sizer
-        """
-        
-        #if self.prev_group_id !=dataset.group_id:
-        #    self._DataNameEnter()
-        self.data = dataset
-        self.prev_group_id=dataset.group_id
-        #Displaying Data information
-        self.DataSource.SetValue(str(dataset.name))
-        self.text4_3.SetLabel(self.data._xaxis+"["+self.data._xunit+"]")
-        self.text4_1.Show()
-        self.text4_2.Show()
-        self.text4_3.Show()
-        
-        self.xmin.SetValue(format_number(dataset.xmin))
-        self.xmax.SetValue(format_number(dataset.xmax))
-        self.ymin.SetValue(format_number(dataset.ymin))
-        self.ymax.SetValue(format_number(dataset.ymax))
-        if ((len(self.param_toFit ) >0) and self.DataSource.GetValue()and \
-            self.modelbox.GetValue() and (self.model_hasChanged ==False)):
-            self.xmin.Enable()
-            self.xmax.Enable()
-            self.ymin.Enable()
-            self.ymax.Enable()
-        else:
-            self.xmin.Disable()
-            self.xmax.Disable()
-            self.ymin.Disable()
-            self.ymax.Disable()
-            
-        self.vbox.Layout()
-        self.GrandParent.GetSizer().Layout()
-        
-        
-    def set_model_name(self,name):
-        """ 
-            set model name. set also self.model_hasChanged to true is the model 
-            type has changed or false if it didn't
-            @param name: model 's name
-        """
-        self.model_hasChanged=False
-        if (name != self.prevmodel_name):
-            self.model_hasChanged=True
-        self.tcChi.Clear()
-        #self.modelbox.SetValue(str(name))
-        self.prevmodel_name=self.modelbox.GetValue()
-       
-            
+  
     def get_model_box(self): 
         """ return reference to combox box self.model"""
@@ -540,15 +480,15 @@
                     list= [item[0],item[1],item[2],item[3]]
                     self.param_toFit.append(list )
-                if (self.modelbox.GetValue() and self.DataSource.GetValue()):
-                    if not (len(self.param_toFit ) >0):
-                        self.xmin.Disable()
-                        self.xmax.Disable()
-                        self.ymin.Disable()
-                        self.ymax.Disable()
-                    else:
-                        self.xmin.Enable()
-                        self.xmax.Enable()
-                        self.ymin.Enable()
-                        self.ymax.Enable()
+               
+                if not (len(self.param_toFit ) >0):
+                    self.xmin.Disable()
+                    self.xmax.Disable()
+                    self.ymin.Disable()
+                    self.ymax.Disable()
+                else:
+                    self.xmin.Enable()
+                    self.xmax.Enable()
+                    self.ymin.Enable()
+                    self.ymax.Enable()
             else:
                 for item in self.parameters:
@@ -579,20 +519,16 @@
         else:
             self.cb1.SetValue(False)
-        if (self.modelbox.GetValue() and self.DataSource.GetValue()):
-            if not (len(self.param_toFit ) >0):
-                self.xmin.Disable()
-                self.xmax.Disable()
-                self.ymin.Disable()
-                self.ymax.Disable()
-            else:
-                self.xmin.Enable()
-                self.xmax.Enable()
-                self.ymin.Enable()
-                self.ymax.Enable()
-        else:
+       
+        if not (len(self.param_toFit ) >0):
             self.xmin.Disable()
             self.xmax.Disable()
             self.ymin.Disable()
             self.ymax.Disable()
+        else:
+            self.xmin.Enable()
+            self.xmax.Enable()
+            self.ymin.Enable()
+            self.ymax.Enable()
+      
    
        
Index: sansview/perspectives/fitting/fitpanel.py
===================================================================
--- sansview/perspectives/fitting/fitpanel.py	(revision caa1226aec298fc006a4272e36619ba32890dbd1)
+++ sansview/perspectives/fitting/fitpanel.py	(revision 9d31a8b73e768aee2608c8a0172d85e8dae7f31a)
@@ -80,11 +80,11 @@
             if data.__class__.__name__=='MetaData2D':
                  from fitpage2D import FitPage2D
-                 panel = FitPage2D(self.nb, -1)
+                 panel = FitPage2D(self.nb,data, -1)
             else:
                 from fitpage1D import FitPage1D
-                panel = FitPage1D(self.nb, -1)
+                panel = FitPage1D(self.nb,data, -1)
             panel.set_manager(self.manager)
             panel.set_owner(self.event_owner)
-            panel.set_data_name(data)
+            
             self.nb.AddPage(page=panel,text=name,select=True)
             panel.populate_box( self.model_list_box)
Index: sansview/perspectives/fitting/fitting.py
===================================================================
--- sansview/perspectives/fitting/fitting.py	(revision e1a310f0194e409e95996be6b18ad2889d138464)
+++ sansview/perspectives/fitting/fitting.py	(revision 9d31a8b73e768aee2608c8a0172d85e8dae7f31a)
@@ -212,5 +212,5 @@
         
         
-    def _single_fit_completed(self,result,pars,cpage,qmin,qmax):
+    def _single_fit_completed(self,result,pars,cpage,qmin,qmax,ymin=None, ymax=None):
         """
             Display fit result on one page of the notebook.
@@ -243,5 +243,5 @@
             
             cpage.onsetValues(result.fitness, result.pvec,result.stderr)
-            self.plot_helper(currpage=cpage,qmin=qmin,qmax=qmax)
+            self.plot_helper(currpage=cpage,qmin=qmin,qmax=qmax,ymin=ymin, ymax=ymax)
         except:
             raise
@@ -249,5 +249,5 @@
             
        
-    def _simul_fit_completed(self,result,qmin,qmax):
+    def _simul_fit_completed(self,result,qmin,qmax,ymin=None, ymax=None):
         """
             Parameter estimation completed, 
@@ -276,10 +276,10 @@
                     page.onsetValues(result.fitness, small_out,small_cov)
                     #Replot model
-                    self.plot_helper(currpage= page,qmin= qmin,qmax= qmax) 
+                    self.plot_helper(currpage= page,qmin= qmin,qmax= qmax,ymin=ymin, ymax=ymax) 
         except:
              wx.PostEvent(self.parent, StatusEvent(status="Fitting error: %s" % sys.exc_value))
             
     
-    def _on_single_fit(self,id=None,qmin=None,qmax=None):
+    def _on_single_fit(self,id=None,qmin=None,qmax=None,ymin=None,ymax=None):
         """ 
             perform fit for the  current page  and return chisqr,out and cov
@@ -306,5 +306,5 @@
         for page, value in self.page_finder.iteritems():
             if  value.get_scheduled() ==1 :
-                fitdata = value.get_data()
+                metadata = value.get_data()
                 list=value.get_model()
                 model=list[0]
@@ -320,5 +320,5 @@
                     #Do the single fit
                     self.fitter.set_model(Model(model), self.id, pars) 
-                    self.fitter.set_data(fitdata,self.id,qmin,qmax)
+                    self.fitter.set_data(metadata,self.id,qmin,qmax)
                     self.fitter.select_problem_for_fit(Uid=self.id,value=value.get_scheduled())
                     page_fitted=page
@@ -335,5 +335,5 @@
             print "single_fit: result",result.fitness,result.pvec,result.stderr
             #self._single_fit_completed(result,pars,page,qmin,qmax)
-            self._single_fit_completed(result,pars,page_fitted,qmin,qmax)
+            self._single_fit_completed(result,pars,page_fitted,qmin,qmax,ymin,ymax)
         except:
             raise
@@ -341,5 +341,5 @@
             return
          
-    def _on_simul_fit(self, id=None,qmin=None,qmax=None):
+    def _on_simul_fit(self, id=None,qmin=None,qmax=None, ymin=None, ymax=None):
         """ 
             perform fit for all the pages selected on simpage and return chisqr,out and cov
@@ -362,5 +362,5 @@
             try:
                 if value.get_scheduled()==1:
-                    fitdata = value.get_data()
+                    metadata = value.get_data()
                     list = value.get_model()
                     model= list[0]
@@ -391,5 +391,5 @@
                             
                     self.fitter.set_model(new_model, self.id, pars) 
-                    self.fitter.set_data(fitdata,self.id,qmin,qmax)
+                    self.fitter.set_data(metadata,self.id,qmin,qmax,ymin,ymax)
                     self.fitter.select_problem_for_fit(Uid=self.id,value=value.get_scheduled())
                     self.id += 1 
@@ -400,5 +400,5 @@
         try:
             result=self.fitter.fit()
-            self._simul_fit_completed(result,qmin,qmax)
+            self._simul_fit_completed(result,qmin,qmax,ymin,ymax)
         except:
             wx.PostEvent(self.parent, StatusEvent(status="Simultaneous Fitting error: %s" % sys.exc_value))
@@ -433,5 +433,4 @@
         current_pg = self.fit_panel.get_current_page() 
         if current_pg != sim_page:
-            current_pg.set_model_name(name)
             current_pg.set_panel(model)
             
@@ -461,5 +460,5 @@
         self.plot_helper(currpage=page,qmin= qmin,qmax= qmax)
         
-    def plot_helper(self,currpage,qmin=None,qmax=None):
+    def plot_helper(self,currpage,qmin=None,qmax=None,ymin=None,ymax=None):
         """
             Plot a theory given a model and data
@@ -521,6 +520,17 @@
                 theory.y_bins= data.y_bins
                 tempy=[]
-                for i in range(len(data.x_bins)):
-                    theory.image= model.runXY([data.x_bins[i],data.y_bins[i]])
+                if qmin==None:
+                    qmin=data.xmin
+                if qmax==None:
+                    qmin=data.xmax
+                if ymin==None:
+                    ymin=data.ymin
+                if ymax==None:
+                    qmin=data.ymax
+                for i in range(len(data.y_bins)):
+                    if data.y_bins[i]>= ymin and data.y_bins[i]<= ymax:
+                        for j in range(len(data.x_bins)):
+                            if data.x_bins[i]>= xmin and data.x_bins[i]<= xmax:
+                                theory.image= model.runXY([data.x_bins[j],data.y_bins[i]])
                     #print "fitting : plot_helper:", theory.image
                 #print data.image
