Index: guitools/PlotPanel.py
===================================================================
--- guitools/PlotPanel.py	(revision 8035b8291739d8093a9608f14ae1bca015d4f82c)
+++ guitools/PlotPanel.py	(revision f193585958b4a7d32fd27d957003d126d30798d3)
@@ -10,4 +10,7 @@
 import transform
 from canvas import FigureCanvas
+from matplotlib.widgets import RectangleSelector
+from pylab import  gca, gcf
+
 #TODO: make the plottables interactive
 
@@ -49,5 +52,5 @@
         sizer.Add(self.canvas,1,wx.EXPAND)
         self.SetSizer(sizer)
-
+        
         # Graph object to manage the plottables
         self.graph = Graph()
@@ -88,5 +91,4 @@
         if len(list.keys())>0:
             first_item = list.keys()[0]
-            #print first_item, list[first_item].__class__.__name__
             dlg = LinearFit( None, first_item, self.onFitDisplay,self.returnTrans, -1, 'Fitting')
             dlg.ShowModal() 
@@ -172,5 +174,27 @@
         
 
-
+  
+         
+    def onselect(self,event1, event2):
+        print"went here"
+        from matplotlib.widgets import RectangleSelector
+        from pylab import  show, gca, gcf
+
+        'event1 and event2 are the press and release events'
+        x1, y1 = event1.xdata, event1.ydata
+        x2, y2 = event2.xdata, event2.ydata
+        print "(%3.2f, %3.2f) --> (%3.2f, %3.2f)"%(x1,y1,x2,y2)
+        print " The button you used were: ",event1.button, event2.button
+        gca().set_xlim([x1,x2])
+        gca().set_ylim([y1,y2])
+        gcf().canvas.draw_idle()
+       
+        # drawtype is 'box' or 'line' or 'none'
+        LS = RectangleSelector(self.subplot, onselect,drawtype='box',useblit=True)
+        show()
+
+
+
+        
     def onSaveImage(self, evt):
         #figure.savefig
@@ -241,6 +265,5 @@
         self.subplot.clear()
         self.subplot.hold(True)
-
-
+	
     def render(self):
         """Commit the plot after all objects are drawn"""
@@ -330,7 +353,10 @@
         list =[]
         list = self.graph.returnPlottable()
+        
         for item in list:
+            item.getTransform(self.xscales,self.yscales)
             if ( self.xscales=="x" ):
-                item.transform_x( transform.toX,transform.errToX )
+                item.returnTransformationx(transform.toX,transform.errToX)
+                
                 self.set_xscale("linear")
                 name, units = item.get_xaxis()
@@ -338,5 +364,5 @@
                 
             if ( self.xscales=="x^(2)" ):
-                item.transform_x( transform.toX2,transform.errToX2 )
+                item.returnTransformationx(transform.toX2,transform.errToX2)
                 self.set_xscale('linear')
                 name, units = item.get_xaxis()
@@ -344,18 +370,18 @@
                 
             if (self.xscales=="log10(x)" ):
-                item.transform_x( transform.toX, transform.errToX )
+                item.returnTransformationx(transform.toX,transform.errToX)
                 self.set_xscale("log")
-                name, units = item.get_xaxis()
-                item.check_data_PlottableX() 
+                name, units = item.get_xaxis() 
                 self.graph.xaxis("Log10 %s" % name,  "%s^{-1}" % units)
                 
             if ( self.yscales=="ln(y)" ):
-                item.transform_y( transform.toLogX, transform.errToLogX )
-                self.set_yscale("linear")
-                name, units = item.get_yaxis()
+                item.returnTransformationy(transform.toLogX,transform.errToLogX)
+                self.set_yscale("linear")
+                name, units = item.get_yaxis()
+                item.check_data_PlottableY() 
                 self.graph.yaxis("log %s" % name,  "%s^{-1}" % units)
                 
             if ( self.yscales=="y" ):
-                item.transform_y( transform.toX, transform.errToX )
+                item.returnTransformationy(transform.toX,transform.errToX)
                 self.set_yscale("linear")
                 name, units = item.get_yaxis()
@@ -363,30 +389,31 @@
                 
             if ( self.yscales=="log10(y)" ): 
-                item.transform_y( transform.toX, transform.errToLogX)
+                item.returnTransformationy(transform.toX,transform.errToX)
+                item.check_data_PlottableY() 
                 self.set_yscale("log")  
                 name, units = item.get_yaxis()
+                self.graph.yaxis("Log10 %s" % name,  "%s^{-1}" % units)
+                
+            if ( self.yscales=="y^(2)" ):
+                item.returnTransformationy( transform.toX2,transform.errToX2 )    
+                self.set_yscale("linear")
+                name, units = item.get_yaxis()
+                self.graph.yaxis("%s^2" % name,  "%s^{-2}" % units)
+                
+            if ( self.yscales =="1/y"):
+                item.returnTransformationy(transform.toOneOverX,transform.errOneOverX )
+                self.set_yscale("linear")
+                name, units = item.get_yaxis()
+                self.graph.yaxis("%s" % name,  "%s" % units)
+                
+            if ( self.yscales =="1/sqrt(y)" ):
+                item.returnTransformationy(transform.toOneOverSqrtX,transform.errOneOverSqrtX )
+                self.set_yscale("linear")
+                name, units = item.get_yaxis()
                 item.check_data_PlottableY() 
-                self.graph.yaxis("Log10 %s" % name,  "%s^{-1}" % units)
-                
-            if ( self.yscales=="y^(2)" ):
-                item.transform_y( transform.toX2, transform.errToX2 )    
-                self.set_yscale("linear")
-                name, units = item.get_yaxis()
-                self.graph.yaxis("%s^2" % name,  "%s^{-2}" % units)
-                
-            if ( self.yscales =="1/y"):
-                item.transform_y( transform.toOneOverX , transform.errOneOverX )
-                self.set_yscale("linear")
-                name, units = item.get_yaxis()
-                self.graph.yaxis("%s" % name,  "%s" % units)
-                
-            if ( self.yscales =="1/sqrt(y)" ):
-                item.transform_y( transform.toOneOverSqrtX ,transform.errOneOverSqrtX )
-                self.set_yscale("linear")
-                name, units = item.get_yaxis()
                 self.graph.yaxis("%s" %name,  "%s" % units)
                 
             if ( self.yscales =="ln(y*x)"):
-                item.transform_y( transform.toLogXY ,transform.errToLogXY )
+                item.returnTransformationy( transform.toLogXY,transform.errToLogXY)
                 self.set_yscale("linear")
                 yname, yunits = item.get_yaxis()
@@ -395,12 +422,13 @@
                 
             if ( self.yscales =="ln(y*x^(2))"):
-                item.transform_y( transform.toLogYX2 ,transform.errToLogYX2 )
+                item.returnTransformationy( transform.toLogYX2,transform.errToLogYX2)
                 self.set_yscale("linear")
                 yname, yunits = item.get_yaxis()
                 xname, xunits = item.get_xaxis()
+                item.check_data_PlottableY() 
                 self.graph.yaxis("Log %s%s^{2}" % (yname,xname),  "%s^{-1}%s^{-2}" % (yunits,xunits))
             
             if ( self.yscales =="ln(y*x^(4))"):
-                item.transform_y( transform.toLogYX4 ,transform.errToLogYX4 )
+                item.returnTransformationy(transform.toLogYX4,transform.errToLogYX4)
                 self.set_yscale("linear")
                 yname, yunits = item.get_yaxis()
@@ -409,22 +437,21 @@
             
             if ( self.viewModel == "Guinier lny vs x^(2)"):
-                
-                item.transform_x( transform.toX2,transform.errToX2 )
+                item.returnTransformationx(transform.toX2,transform.errToX2)
                 self.set_xscale('linear')
                 name, units = item.get_xaxis()
                 self.graph.xaxis("%s^{2}" % name,  "%s^{-2}" % units)
-                
-                item.transform_y( transform.toLogX, transform.errToLogX )
+                item.returnTransformationy(transform.toLogX,transform.errToLogX )
                 self.set_yscale("linear")
                 name, units = item.get_yaxis()
                 self.graph.yaxis("$Log %s$" % name,  "%s^{-1}" % units)
+                
         #item.name = self.yscales+" vs " +self.xscales      
         self.prevXtrans = self.xscales 
         self.prevYtrans = self.yscales  
-        
+        item.transformView()
         self.graph.render(self)
         self.subplot.figure.canvas.draw_idle()
         
-    def onFitDisplay(self, plottable,xmin,xmax):
+    def onFitDisplay(self, plottable):
         """
             Add a new plottable into the graph .In this case this plottable will be used 
@@ -432,26 +459,6 @@
             @param plottable: the plottable to plot
         """
-        list =[]
-        tempx=[]
-        tempy=[]
-        tempdx=[]
-        tempdy=[]
-        #Stored plotted plottable in a new plottable 
-        list = self.graph.returnPlottable()
-        if len(list.keys())>0:
-            for item in list:
-                if self.graph.isPlotted(item)== True:
-                    x,y,dx,dy = item.returnValuesOfView()
-                    if((min(x) < xmin )and( max(x) > xmax ))\
-                        or ((min(x) <= xmin )and( max(x) > xmax ))\
-                        or((min(x) < xmin )and( max(x) >= xmax )):
-                        print"went here"
-                        item.reducedXrange(xmin,xmax)
-                    else:
-                         item.originalXrange()
-            
-        
         #Add the data to fit 
-        plottable.reset_view()
+       
         self.graph.add(plottable)
         self.graph.render(self)
@@ -459,8 +466,7 @@
         self.subplot.figure.canvas.draw_idle()
         self.graph.delete(plottable)
-    
-      
-    
-    
+   
+
+        
 class NoRepaintCanvas(FigureCanvasWxAgg):
     """We subclass FigureCanvasWxAgg, overriding the _onPaint method, so that
Index: guitools/canvas.py
===================================================================
--- guitools/canvas.py	(revision 2bf92f2eb410d943f4de97881e7615508e97dcb9)
+++ guitools/canvas.py	(revision f193585958b4a7d32fd27d957003d126d30798d3)
@@ -2,4 +2,5 @@
 from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg, _convert_agg_to_wx_bitmap
 from matplotlib.backends.backend_agg import FigureCanvasAgg
+from matplotlib.backend_bases import MouseEvent
 
 class FigureCanvas(FigureCanvasWxAgg):
@@ -19,4 +20,7 @@
         # doesn't behave as nicely.
         self.idletimer = wx.CallLater(1,self._onDrawIdle)
+        # Support for mouse wheel
+        self.Bind(wx.EVT_MOUSEWHEEL, self._onMouseWheel)
+
 
     def draw_idle(self, *args, **kwargs):
@@ -46,4 +50,34 @@
         else:
             self._isRendered = False
+    def _onMouseWheel(self, evt):
+        """Translate mouse wheel events into matplotlib events"""
+        # Determine mouse location
+        x = evt.GetX()
+        y = self.figure.bbox.height - evt.GetY()
+
+        # Convert delta/rotation/rate into a floating point step size
+        delta = evt.GetWheelDelta()
+        rotation = evt.GetWheelRotation()
+        rate = evt.GetLinesPerAction()
+        #print "delta,rotation,rate",delta,rotation,rate
+        step = rate*float(rotation)/delta
+
+        # Convert to mpl event
+        evt.Skip()
+        self.scroll_event(x, y, step, guiEvent=evt)
+
+    def scroll_event(self, x, y, step=1, guiEvent=None):
+        """
+        Backend derived classes should call this function on any
+        scroll wheel event.  x,y are the canvas coords: 0,0 is lower,
+        left.  button and key are as defined in MouseEvent
+        """
+        button = 'up' if step >= 0 else 'down'
+        self._button = button
+        s = 'scroll_event'
+        event = MouseEvent(s, self, x, y, button, self._key, guiEvent=guiEvent)
+        setattr(event,'step',step)
+        self.callbacks.process(s, event)
+
 
     def _onPaint(self, evt):
@@ -64,3 +98,3 @@
 
         evt.Skip()
-
+   
Index: guitools/fitDialog.py
===================================================================
--- guitools/fitDialog.py	(revision 46693050028c8773bd9ec53565a861a613eb4b46)
+++ guitools/fitDialog.py	(revision f193585958b4a7d32fd27d957003d126d30798d3)
@@ -140,5 +140,6 @@
         self.file_data1 = Theory1D(x=[], y=[], dy=None)
         self.file_data1.name = "Fit"
-        
+        # Receive transformations of x and y
+        self.xtrans,self.ytrans= self.transform()
     def _onFit(self ,event):
         """
@@ -152,6 +153,4 @@
         tempdy = []
         
-        #Check if the field of Fit Dialog contain values and use the x max and min of the user
-        xmin,xmax = self._checkVal(self.FXmin.GetValue(),self.FXmax.GetValue())
         #store the values of View in x,y, dx,dy
         x,y,dx,dy=self.plottable.returnValuesOfView()
@@ -162,92 +161,107 @@
         # makes transformation for y as a line to fit
         if x != []: 
-            xminView=self.floatTransform(xmin)
-            xmaxView=self.floatTransform(xmax)
-        
-            # Store the transformed values of view x, y,dy in variables  before the fit
-            if  self.ytrans.lower() == "log10(y)":
-                for y_i in y:
-                    tempy.append(math.log10(y_i)) 
-            else:
-                tempy = y
-            if  self.xtrans.lower() == "log10(x)":
-                for x_i in x:
-                    tempx.append(math.log10(x_i)) 
-            else:
-                tempx = x
-                   
-            for y_i in y:
-                dy = 1/y_i
-                if dy >= y_i:
-                    dy = 0.9*y_i
-                tempdy.append(dy)
-                   
-            #Find the fitting parameters
-            chisqr, out, cov = fittings.sansfit(self.model, 
-                            [self.cstA, self.cstB],tempx, tempy,tempdy,xminView,xmaxView)
+            if(self.checkFitValues(self.FXmin) == True):
+                #Check if the field of Fit Dialog contain values and use the x max and min of the user
+                xmin,xmax = self._checkVal(self.FXmin.GetValue(),self.FXmax.GetValue())
+                xminView=self.floatTransform(xmin)
+                xmaxView=self.floatTransform(xmax)
+                
+                # Store the transformed values of view x, y,dy in variables  before the fit
+                if  self.ytrans.lower() == "log10(y)":
+                    if (self.xtrans.lower() == "log10(x)"):
+                        for i in range(len(x)):
+                            if x[i]>=xmin:
+                                tempy.append(math.log10(y[i])) 
+                                tempdy.append(transform.errToLogX(y[i],0,dy[i],0))
+                    else:
+                        for y_i in y:
+                            tempy.append(math.log10(y_i)) 
+                            tempdy.append(transform.errToLogX(y[i],0,dy[i],0))
+                else:
+                    tempy = y
+                    tempdy = dy
+               
+                if (self.xtrans.lower() == "log10(x)"):
+                    for x_i in x:
+                        if x_i >= xmin:
+                            tempx.append(math.log10(x_i)) 
+                else:
+                    tempx = x
+                       
+                #for y_i in y:
+                #    dy = math.sqrt(math.fabs(y_i))
+                #    if dy >= y_i:
+                #        dy = 0.9*y_i
+                #    tempdy.append(dy)
+                       
+                #Find the fitting parameters
+
+                chisqr, out, cov = fittings.sansfit(self.model, 
+                                [self.cstA, self.cstB],tempx, tempy,tempdy,xminView,xmaxView)
+                print "this out",out
+                #Check that cov and out are iterable before displaying them
+                if cov ==None:
+                    errA =0.0
+                    errB =0.0
+                else:
+                    errA= math.sqrt(cov[0][0])
+                    errB= math.sqrt(cov[1][1])
+                if out==None:
+                    cstA=0.0
+                    cstB=0.0
+                else:
+                    cstA=out[0]
+                    cstB=out[1]
+                # Reset model with the right values of A and B 
+                self.model.setParam('A', float(cstA))
+                self.model.setParam('B', float(cstB))
+                
+                tempx = []
+                tempy = []
+                y_model = 0.0
+                # load tempy with the minimum transformation
+               
+                if self.xtrans == "log10(x)":
+                    y_model = self.model.run(math.log10(xmin))
+                    tempx.append(xmin)
+                else:
+                    y_model = self.model.run(xminView)
+                    tempx.append(xminView)
+                    
+                if self.ytrans == "log10(y)":
+                    tempy.append(math.pow(10,y_model))
+                    print "tempy",tempy
+                else:
+                    tempy.append(y_model)
+                    
+                # load tempy with the maximum transformation
+                if self.xtrans == "log10(x)":
+                    y_model = self.model.run(math.log10(xmax))
+                    tempx.append(xmax)
+                else:
+                    y_model = self.model.run(xmaxView)
+                    tempx.append(xmaxView)
+                    
+                if self.ytrans == "log10(y)":
+                    tempy.append(math.pow(10,y_model))
+                else: 
+                    tempy.append(y_model)
+              
+                # Create new data plottable with result
+                self.file_data1.x =[] 
+                self.file_data1.y =[] 
+                self.file_data1.x =tempx  
+                self.file_data1.y =tempy     
+                self.file_data1.dx=None
+                self.file_data1.dy=None
+                #Load the view with the new values
+                self.file_data1.reset_view()
+                
+                #Send the data to display to the PlotPanel
+                self.push_data(self.file_data1)
+                
+                # Display the fitting value on the Fit Dialog
+                self._onsetValues(cstA, cstB, errA,errB,chisqr)
             
-            #Check that cov and out are iterable before displaying them
-            if cov ==None:
-                errA =0.0
-                errB =0.0
-            else:
-                errA= math.sqrt(cov[0][0])
-                errB= math.sqrt(cov[1][1])
-            if out==None:
-                cstA=0.0
-                cstB=0.0
-            else:
-                cstA=out[0]
-                cstB=out[1]
-            # Reset model with the right values of A and B 
-            self.model.setParam('A', float(cstA))
-            self.model.setParam('B', float(cstB))
-            
-            tempx = []
-            tempy = []
-            y_model = 0.0
-            # load tempy with the minimum transformation
-           
-            if self.xtrans == "log10(x)":
-                y_model = self.model.run(math.log10(xmin))
-                tempx.append(xmin)
-            else:
-                y_model = self.model.run(xminView)
-                tempx.append(xminView)
-                
-            if self.ytrans == "log10(y)":
-                tempy.append(math.pow(10,y_model))
-            else:
-                tempy.append(y_model)
-                
-            # load tempy with the maximum transformation
-            if self.xtrans == "log10(x)":
-                y_model = self.model.run(math.log10(xmax))
-                tempx.append(xmax)
-            else:
-                y_model = self.model.run(xmaxView)
-                tempx.append(xmaxView)
-                
-            if self.ytrans == "log10(y)":
-                tempy.append(math.pow(10,y_model))
-            else: 
-                tempy.append(y_model)
-          
-            # Create new data plottable with result
-            self.file_data1.x =[] 
-            self.file_data1.y =[] 
-            self.file_data1.x =tempx  
-            self.file_data1.y =tempy     
-            self.file_data1.dx=None
-            self.file_data1.dy=None
-            #Load the view with the new values
-            self.file_data1.reset_view()
-            
-            #Send the data to display to the PlotPanel
-            self.push_data(self.file_data1,xminView, xmaxView)
-            
-            # Display the fitting value on the Fit Dialog
-            self._onsetValues(cstA, cstB, errA,errB,chisqr)
-   
     def _onsetValues(self,cstA,cstB,errA,errB,Chi):
          """
@@ -291,5 +305,5 @@
             return transform.toX(x)
         
-        if ( self.xtrans=="x^(2)" ):
+        if ( self.xtrans=="x^(2)" ): 
             return transform.toX2(x)
         
@@ -299,4 +313,22 @@
             else:
                 raise ValueError,"cannot compute log of a negative number"
+            
+    def checkFitValues(self,item):
+        """
+            Check the validity of input values
+        """
+        flag = True
+        value = item.GetValue()
+        # Check for possible values entered
+        if (self.xtrans=="log10(x)"):
+            if (float(value) > 0):
+                item.SetBackgroundColour(wx.WHITE)
+                item.Refresh()
+            else:
+                flag = False
+                item.SetBackgroundColour("pink")
+                item.Refresh()
+      
+        return flag
        
                 
Index: guitools/plottables.py
===================================================================
--- guitools/plottables.py	(revision 46693050028c8773bd9ec53565a861a613eb4b46)
+++ guitools/plottables.py	(revision f193585958b4a7d32fd27d957003d126d30798d3)
@@ -42,4 +42,5 @@
 import copy
 import numpy
+import math
 
 if 'any' not in dir(__builtins__):
@@ -181,4 +182,5 @@
         else:
             self.color =0 
+            
 
     def reset(self):
@@ -361,5 +363,8 @@
     ##Use the following if @classmethod doesn't work
     # labels = classmethod(labels)
-
+    def getTransform(self,transx,transy):
+        self.view.transx = transx
+        self.view.transy = transy
+        
     def __init__(self):
         self.view = View()
@@ -417,14 +422,16 @@
         
     def returnValuesOfView(self):
-        
         return self.view.returnXview()
+    
     def check_data_PlottableX(self): 
         self.view.check_data_logX()
+        
     def check_data_PlottableY(self): 
         self.view.check_data_logY() 
-    def originalXrange(self):
-        self.view.reelXrange()
-    def reducedXrange(self,min,max):
-        self.view.reduceXrange(min, max)
+    def returnTransformationx(self,transx,transdx):
+        self.view.returntransformx(transx,transdx)
+    def returnTransformationy(self,transy,transdy):
+        self.view.returntransformy(transy,transdy)
+   
     class View:
         """
@@ -447,5 +454,11 @@
             self.DXreel = self.dx
             self.DYreel = self.dy
-           
+            self.transx =""
+            self.transy =""
+            self.funcx= None
+            self.funcy= None
+            self.funcdx= None
+            self.funcdy= None
+    
         def transform_x(self, func, errfunc, x,y=None,dx=None, dy=None):
             """
@@ -474,11 +487,14 @@
             self.x = []
             self.dx = []
-            
+            tempy=[]
+            tempdy=[]
+            print "this is initial value of y transformed",self.y
+            print "this is initial value of dy transformed",self.dy
             for i in range(len(x)):
                 if has_y:
                      try:
                          xtemp = func(x[i],y[i])
-                         
-                         
+                         tempy.append(self.funcy.y[i])
+                         tempdy.append(self.funcdy.dy[i])
                          if (dx!=None) and (dy !=None):
                              dxtemp = errfunc(x[i], y[i], dx[i], dy[i])
@@ -489,20 +505,17 @@
                          else:
                              dxtemp = errfunc(x[i],y[i],0, 0)
-                         
                          self.x.append(xtemp)
-                         self.dx.append(dxtemp)
-                         self.Xreel = []
-                         self.DXreel=[]
-                         self.Xreel = self.x
-                         self.DXreel = self.dx
-                         
+                         self.dx.append(dxtemp)  
                      except:
+                         if len(tempy)>0:
+                             del tempy[len(tempy)-1]
+                             del tempdy[len(tempdy)-1]
                          print "View.transform_x: skipping point %g" % x[i]
-                         print sys.exc_value
-                         
-                         
+                         print sys.exc_value   
                 else:
                     try:
                         xtemp = func(x[i])
+                        tempy.append(self.funcy.y[i])
+                        tempdy.append(self.funcdy.dy[i])
                         if (dx != None):
                             dxtemp = errfunc(x[i], dx[i])
@@ -510,15 +523,22 @@
                             dxtemp = errfunc(x[i],None)  
                         self.x.append(xtemp)
-                        self.dx.append(dxtemp)
-                        self.Xreel = []
-                        self.DXreel=[]
-                        self.Xreel = self.x
-                        self.DXreel = self.dx
-                         
+                        self.dx.append(dxtemp) 
                     except:
+                         if len(tempy)>0:
+                             del tempy[len(tempy)-1]
+                             del tempdy[len(tempdy)-1]
                          print "View.transform_x: skipping point %g" % x[i]
                          print sys.exc_value
-                    
-                         
+            self.y=tempy
+            self.dy=tempdy
+            self.Xreel = []
+            self.DXreel=[]
+        def returntransformx(self,funcx,funcdx):    
+            self.funcx= funcx
+            self.funcdx= funcdx
+            
+        def returntransformy(self,funcy,funcdy):    
+            self.funcy= funcy
+            self.funcdy= funcdy
         def transform_y(self, func, errfunc, y, x=None,dx=None,dy=None):
             """
@@ -547,5 +567,8 @@
             self.y = []
             self.dy = []
-           
+            tempx=[]
+            tempdx=[]
+            print "this is initial value of x transformed",self.x
+            print "this is initial value of dx transformed",self.dx
             for i in range(len(y)):
                 
@@ -553,4 +576,6 @@
                      try:
                          tempy = func(y[i],x[i])
+                         tempx.append(self.funcx.x[i])
+                         tempdx.append(self.funcdx.x[i])
                          if (dx!=None) and (dy !=None):
                              tempdy = errfunc(y[i], x[i], dy[i], dx[i])
@@ -563,9 +588,8 @@
                          self.y.append(tempy)
                          self.dy.append(tempdy)
-                         self.Yreel = []
-                         self.DYreel=[]
-                         self.Yreel = self.y
-                         self.DYreel = self.dy
                      except:
+                         if len(tempx)>0:
+                             del tempx[len(tempx)-1]
+                             del tempdx[len(tempdx)-1]
                          print "View.transform_y: skipping point %g" % y[i]
                          print sys.exc_value
@@ -574,4 +598,6 @@
                      try:
                          tempy = func(y[i])
+                         tempx.append(self.funcx.x[i])
+                         tempdx.append(self.funcdx.dx[i])
                          if (dy != None):
                              tempdy = errfunc( y[i],dy[i])
@@ -579,73 +605,26 @@
                              tempdy = errfunc( y[i],None)
                          self.y.append(tempy)
-                         self.dy.append(tempdy)
-                         self.Yreel = []
-                         self.DYreel=[]
-                         self.Yreel = self.y
-                         self.DYreel = self.dy
+                         self.dy.append(tempdy)   
                      except:
+                          if len(tempx)>0:
+                              del tempx[len(tempx)-1]
+                              del tempdx[len(tempdx)-1]
                           print "View.transform_y: skipping point %g" % y[i]
                           print sys.exc_value
-                          
-
-            
+                    
+            self.x = tempx
+            self.dx = tempdx
+            self.Yreel = []
+            self.DYreel=[]
+            self.Yreel = self.y
+            self.DYreel = self.dy
+            print "this is x length",self.x
+            print "this is y length",self.y
+            print "this is dx length",self.dx
+            print "this is dy length",self.dy
         def returnXview(self):
             return self.x,self.y,self.dx,self.dy
         
-        def checkMin(self,x,min,pos=None):
-            if pos==None:
-                pos=0
-                for i in range(len(self.x)):
-                    if not min in x:# The user enters a value not in x
-                        if x[i] > min:
-                            index= i-1
-                            print "this is index",index
-                            return index1
-                    else:
-                         index=i
-                         print"the user enter a value inside x",index
-                         return index
-            else:
-                index= pos
-                return index
-            
-        def checkMax(self,x,max,pos=None):
-            if pos==None:
-                pos=0
-                for i in range(len(self.x)):
-                    if not max in x:# The user enters a value not in x
-                        if x[i] >max:
-                           
-                            index= i-1
-                            return index
-                    else:
-                         index=i
-                         return index
-            else:
-                index= pos
-                return index
-              
-        def reduceXrange(self,min,max):
-            
-            # to change the x range to the user range
-            self.Xscale = []
-            self.Yscale = []
-            self.DXscale = []
-            self.DYscale = []
-            indexmin =self.checkMin(self.x,min,None)
-            indexmax =self.checkMin(self.x,max,None)
-            for i in range(len(self.x)):
-                if( self.x[i] >=self.x[indexmin])and( self.x[i] <= max):
-                    self.Xscale.append(self.x[i])
-                    self.Yscale.append(self.y[i])
-                    self.DXscale.append(self.dx[i])
-                    self.DYscale.append(self.dy[i])
-            print self.Xscale
-            self.x= self.Xscale  
-            self.y= self.Yscale
-            self.dx= self.DXscale
-            self.dy= self.DYscale
-        
-            
+     
         def reelXrange(self):
             self.x= self.Xreel
@@ -653,5 +632,4 @@
             self.dx= self.DXreel
             self.dy= self.DYreel
-           
         
         def check_data_logX(self): 
@@ -660,9 +638,34 @@
             tempy=[]
             tempdy=[]
-        
-            for i in range(len(self.x)):
+            if self.transx=="log10(x)" :
+                for i in range(len(self.x)):
+                    try:
+                        if (self.x[i]> 0):
+                           
+                            tempx.append(self.x[i])
+                            tempdx.append(self.dx[i])
+                            tempy.append(self.y[i])
+                            tempdy.append(self.dy[i])
+                    except:
+                        #print "View.transform_x: skipping point %g" %self.x[i]
+                        print sys.exc_value  
+                        pass 
+            if (self.transx == "x"):   
+                if (self.transy == "ln(y*x)"):
+                        try:
+                            if (self.y[i]*self.x[i]> 0):
+                                tempx.append(self.x[i])
+                                tempdx.append(self.dx[i])
+                                tempy.append(self.y[i])
+                                tempdy.append(self.dy[i])
+                        except:
+                            #print "View.transform_x: skipping point %g" %self.x[i]
+                            print sys.exc_value  
+                            pass
+            if(self.transy =="ln(y*x^(2))")or(self.transy =="ln(y*x^(4))"):
+                print "this is y transform",self.y
+                print "this is x transform",self.x
                 try:
-                    if (self.x[i]> 0):
-                       
+                    if (self.y[i]> 0 )and (self.x[i]!=0):
                         tempx.append(self.x[i])
                         tempdx.append(self.dx[i])
@@ -672,6 +675,5 @@
                     #print "View.transform_x: skipping point %g" %self.x[i]
                     print sys.exc_value  
-                    pass     
-                
+                    pass
             self.x=[]
             self.dx=[]
@@ -682,4 +684,5 @@
             self.dx=tempdx
             self.dy=tempdy
+            
         def check_data_logY(self): 
             tempx=[]
@@ -687,9 +690,45 @@
             tempy=[]
             tempdy=[]
-        
             for i in range(len(self.x)):
+                if (self.transy == "ln(y)") or (self.transy == "log10(y)" )or\
+                     (self.transy =="1/sqrt(y)") :
+                     try:
+                        if (self.y[i]> 0):
+                            tempx.append(self.x[i])
+                            tempdx.append(self.dx[i])
+                            tempy.append(self.y[i])
+                            tempdy.append(self.dy[i])
+                     except:
+                        #print "View.transform_x: skipping point %g" %self.x[i]
+                        print sys.exc_value  
+                        pass
+                if(self.transy == "1/y"):
+                    try:
+                        if (self.y[i]!=0):
+                            tempx.append(self.x[i])
+                            tempdx.append(self.dx[i])
+                            tempy.append(self.y[i])
+                            tempdy.append(self.dy[i])
+                    except:
+                        #print "View.transform_x: skipping point %g" %self.x[i]
+                        print sys.exc_value  
+                        pass  
+            if (self.transx == "x"):   
+                if (self.transy == "ln(y*x)"):
+                        try:
+                            if (self.y[i]*self.x[i]> 0):
+                                tempx.append(self.x[i])
+                                tempdx.append(self.dx[i])
+                                tempy.append(self.y[i])
+                                tempdy.append(self.dy[i])
+                        except:
+                            #print "View.transform_x: skipping point %g" %self.x[i]
+                            print sys.exc_value  
+                            pass
+            if(self.transy =="ln(y*x^(2))")or(self.transy =="ln(y*x^(4))"):
+                print "this is y transform",self.y
+                print "this is x transform",self.x
                 try:
-                    if (self.y[i]> 0):
-                       
+                    if (self.y[i]> 0 )and (self.x[i]!= 0):
                         tempx.append(self.x[i])
                         tempdx.append(self.dx[i])
@@ -699,5 +738,5 @@
                     #print "View.transform_x: skipping point %g" %self.x[i]
                     print sys.exc_value  
-                    pass     
+                    pass
                 
             self.x=[]
@@ -735,5 +774,5 @@
     def render(self,plot,**kw):
         plot.points(self.view.x,self.view.y,dx=self.view.dx,dy=self.view.dy,**kw)
-        #plot.points(self.x,self.y,dx=self.dx,dy=self.dy,**kw)
+     
    
     def changed(self):
Index: guitools/transform.py
===================================================================
--- guitools/transform.py	(revision 46693050028c8773bd9ec53565a861a613eb4b46)
+++ guitools/transform.py	(revision f193585958b4a7d32fd27d957003d126d30798d3)
@@ -43,5 +43,5 @@
     else:
         raise ValueError,"cannot divide by zero"
-def toOneOverSqrtX(x=None,y=None):
+def toOneOverSqrtX(y , x=None):
     if y!=None:
         if y > 0:
@@ -49,11 +49,7 @@
         else:
             raise ValueError,"cannot be computed"
-    if x!= None:
-        if x > 0:
-            return 1/math.sqrt(x)
-        else:
-            raise ValueError,"cannot be computed"
-    
-def toLogYX2(x,y):
+    
+    
+def toLogYX2(y,x):
     if y*(x**2) >0:
         return math.log(y*(x**2))
@@ -62,9 +58,9 @@
      
 
-def toLogYX4(x, y):
+def toLogYX4(y, x):
     if math.pow(x,4)*y > 0:
         return math.log(math.pow(x,4)*y)
 
-def toLogXY(x,y):
+def toLogXY(y,x):
     """
         This function is used to load value on Plottable.View
@@ -85,4 +81,6 @@
         @param dx: float value
     """
+    if dx==None:
+        dx=0
     return dx
 
