Index: DataLoader/readers/DataReader.py
===================================================================
--- DataLoader/readers/DataReader.py	(revision bb037397e81f6fff27c38198e299108d7d53424e)
+++ 	(revision )
@@ -1,169 +1,0 @@
-import os, sys
-import pylab
-from copy import deepcopy
-import math
-class Reader:
-    """ Simple data reader for Igor data files """
-    
-    def __init__(self, filename=None):
-        """ Init
-            @param filename: Name of Igor data file to read
-        """
-        self.file = filename
-        self.x = []
-        self.y = []
-        self.image = []
-        
-        # Detector info
-        self.wavelength = 0.0
-        self.distance   = 0.0
-        self.center_x   = 63.5
-        self.center_y   = 63.5
-        
-    def read(self,filename=None):
-        """ Read file """
-        # Check if the file is there
-        self.file=filename
-        if not os.path.isfile(self.file):
-            raise ValueError, \
-            "Specified file %s is not a regular file" % self.file
-        
-        # Read file
-        f = open(self.file,'r')
-        buf = f.read()
-        
-        # Get content
-        dataStarted = False
-        
-        
-        lines = buf.split('\n')
-        itot = 0
-        self.x = []
-        self.y = []
-        self.image = []
-        
-        ncounts = 0
-        
-        #x = pylab.arange(0, 128, 1)
-        #y = pylab.arange(0, 128, 1)
-        x = pylab.arange(-.5, .5, 1.0/128)
-        y = pylab.arange(-.5, .5, 1.0/128)
-        X, Y = pylab.meshgrid(x, y)
-        Z = deepcopy(X)
-        
-        xmin = None
-        xmax = None
-        ymin = None
-        ymax = None
-        
-        i_x = 0
-        i_y = -1
-        
-        isInfo = False
-        isCenter = False
-        for line in lines:
-            
-            # Find setup info line
-            if isInfo:
-                isInfo = False
-                line_toks = line.split()
-                # Wavelength in Angstrom
-                try:
-                    wavelength = float(line_toks[1])
-                except:
-                    raise ValueError,"DataReader: can't read this file, missing wavelength"
-                # Distance in meters
-                try:
-                    distance = float(line_toks[3])
-                except:
-                    raise ValueError,"DataReader: can't read this file, missing distance"
-                
-            if line.count("LAMBDA")>0:
-                isInfo = True
-                
-            # Find center info line
-            if isCenter:
-                isCenter = False                
-                line_toks = line.split()
-                # Center in bin number
-                center_x = float(line_toks[0])
-                center_y = float(line_toks[1])
-
-            if line.count("BCENT")>0:
-                isCenter = True
-                
-        
-            # Find data start
-            if line.count("***")>0:
-                dataStarted = True
-                
-                # Check that we have all the info
-                if wavelength == None \
-                    or distance == None \
-                    or center_x == None \
-                    or center_y == None:
-                    raise ValueError, "Missing information in data file"
-                
-            if dataStarted == True:
-                try:
-                    value = float(line)
-                except:
-                    continue
-                
-                # Get bin number
-                if math.fmod(itot, 128)==0:
-                    i_x = 0
-                    i_y += 1
-                else:
-                    i_x += 1
-                    
-                Z[i_y][i_x] = value
-                ncounts += 1 
-                
-                # Det 640 x 640 mm
-                # Q = 4pi/lambda sin(theta/2)
-                # Bin size is 0.5 cm
-                theta = (i_x-center_x+1)*0.5 / distance / 100.0
-                qx = 4.0*math.pi/wavelength * math.sin(theta/2.0)
-                if xmin==None or qx<xmin:
-                    xmin = qx
-                if xmax==None or qx>xmax:
-                    xmax = qx
-                
-                theta = (i_y-center_y+1)*0.5 / distance / 100.0
-                qy = 4.0*math.pi/wavelength * math.sin(theta/2.0)
-                if ymin==None or qy<ymin:
-                    ymin = qy
-                if ymax==None or qy>ymax:
-                    ymax = qy
-                
-                
-                if not qx in self.x:
-                    self.x.append(qx)
-                if not qy in self.y:
-                    self.y.append(qy)
-                
-                itot += 1
-                  
-                  
-        theta = 0.25 / distance / 100.0
-        xstep = 4.0*math.pi/wavelength * math.sin(theta/2.0)
-        
-        theta = 0.25 / distance / 100.0
-        ystep = 4.0*math.pi/wavelength * math.sin(theta/2.0)
-        
-        # Store q max 
-        if xmax>ymax:
-            self.qmax = xmax
-        else:
-            self.qmax = ymax
-        
-        #config.printEVT("Read %g points from file %s" % (ncounts, self.file))
-  
-        self.wavelength = wavelength
-        self.distance   = distance*1000.0
-        self.center_x = center_x
-        self.center_y = center_y
-        
-        return Z, xmin-xstep/2.0, xmax+xstep/2.0, ymin-ystep/2.0, ymax+ystep/2.0
-     
Index: DataLoader/readers/IgorReader.py
===================================================================
--- DataLoader/readers/IgorReader.py	(revision c125e0c0a070d9e2df2b41c47a399ab68ac05667)
+++ DataLoader/readers/IgorReader.py	(revision c125e0c0a070d9e2df2b41c47a399ab68ac05667)
@@ -0,0 +1,169 @@
+import os, sys
+import pylab
+from copy import deepcopy
+import math
+class Reader:
+    """ Simple data reader for Igor data files """
+    
+    def __init__(self, filename=None):
+        """ Init
+            @param filename: Name of Igor data file to read
+        """
+        self.file = filename
+        self.x = []
+        self.y = []
+        self.image = []
+        
+        # Detector info
+        self.wavelength = 0.0
+        self.distance   = 0.0
+        self.center_x   = 63.5
+        self.center_y   = 63.5
+        
+    def read(self,filename=None):
+        """ Read file """
+        # Check if the file is there
+        self.file=filename
+        if not os.path.isfile(self.file):
+            raise ValueError, \
+            "Specified file %s is not a regular file" % self.file
+        
+        # Read file
+        f = open(self.file,'r')
+        buf = f.read()
+        
+        # Get content
+        dataStarted = False
+        
+        
+        lines = buf.split('\n')
+        itot = 0
+        self.x = []
+        self.y = []
+        self.image = []
+        
+        ncounts = 0
+        
+        #x = pylab.arange(0, 128, 1)
+        #y = pylab.arange(0, 128, 1)
+        x = pylab.arange(-.5, .5, 1.0/128)
+        y = pylab.arange(-.5, .5, 1.0/128)
+        X, Y = pylab.meshgrid(x, y)
+        Z = deepcopy(X)
+        
+        xmin = None
+        xmax = None
+        ymin = None
+        ymax = None
+        
+        i_x = 0
+        i_y = -1
+        
+        isInfo = False
+        isCenter = False
+        for line in lines:
+            
+            # Find setup info line
+            if isInfo:
+                isInfo = False
+                line_toks = line.split()
+                # Wavelength in Angstrom
+                try:
+                    wavelength = float(line_toks[1])
+                except:
+                    raise ValueError,"IgorReader: can't read this file, missing wavelength"
+                # Distance in meters
+                try:
+                    distance = float(line_toks[3])
+                except:
+                    raise ValueError,"IgorReader: can't read this file, missing distance"
+                
+            if line.count("LAMBDA")>0:
+                isInfo = True
+                
+            # Find center info line
+            if isCenter:
+                isCenter = False                
+                line_toks = line.split()
+                # Center in bin number
+                center_x = float(line_toks[0])
+                center_y = float(line_toks[1])
+
+            if line.count("BCENT")>0:
+                isCenter = True
+                
+        
+            # Find data start
+            if line.count("***")>0:
+                dataStarted = True
+                
+                # Check that we have all the info
+                if wavelength == None \
+                    or distance == None \
+                    or center_x == None \
+                    or center_y == None:
+                    raise ValueError, "IgorReader:Missing information in data file"
+                
+            if dataStarted == True:
+                try:
+                    value = float(line)
+                except:
+                    continue
+                
+                # Get bin number
+                if math.fmod(itot, 128)==0:
+                    i_x = 0
+                    i_y += 1
+                else:
+                    i_x += 1
+                    
+                Z[i_y][i_x] = value
+                ncounts += 1 
+                
+                # Det 640 x 640 mm
+                # Q = 4pi/lambda sin(theta/2)
+                # Bin size is 0.5 cm
+                theta = (i_x-center_x+1)*0.5 / distance / 100.0
+                qx = 4.0*math.pi/wavelength * math.sin(theta/2.0)
+                if xmin==None or qx<xmin:
+                    xmin = qx
+                if xmax==None or qx>xmax:
+                    xmax = qx
+                
+                theta = (i_y-center_y+1)*0.5 / distance / 100.0
+                qy = 4.0*math.pi/wavelength * math.sin(theta/2.0)
+                if ymin==None or qy<ymin:
+                    ymin = qy
+                if ymax==None or qy>ymax:
+                    ymax = qy
+                
+                
+                if not qx in self.x:
+                    self.x.append(qx)
+                if not qy in self.y:
+                    self.y.append(qy)
+                
+                itot += 1
+                  
+                  
+        theta = 0.25 / distance / 100.0
+        xstep = 4.0*math.pi/wavelength * math.sin(theta/2.0)
+        
+        theta = 0.25 / distance / 100.0
+        ystep = 4.0*math.pi/wavelength * math.sin(theta/2.0)
+        
+        # Store q max 
+        if xmax>ymax:
+            self.qmax = xmax
+        else:
+            self.qmax = ymax
+        
+        #config.printEVT("Read %g points from file %s" % (ncounts, self.file))
+  
+        self.wavelength = wavelength
+        self.distance   = distance*1000.0
+        self.center_x = center_x
+        self.center_y = center_y
+        print "IgorReader reading %s"%self.file
+        return Z, xmin-xstep/2.0, xmax+xstep/2.0, ymin-ystep/2.0, ymax+ystep/2.0
+     
Index: DataLoader/readers/TXT2_Reader.py
===================================================================
--- DataLoader/readers/TXT2_Reader.py	(revision aa749ac6a2c4ea5ba4cc8b49129c811d24a69da0)
+++ DataLoader/readers/TXT2_Reader.py	(revision c125e0c0a070d9e2df2b41c47a399ab68ac05667)
@@ -59,9 +59,9 @@
                     #print "went here"
                     #return value
-                    raise ValueError, "TXT2_Reader can't read"
+                    raise ValueError, "TXT2_Reader can't read %s"%path
                 else:
                     #msg="R1 reading: \n"+"this x :"+ str(self.x) +"\n"+"this y:"+str(self.y)+"\n"+"this dy :"+str(self.dy)+"\n"
                     #return msg
-                    print "TXT2_Reader reading \n"
+                    print "TXT2_Reader reading  %s\n" %path
                     return self.x,self.y,self.dy
         return None
Index: DataLoader/readers/TXT3_Reader.py
===================================================================
--- DataLoader/readers/TXT3_Reader.py	(revision aa749ac6a2c4ea5ba4cc8b49129c811d24a69da0)
+++ DataLoader/readers/TXT3_Reader.py	(revision c125e0c0a070d9e2df2b41c47a399ab68ac05667)
@@ -61,9 +61,9 @@
                
                 if (self.x==[] or self.y==[])and (self.dy==[]):
-                    raise ValueError, "TXT3_Reader can't read"
+                    raise ValueError, "TXT3_Reader can't read %s"%path
                 else:
                     #msg="txtReader  Reading:\n"+"this x :"+ str(self.x) +"\n"+"this y:"+str(self.y)+"\n"+"this dy :"+str(self.dy)+"\n"
                     #return msg
-                    print "TXT3_Reader reading: \n"
+                    print "TXT3_Reader reading %s \n" %path
                     return self.x,self.y,self.dy
                 
Index: DataLoader/readers/danse_reader.py
===================================================================
--- DataLoader/readers/danse_reader.py	(revision bb037397e81f6fff27c38198e299108d7d53424e)
+++ DataLoader/readers/danse_reader.py	(revision c125e0c0a070d9e2df2b41c47a399ab68ac05667)
@@ -207,7 +207,7 @@
             if not fversion==1.1:
                 #output.error  = E
-                raise ValueError,"Danse_reader can't read this file"
+                raise ValueError,"Danse_reader can't read this file %s"%filename
             else:
-                print "Danse_reader Reading : \n"
+                print "Danse_reader Reading %s \n"%filename
                 return output
         
Index: DataLoader/test/testLoad.py
===================================================================
--- DataLoader/test/testLoad.py	(revision aa749ac6a2c4ea5ba4cc8b49129c811d24a69da0)
+++ DataLoader/test/testLoad.py	(revision c125e0c0a070d9e2df2b41c47a399ab68ac05667)
@@ -8,41 +8,40 @@
 from DataLoader.loader import  Loader
 from DataLoader.readers import TXT3_Reader,TXT2_Reader
-from DataLoader.readers import DataReader,danse_reader,tiff_reader
+from DataLoader.readers import IgorReader,danse_reader,tiff_reader
 
 class testLoader(unittest.TestCase):
     """ test fitting """
-    def testLoad(self):
-        """ 
-            test module Load
-        """
-        #Creating a loader
-        L=Loader()
-        
-        #creating readers
-        read1=TXT2_Reader.Reader()
-        read2=TXT3_Reader.Reader()
-        read3=DataReader.Reader()
-        read4=danse_reader.Reader()
-        read5=tiff_reader.Reader()
-        #for each readers set an extensions inside the loader
-        L.__setitem__('.txt',read1)
-        L.__setitem__('.dat',read1)
-        L.__setitem__('.txt',read2)
-        L.__setitem__('.dat',read2)
-        L.__setitem__('.ASC',read3)
-        L.__setitem__('.sans',read4)
-        L.__setitem__('.tif',read5)
-        L.__setitem__('.jpg',read5)
-        L.__setitem__('.png',read5)
-        L.__setitem__('.jpeg',read5)
-        L.__setitem__('.gif',read5)
-        L.__setitem__('.bmp',read5)
-        
-        #test reading empty file
-        self.assertEqual(L.load('empty.txt'),None)
+    #Creating a loader
+    L=Loader()
+    
+    #creating readers
+    read1=TXT2_Reader.Reader()
+    read2=TXT3_Reader.Reader()
+    read3=IgorReader.Reader()
+    read4=danse_reader.Reader()
+    read5=tiff_reader.Reader()
+    #for each readers set an extensions inside the loader
+    L.__setitem__('.txt',read2)
+    L.__setitem__('.txt',read1)
+    L.__setitem__('.dat',read1)
+    
+    L.__setitem__('.dat',read2)
+    L.__setitem__('.ASC',read3)
+    L.__setitem__('.sans',read4)
+    L.__setitem__('.tif',read5)
+    L.__setitem__('.jpg',read5)
+    L.__setitem__('.png',read5)
+    L.__setitem__('.jpeg',read5)
+    L.__setitem__('.gif',read5)
+    L.__setitem__('.bmp',read5)
+       
+    def testLoad1(self):
+        """test reading empty file, no file can read it"""
+        self.assertEqual(self.L.load('empty.txt'),None)
+        self.assertEqual( self.L.getAcTReader('empty.txt'),None)
          
-        #print L.loadData('test_2_columns.txt') 
-        xload,yload,dyload=L.load('test_2_columns.txt') 
-        x=[.83954,0.204082,0.408163,0.612245,0.816327,1.02041,1.22449,1.42857,1.63265]
+        #Testing loading a txt file of 2 columns, the only reader should be read1 
+        xload,yload,dyload=self.L.load('test_2_columns.txt') 
+        x=[2.83954,0.204082,0.408163,0.612245,0.816327,1.02041,1.22449,1.42857,1.63265]
         y=[0.6,3.44938, 5.82026,5.27591,5.2781,5.22531,7.47487,7.85852,10.2278]
         dx=[]
@@ -50,8 +49,53 @@
         self.assertEqual(len(xload),len(x))
         self.assertEqual(len(yload),len(y))
-        self.assertEqual( L.getAcTReader('test_2_columns.txt'),DataLoader.readers.TXT2_Reader.Reader)
+        self.assertEqual(len(dyload),0)
+        for i in range(len(x)):
+            self.assertEqual(xload[i],x[i])
+            self.assertEqual(yload[i],y[i])
+        self.assertEqual( self.L.getAcTReader('test_2_columns.txt'),self.read1.__class__)
+    
+    def testLoad2(self):
+        """Testing loading a txt file of 3 columns, the only reader should be read2"""
+        xload,yload,dyload= self.L.load('test_3_columns.txt') 
+        x=[0,0.204082,0.408163,0.612245,0.816327,1.02041,1.22449]    
+        y=[2.83954,3.44938,5.82026,5.27591,5.2781,5.22531,7.47487]
+        dx=[]
+        dy=[0.6,0.676531,0.753061,0.829592,0.906122,0.982653,1.05918]
+        self.assertEqual(len(xload),len(x))
+        self.assertEqual(len(yload),len(y))
+        self.assertEqual(len(dyload),len(dy))
+        for i in range(len(x)):
+            self.assertEqual(xload[i],x[i])
+            self.assertEqual(yload[i],y[i])
+            self.assertEqual(dyload[i],dy[i])
+        self.assertEqual(self.L.getAcTReader('test_3_columns.txt'),self.read2.__class__)
+    
+    def testload3(self):
+        """ Testing loading Igor data"""
+        #tested good file.asc
+        Z,xmin, xmax, ymin, ymax= self.L.load('MAR07232_rest.ASC') 
+        self.assertEqual(xmin,-0.018558945804750416)
+        self.assertEqual(xmax, 0.016234058202440633,)
+        self.assertEqual(ymin,-0.01684257151702391)
+        self.assertEqual(ymax,0.017950440578015116)
+        self.assertEqual(self.L.getAcTReader('MAR07232_rest.ASC'),self.read3.__class__)
+        #tested corrupted file.asc
+        self.assertEqual(self.L.load('AR07232_rest.ASC') ,None)
+    
+    def testload4(self):
+        """ Testing loading danse file"""
+        #tested good file.sans
+        data=self.L.load('MP_New.sans')
+        
+        self.assertEqual(data.__class__,danse_reader.ReaderInfo)
+        self.assertEqual(self.L.getAcTReader('MP_New.sans'),self.read4.__class__)
+        #tested corrupted file.sans
+        self.assertEqual(self.L.load('P_New.sans'),None)
+    
+    def testload5(self):
+        """ Testing loading image file"""
+        data=self.L.load('angles_flat.png')
+        self.assertEqual(data.__class__,tiff_reader.ReaderInfo)
+        self.assertEqual(self.L.getAcTReader('angles_flat.png'),self.read5.__class__)
         
         
-        
-        
-        
