Index: DataLoader/plugins/TXT2_Reader.py
===================================================================
--- DataLoader/plugins/TXT2_Reader.py	(revision 16d8e5fb43348001cacbc6967a6922266e68fe6e)
+++ 	(revision )
@@ -1,131 +1,0 @@
-# class Loader  to load any king of file
-import wx
-import string,numpy
-import logging
-class ReaderInfo:
-    """
-        This class is a container of data. It stores values read from files
-    """
-    ## Wavelength [A]
-    wavelength = 0.0
-    ## Number of x bins
-    xbins = 128
-    ## Number of y bins
-    ybins = 128
-    ## Beam center X [pixel number]
-    center_x = 65
-    ## Beam center Y [pixel number]
-    center_y = 65
-    ## Distance from sample to detector [m]
-    distance = 11.0
-    ## Qx values [A-1]
-    x_vals = []
-    ## Qy xalues [A-1]
-    y_vals = []
-    ## Qx min
-    xmin = 0.0
-    ## Qx max
-    xmax = 1.0
-    ## Qy min
-    ymin = 0.0
-    ## Qy max
-    ymax = 1.0
-    ## Image
-    image = None
-    ## Pixel size
-    pixel_size = 0.5
-    ## x coordinate
-    x=[]
-    ##y coordinate
-    y=[]
-    ##dx error on y
-    dx=None
-    ## dy error on y
-    dy=None
-    ## Error on each pixel
-    error = None
-    ##type of data
-    type=""
-    ##z
-    Z=None
-
-class Reader:
-    """
-        This class is loading values from given file or value giving by the user
-        should be able to read only 2 columns of data
-    """
-    ext=['.txt','.dat'] 
-    def _init_(self,x=None,y=None,dx=None,dy=None):
-        # variable to store loaded values
-        self.x = x
-        self.y = y
-        self.dx = dx
-        self.dy = dy
-        
-    def read(self,path, format=None):
-        """ Store the values loaded from file in local variables """
-        if not path == None:
-            read_it = False
-             
-            for item in self.ext:
-                if path.lower().find(item)>=0:
-                    read_it = True
-            #print "this is the flag",read_it, path.lower()
-            if read_it==False:
-                return None
-            else:
-                try:
-                    input_f =  open(path,'r')
-                except :
-                    raise  RuntimeError,"TXT2_Reader cannot open %s"%(path)
-                buff = input_f.read()
-                lines = buff.split('\n')
-                self.x=[]
-                self.y=[]
-                self.dx = [] 
-                self.dy=[]
-                for line in lines:
-                    toks = line.split()
-                    try:
-                        x = float(toks[0])
-                        self.x.append(x)
-                    except:
-                        pass
-                        #print "READ ERROR", line
-                    try:
-                        y = float(toks[1])
-                        self.y.append(y)
-                    except:
-                        pass
-                        #print "READ ERROR", line
-                    try:
-                        dy=float(toks[2])
-                        self.dy.append(dy)
-    
-                    except:
-                        pass
-                        #print "READ ERROR", line
-    
-                if(( self.x==[])or (self.y==[])) or (self.dy !=[]):
-                    #print "went here"
-                    #return value
-                    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
-                    logging.info("TXT2_Reader reading  %s\n" %path)
-                    output = ReaderInfo()
-                    output.x    = self.x
-                    output.y    = self.y
-                    output.type = "1D"
-                    
-                    return output
-        return None
-   
-       
-    
-if __name__ == "__main__": 
-    read= Reader()
-    read.load("testdata_line.txt")
-    
-            
Index: DataLoader/plugins/TXT3_Reader.py
===================================================================
--- DataLoader/plugins/TXT3_Reader.py	(revision 16d8e5fb43348001cacbc6967a6922266e68fe6e)
+++ 	(revision )
@@ -1,133 +1,0 @@
-# class Loader  to load any king of file
-import wx
-import string,numpy
-import logging
-class ReaderInfo:
-    """
-        This class is a container of data. It stores values read from files
-    """
-    ## Wavelength [A]
-    wavelength = 0.0
-    ## Number of x bins
-    xbins = 128
-    ## Number of y bins
-    ybins = 128
-    ## Beam center X [pixel number]
-    center_x = 65
-    ## Beam center Y [pixel number]
-    center_y = 65
-    ## Distance from sample to detector [m]
-    distance = 11.0
-    ## Qx values [A-1]
-    x_vals = []
-    ## Qy xalues [A-1]
-    y_vals = []
-    ## Qx min
-    xmin = 0.0
-    ## Qx max
-    xmax = 1.0
-    ## Qy min
-    ymin = 0.0
-    ## Qy max
-    ymax = 1.0
-    ## Image
-    image = None
-    ## Pixel size
-    pixel_size = 0.5
-    ## x coordinate
-    x=[]
-    ##y coordinate
-    y=[]
-    ##dx error on y
-    dx=None
-    ## dy error on y
-    dy=None
-    ## Error on each pixel
-    error = None
-    ##type of data
-    type=""
-    ##z
-    Z=None
-class Reader:
-    """
-        This class is loading values from given file or value giving by the user
-    """
-    ext=['.txt','.dat']  
-    def _init_(self,filename=None,x=None,y=None,dx=None,dy=None):
-        # variable to store loaded values
-        self.x = x
-        self.y = y
-        self.dx = dx
-        self.dy = dy
-        self.filename = filename
-        
-        
-    def read(self,path, format=None):
-        """ Store the values loaded from file in local variables 
-            can read 3 columns of data
-        """
-        
-        if not path == None:
-            read_it = False
-            
-            for item in self.ext:
-                if path.lower().find(item)>=0:
-                    read_it = True
-            #print "this is the flag",read_it, path.lower()
-            if read_it==False:
-                return None
-            else:
-                try:
-                    input_f =  open(path,'r')
-                except :
-                    raise  RuntimeError,"TXT3_Reader cannot open %s"%(path)
-                buff = input_f.read()
-                lines = buff.split('\n')
-                self.x=[]
-                self.y=[]
-                self.dx = [] 
-                self.dy=[]
-                for line in lines:
-                    toks = line.split()
-                    try:  
-                        x = float(toks[0])
-                        y = float(toks[1]) 
-                        dy = float(toks[2])
-                       
-                        self.x.append(x)
-                        self.y.append(y)
-                        self.dy.append(dy)
-                   
-                    except:
-                        pass
-                        #print "READ ERROR", line
-            
-                    self.dx = numpy.zeros(len(self.x))
-                    # Sanity check
-                    if not len(self.x) == len(self.dx):
-                        raise ValueError, "x and dx have different length"
-                    if not len(self.y) == len(self.dy):
-                        raise ValueError, "y and dy have different length"
-               
-                if (self.x==[] or self.y==[])and (self.dy==[]):
-                    raise ValueError, "TXT3_Reader can't read %s"%path
-                else:
-                   
-                    logging.info ("TXT3_Reader reading %s \n" %(path))
-                      
-                    output = ReaderInfo()
-                    output.x    = self.x
-                    output.y    = self.y
-                    output.dy   = self.dy
-                    output.type = "1D"
-                    
-                    return output
-                
-        return None
-if __name__ == "__main__": 
-    read= Reader()
-    #read= Reader(filename="testdata_line.txt")
-    print read.load("test.dat")
-    
-    
-            
Index: DataLoader/plugins/test_reader.py
===================================================================
--- DataLoader/plugins/test_reader.py	(revision daa56d02ac884aa84b81111db375d2dab7e1edcf)
+++ DataLoader/plugins/test_reader.py	(revision daa56d02ac884aa84b81111db375d2dab7e1edcf)
@@ -0,0 +1,63 @@
+"""
+This software was developed by the University of Tennessee as part of the
+Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+project funded by the US National Science Foundation. 
+
+See the license text in license.txt
+
+copyright 2008, University of Tennessee
+"""
+import numpy, os
+from DataLoader.data_info import Data1D
+
+
+class Reader:
+    """
+        Test reader to check plugin functionality
+    """
+    ## File type
+    type = ["ASCII files (*.test)|*.test"]
+    ## List of allowed extensions
+    ext=['.test']  
+    
+    def read(self, path):
+        """ 
+            Load data file
+            
+            @param path: file path
+            @return: Data1D object, or None
+            @raise RuntimeError: when the file can't be opened
+            @raise ValueError: when the length of the data vectors are inconsistent
+        """
+        if os.path.isfile(path):
+            basename  = os.path.basename(path)
+            root, extension = os.path.splitext(basename)
+            if extension.lower() in self.ext:
+                try:
+                    input_f =  open(path,'r')
+                except :
+                    raise  RuntimeError, "ascii_reader: cannot open %s" % path
+                buff = input_f.read()
+                lines = buff.split('\n')
+                x  = numpy.zeros(0)
+                y  = numpy.zeros(0)
+                dy = numpy.zeros(0)
+                output = Data1D(x, y, dy=dy)
+                self.filename = output.filename = basename
+           
+                for line in lines:
+                    x  = numpy.append(x,  float(line)) 
+                    
+                output.x = x
+                return output
+        else:
+            raise RuntimeError, "%s is not a file" % path
+        return None
+    
+if __name__ == "__main__": 
+    reader = Reader()
+    output = reader.read("../test/test_data.test")
+    print output.x
+    
+    
+                        
Index: DataLoader/plugins/tiff_reader.py
===================================================================
--- DataLoader/plugins/tiff_reader.py	(revision 16d8e5fb43348001cacbc6967a6922266e68fe6e)
+++ 	(revision )
@@ -1,165 +1,0 @@
-
-import Image
-import math
-class ReaderInfo:
-    """
-        This class is a container of data. It stores values read from files
-    """
-    ## Wavelength [A]
-    wavelength = 0.0
-    ## Number of x bins
-    xbins = 128
-    ## Number of y bins
-    ybins = 128
-    ## Beam center X [pixel number]
-    center_x = 65
-    ## Beam center Y [pixel number]
-    center_y = 65
-    ## Distance from sample to detector [m]
-    distance = 11.0
-    ## Qx values [A-1]
-    x_vals = []
-    ## Qy xalues [A-1]
-    y_vals = []
-    ## Qx min
-    xmin = 0.0
-    ## Qx max
-    xmax = 1.0
-    ## Qy min
-    ymin = 0.0
-    ## Qy max
-    ymax = 1.0
-    ## Image
-    image = None
-    ## Pixel size
-    pixel_size = 0.5
-    ## x coordinate
-    x=[]
-    ##y coordinate
-    y=[]
-    ##dx error on y
-    dx=None
-    ## dy error on y
-    dy=None
-    ## Error on each pixel
-    error = None
-    ##type of data
-    type=""
-    ##z
-    Z=None
-
-class Reader:
-    """
-        Example data manipulation
-    """
-    ## File type
-    type = []
-    ## Extension
-    ext  = ['tif', 'jpg', '.png', 'jpeg', '.tiff', 'gif', 'bmp']    
-        
-    def read(self, filename=None):
-        """
-            Open and read the data in a file
-            @param file: path of the file
-        """
-        
-        read_it = False
-        for item in self.ext:
-            if filename.lower().find(item)>=0:
-                read_it = True
-                
-        if read_it:
-            import Image
-            import pylab
-            import copy
-            import numpy
-            
-            wavelength, distance, center_x, center_y, pixel = 10.0, 11.0, 65, 65, 1.0
-            
-            
-            
-            # Initialize 
-            x_vals = []
-            y_vals = [] 
-            ymin = None
-            ymax = None
-            xmin = None
-            xmax = None
-            Z = None
-        
-            try:
-                im = Image.open(filename)
-            except :
-                raise  RuntimeError,"cannot open %s"%(filename)
-            # Detector size should be 128x128, the file is 190x190
-            print "-> Image size:", im.size, im.format, im.mode
-            data = im.getdata()
-            x = numpy.zeros(im.size[0])
-            y = numpy.zeros(im.size[1])
-            X, Y = pylab.meshgrid(x, y)
-            Z = copy.deepcopy(X)
-            itot = 0
-            i_x = 0
-            i_y = 0
-            
-            # Qx and Qy vectors
-            for i_x in range(im.size[0]):
-                theta = (i_x-center_x+1)*pixel / distance / 100.0
-                qx = 4.0*math.pi/wavelength * math.sin(theta/2.0)
-                x_vals.append(qx)
-                if xmin==None or qx<xmin:
-                    xmin = qx
-                if xmax==None or qx>xmax:
-                    xmax = qx
-            
-            ymin = None
-            ymax = None
-            for i_y in range(im.size[1]):
-                theta = (i_y-center_y+1)*pixel / distance / 100.0
-                qy = 4.0*math.pi/wavelength * math.sin(theta/2.0)
-                y_vals.append(qy)
-                if ymin==None or qy<ymin:
-                    ymin = qy
-                if ymax==None or qy>ymax:
-                    ymax = qy
-            
-            for val in data:
-                
-                try:
-                    value = float(val)
-                except:
-                    continue
-                
-                # Get bin number
-                if math.fmod(itot, im.size[0])==0:
-                    i_x = 0
-                    i_y += 1
-                else:
-                    i_x += 1
-                    
-                Z[im.size[1]-1-i_y][i_x] = value
-                
-                itot += 1
-                
-            output = ReaderInfo()
-            output.wavelength = wavelength
-            output.xbins      = im.size[0]
-            output.ybins      = im.size[1]
-            output.center_x   = center_x
-            output.center_y   = center_y
-            output.distance   = distance
-            output.x_vals     = x_vals
-            output.y_vals     = y_vals
-            output.xmin       = xmin
-            output.xmax       = xmax
-            output.ymin       = ymin
-            output.ymax       = ymax
-            output.image      = Z
-            output.pixel_size = pixel
-            output.type       ="2D"
-              
-            return output
-        
-        return None
-
-
