Index: DataLoader/data_info.py
===================================================================
--- DataLoader/data_info.py	(revision 4c00964bdd074de333f3ea90840473f22102bb04)
+++ DataLoader/data_info.py	(revision 579ba85b3ae066f0c232974fcfbc64c128eec44f)
@@ -24,14 +24,44 @@
 
 #TODO: Keep track of data manipulation in the 'process' data structure.
-
-from sans.guitools.plottables import Data1D as plottable_1D
+#TODO: This module should be independent of plottables. We should write
+#        an adapter class for plottables when needed.
+
+#from sans.guitools.plottables import Data1D as plottable_1D
 from data_util.uncertainty import Uncertainty
 import numpy
 import math
 
+class plottable_1D:
+    """
+        Data1D is a place holder for 1D plottables.
+    """
+    x = None
+    y = None
+    dx = None
+    dy = None
+    
+    # Units
+    _xaxis = ''
+    _xunit = ''
+    _yaxis = ''
+    _yunit = ''
+    
+    def __init__(self,x,y,dx=None,dy=None):
+        self.x = x
+        self.y = y
+        self.dx = dx
+        self.dy = dy
+
+    def xaxis(self, label, unit):
+        self._xaxis = label
+        self._xunit = unit
+        
+    def yaxis(self, label, unit):
+        self._yaxis = label
+        self._yunit = unit
+
 class plottable_2D:
     """
-        Data2D is a place holder for 2D plottables, which are 
-        not yet implemented.
+        Data2D is a place holder for 2D plottables.
     """
     xmin = None
@@ -148,7 +178,9 @@
 class Aperture:
     ## Name
-    name = ''
+    name = None
     ## Type
-    type = ''
+    type = None
+    ## Size name
+    size_name = None
     ## Aperture size [Vector]
     size = None
@@ -192,12 +224,14 @@
     """  
     ## Name
-    name = ''
+    name = None
     ## Radiation type [string]
-    radiation = ''
+    radiation = None
+    ## Beam size name
+    beam_size_name = None
     ## Beam size [Vector] [mm]
     beam_size = None
     beam_size_unit = 'mm'
     ## Beam shape [string]
-    beam_shape = ''
+    beam_shape = None
     ## Wavelength [float] [Angstrom]
     wavelength = None
@@ -246,4 +280,6 @@
         Class to hold the sample description
     """
+    ## Short name for sample
+    name = ''
     ## ID
     ID = ''
@@ -327,4 +363,6 @@
     ## Run number
     run        = None
+    ## Run name
+    run_name   = None
     ## File name
     filename   = ''
@@ -355,5 +393,6 @@
         self.title      = ''
         ## Run number
-        self.run        = None
+        self.run        = []
+        self.run_name   = {}
         ## File name
         self.filename   = ''
Index: DataLoader/loader.py
===================================================================
--- DataLoader/loader.py	(revision 77c1c29d98ec58dc10470ea329f66f1574ac4a63)
+++ DataLoader/loader.py	(revision 579ba85b3ae066f0c232974fcfbc64c128eec44f)
@@ -71,5 +71,8 @@
             self.readers = {}
             #Load all readers in plugins
-            self.__setitem__()
+            
+            #TODO: misuse of __setitem__
+            #TODO: this bad call is done twice: here, and in Loader.__init__
+            #self.__setitem__()
             
             
@@ -94,4 +97,11 @@
             if dir==None:
                 dir = 'readers'
+                
+            #TODO Probably name the new path something else...
+            
+            #TODO: The whole concept of plug-ins was missed here.
+            # First we want to always load the reader we have (in 'readers')
+            # and THEN we want to add any additional readers found in
+            # a pre-defined plug-in path (that path should be a variable).
             dir=os.path.join(os.path.dirname(os.path.abspath(__file__)),dir)
             
@@ -100,4 +110,7 @@
                 if os.path.isdir(dir):
                     plugReader=_findReaders(dir)# import all module in plugins
+                
+                #TODO The following just doesn't make sense
+                # ../C:\Python25\lib... ????
                 if os.path.isdir('../'+dir):
                     plugReader=_findReaders('../'+dir)
@@ -107,4 +120,5 @@
                     list=[]
                     for preader in plugReader:# for each modules takes list of extensions
+                        #TODO should use hasattr rather than a try/except block
                         try:
                             list=preader.ext
Index: DataLoader/readers/cansas_reader.py
===================================================================
--- DataLoader/readers/cansas_reader.py	(revision 4c00964bdd074de333f3ea90840473f22102bb04)
+++ DataLoader/readers/cansas_reader.py	(revision 579ba85b3ae066f0c232974fcfbc64c128eec44f)
@@ -8,11 +8,10 @@
 copyright 2008, University of Tennessee
 """
-
-#TODO: Unit conversion
-#TODO: missing aperture type: go through all entries and check for additional attributes
+# Known issue: reader not compatible with multiple SASdata entries
+# within a single SASentry. Will raise a runtime error.
+
 #TODO: check that all vectors are written only if they have at least one non-empty value
-#TODO: multiple SASEntrys
+#TODO: Writing only allows one SASentry per file. Would be best to allow multiple entries.
 #TODO: Store error list
-#TODO: convert from pixel to mm for beam center...
 #TODO: Allow for additional meta data for each section
 #TODO: Notes need to be implemented. They can be any XML structure in version 1.0
@@ -258,10 +257,18 @@
         # Look up title
         _store_content('Title', dom, 'title', data_info)
-        # Look up run number                    
-        _store_content('Run', dom, 'run', data_info)                    
+        # Look up run number   
+        nodes = xpath.Evaluate('Run', dom)
+        for item in nodes:    
+            value, attr = get_node_text(item)
+            if value is not None:
+                data_info.run.append(value)
+                if attr.has_key('name'):
+                    data_info.run_name[value] = attr['name']         
+                           
         # Look up instrument name              
-        value, attr = get_content('SASinstrument', dom)
-        if attr.has_key('name'):
-            data_info.instrument = attr['name']
+        _store_content('SASinstrument/name', dom, 'instrument', data_info)
+        #value, attr = get_content('SASinstrument', dom)
+        #if attr.has_key('name'):
+        #    data_info.instrument = attr['name']
 
         note_list = xpath.Evaluate('SASnote', dom)
@@ -276,4 +283,8 @@
         
         # Sample info ###################
+        value, attr = get_content('SASsample', dom)
+        if attr.has_key('name'):
+            data_info.sample.name = attr['name']
+            
         _store_content('SASsample/ID', 
                      dom, 'ID', data_info.sample)                    
@@ -327,5 +338,9 @@
                      dom, 'wavelength_spread', data_info.source)    
         
-        # Beam size (as a vector)      
+        # Beam size (as a vector)   
+        value, attr = get_content('SASinstrument/SASsource/beam_size', dom)
+        if attr.has_key('name'):
+            data_info.source.beam_size_name = attr['name']
+            
         _store_float('SASinstrument/SASsource/beam_size/x', 
                      dom, 'beam_size.x', data_info.source)    
@@ -350,5 +365,5 @@
                 
                 # Get the name and type of the aperture
-                ap_value, ap_attr = get_node_text(item)
+                ap_value, ap_attr = get_node_text(apert)
                 if ap_attr.has_key('name'):
                     aperture.name = ap_attr['name']
@@ -357,4 +372,9 @@
                     
                 _store_float('distance', apert, 'distance', aperture)    
+                
+                value, attr = get_content('size', apert)
+                if attr.has_key('name'):
+                    aperture.size_name = attr['name']
+                
                 _store_float('size/x', apert, 'size.x', aperture)    
                 _store_float('size/y', apert, 'size.y', aperture)    
@@ -380,7 +400,7 @@
             
             # Detector orientation (as a vector)
-            _store_float('orientation/pitch', item, 'orientation.x', detector)    
-            _store_float('orientation/yaw',   item, 'orientation.y', detector)    
-            _store_float('orientation/roll',  item, 'orientation.z', detector)    
+            _store_float('orientation/roll',  item, 'orientation.x', detector)    
+            _store_float('orientation/pitch', item, 'orientation.y', detector)    
+            _store_float('orientation/yaw',   item, 'orientation.z', detector)    
             
             # Beam center (as a vector)
@@ -430,4 +450,8 @@
             
         # Data info ######################
+        nodes = xpath.Evaluate('SASdata', dom)
+        if len(nodes)>1:
+            raise RuntimeError, "CanSAS reader is not compatible with multiple SASdata entries"
+        
         nodes = xpath.Evaluate('SASdata/Idata', dom)
         x  = numpy.zeros(0)
@@ -455,7 +479,7 @@
             if _x is not None and _y is not None:
                 x  = numpy.append(x, _x)
-                y  = numpy.append(x, _y)
-                dx = numpy.append(x, _dx)
-                dy = numpy.append(x, _dy)
+                y  = numpy.append(y, _y)
+                dx = numpy.append(dx, _dx)
+                dy = numpy.append(dy, _dy)
             
         data_info.x = x
@@ -508,6 +532,11 @@
         main_node.appendChild(entry_node)
         
-        write_node(doc, entry_node, "title", datainfo.title)
-        write_node(doc, entry_node, "run", datainfo.run)
+        write_node(doc, entry_node, "Title", datainfo.title)
+        
+        for item in datainfo.run:
+            runname = {}
+            if datainfo.run_name.has_key(item) and len(str(datainfo.run_name[item]))>1:
+                runname = {'name': datainfo.run_name[item] }
+            write_node(doc, entry_node, "Run", item, runname)
         
         # Data info
@@ -515,8 +544,22 @@
         entry_node.appendChild(node)
         
+        for i in range(len(datainfo.x)):
+            pt = doc.createElement("Idata")
+            node.appendChild(pt)
+            write_node(doc, pt, "Q", datainfo.x[i], {'unit':datainfo.x_unit})
+            if len(datainfo.y)>=i:
+                write_node(doc, pt, "I", datainfo.y[i], {'unit':datainfo.y_unit})
+            if len(datainfo.dx)>=i:
+                write_node(doc, pt, "Qdev", datainfo.dx[i], {'unit':datainfo.x_unit})
+            if len(datainfo.dy)>=i:
+                write_node(doc, pt, "Idev", datainfo.dy[i], {'unit':datainfo.y_unit})
+
+        
         # Sample info
         sample = doc.createElement("SASsample")
+        if datainfo.sample.name is not None:
+            sample.setAttribute("name", str(datainfo.sample.name))
         entry_node.appendChild(sample)
-        write_node(doc, sample, "ID", datainfo.sample.ID)
+        write_node(doc, sample, "ID", str(datainfo.sample.ID))
         write_node(doc, sample, "thickness", datainfo.sample.thickness, {"unit":datainfo.sample.thickness_unit})
         write_node(doc, sample, "transmission", datainfo.sample.transmission)
@@ -527,16 +570,14 @@
         
         pos = doc.createElement("position")
-        written = False
-        written = written or write_node(doc, pos, "x", datainfo.sample.position.x, {"unit":datainfo.sample.position_unit})
-        written = written or write_node(doc, pos, "y", datainfo.sample.position.y, {"unit":datainfo.sample.position_unit})
-        written = written or write_node(doc, pos, "z", datainfo.sample.position.z, {"unit":datainfo.sample.position_unit})
+        written = write_node(doc, pos, "x", datainfo.sample.position.x, {"unit":datainfo.sample.position_unit})
+        written = written | write_node(doc, pos, "y", datainfo.sample.position.y, {"unit":datainfo.sample.position_unit})
+        written = written | write_node(doc, pos, "z", datainfo.sample.position.z, {"unit":datainfo.sample.position_unit})
         if written == True:
             sample.appendChild(pos)
         
         ori = doc.createElement("orientation")
-        written = False
-        written = written or write_node(doc, ori, "roll",  datainfo.sample.orientation.x, {"unit":datainfo.sample.orientation_unit})
-        written = written or write_node(doc, ori, "pitch", datainfo.sample.orientation.y, {"unit":datainfo.sample.orientation_unit})
-        written = written or write_node(doc, ori, "yaw",   datainfo.sample.orientation.z, {"unit":datainfo.sample.orientation_unit})
+        written = write_node(doc, ori, "roll",  datainfo.sample.orientation.x, {"unit":datainfo.sample.orientation_unit})
+        written = written | write_node(doc, ori, "pitch", datainfo.sample.orientation.y, {"unit":datainfo.sample.orientation_unit})
+        written = written | write_node(doc, ori, "yaw",   datainfo.sample.orientation.z, {"unit":datainfo.sample.orientation_unit})
         if written == True:
             sample.appendChild(ori)
@@ -550,9 +591,19 @@
         #   Source
         source = doc.createElement("SASsource")
-        source.setAttribute("name", str(datainfo.source.name))
+        if datainfo.source.name is not None:
+            source.setAttribute("name", str(datainfo.source.name))
         instr.appendChild(source)
         
         write_node(doc, source, "radiation", datainfo.source.radiation)
         write_node(doc, source, "beam_shape", datainfo.source.beam_shape)
+        size = doc.createElement("beam_size")
+        if datainfo.source.beam_size_name is not None:
+            size.setAttribute("name", str(datainfo.source.beam_size_name))
+        written = write_node(doc, size, "x", datainfo.source.beam_size.x, {"unit":datainfo.source.beam_size_unit})
+        written = written | write_node(doc, size, "y", datainfo.source.beam_size.y, {"unit":datainfo.source.beam_size_unit})
+        written = written | write_node(doc, size, "z", datainfo.source.beam_size.z, {"unit":datainfo.source.beam_size_unit})
+        if written == True:
+            source.appendChild(size)
+            
         write_node(doc, source, "wavelength", datainfo.source.wavelength, {"unit":datainfo.source.wavelength_unit})
         write_node(doc, source, "wavelength_min", datainfo.source.wavelength_min, {"unit":datainfo.source.wavelength_min_unit})
@@ -563,5 +614,6 @@
         for item in datainfo.collimation:
             coll = doc.createElement("SAScollimation")
-            coll.setAttribute("name", item.name)
+            if item.name is not None:
+                coll.setAttribute("name", str(item.name))
             instr.appendChild(coll)
             
@@ -569,53 +621,74 @@
             
             for apert in item.aperture:
-                ap = doc.createElement("SAScollimation")
-                ap.setAttribute("name", apert.name)
-                ap.setAttribute("type", apert.type)
-                instr.appendChild(ap)
+                ap = doc.createElement("aperture")
+                if apert.name is not None:
+                    ap.setAttribute("name", str(apert.name))
+                if apert.type is not None:
+                    ap.setAttribute("type", str(apert.type))
+                coll.appendChild(ap)
                 
                 write_node(doc, ap, "distance", apert.distance, {"unit":apert.distance_unit})
                 
                 size = doc.createElement("size")
-                ap.appendChild(size)
-                write_node(doc, size, "x", apert.size.x, {"unit":apert.size_unit})
-                write_node(doc, size, "y", apert.size.y, {"unit":apert.size_unit})
-                write_node(doc, size, "z", apert.size.z, {"unit":apert.size_unit})
-                
+                if apert.size_name is not None:
+                    size.setAttribute("name", str(apert.size_name))
+                written = write_node(doc, size, "x", apert.size.x, {"unit":apert.size_unit})
+                written = written | write_node(doc, size, "y", apert.size.y, {"unit":apert.size_unit})
+                written = written | write_node(doc, size, "z", apert.size.z, {"unit":apert.size_unit})
+                if written == True:
+                    ap.appendChild(size)
 
         #   Detectors
         for item in datainfo.detector:
             det = doc.createElement("SASdetector")
-            instr.appendChild(det)
-            
-            write_node(doc, det, "name", item.name)
-            write_node(doc, det, "SDD", item.distance, {"unit":item.distance_unit})
-            write_node(doc, det, "slit_length", item.slit_length, {"unit":item.slit_length_unit})
+            written = write_node(doc, det, "name", item.name)
+            written = written | write_node(doc, det, "SDD", item.distance, {"unit":item.distance_unit})
+            written = written | write_node(doc, det, "slit_length", item.slit_length, {"unit":item.slit_length_unit})
+            if written == True:
+                instr.appendChild(det)
             
             off = doc.createElement("offset")
-            det.appendChild(off)
-            write_node(doc, off, "x", item.offset.x, {"unit":item.offset_unit})
-            write_node(doc, off, "y", item.offset.y, {"unit":item.offset_unit})
-            write_node(doc, off, "z", item.offset.z, {"unit":item.offset_unit})
-            
+            written = write_node(doc, off, "x", item.offset.x, {"unit":item.offset_unit})
+            written = written | write_node(doc, off, "y", item.offset.y, {"unit":item.offset_unit})
+            written = written | write_node(doc, off, "z", item.offset.z, {"unit":item.offset_unit})
+            if written == True:
+                det.appendChild(off)
             
             center = doc.createElement("beam_center")
-            det.appendChild(center)
-            write_node(doc, center, "x", item.beam_center.x, {"unit":item.beam_center_unit})
-            write_node(doc, center, "y", item.beam_center.y, {"unit":item.beam_center_unit})
-            write_node(doc, center, "z", item.beam_center.z, {"unit":item.beam_center_unit})
-            
+            written = write_node(doc, center, "x", item.beam_center.x, {"unit":item.beam_center_unit})
+            written = written | write_node(doc, center, "y", item.beam_center.y, {"unit":item.beam_center_unit})
+            written = written | write_node(doc, center, "z", item.beam_center.z, {"unit":item.beam_center_unit})
+            if written == True:
+                det.appendChild(center)
+                
             pix = doc.createElement("pixel_size")
-            det.appendChild(pix)
-            write_node(doc, pix, "x", item.pixel_size.x, {"unit":item.pixel_size_unit})
-            write_node(doc, pix, "y", item.pixel_size.y, {"unit":item.pixel_size_unit})
-            write_node(doc, pix, "z", item.pixel_size.z, {"unit":item.pixel_size_unit})
-            
-        
-        # Sample info
+            written = write_node(doc, pix, "x", item.pixel_size.x, {"unit":item.pixel_size_unit})
+            written = written | write_node(doc, pix, "y", item.pixel_size.y, {"unit":item.pixel_size_unit})
+            written = written | write_node(doc, pix, "z", item.pixel_size.z, {"unit":item.pixel_size_unit})
+            if written == True:
+                det.appendChild(pix)
+                
+            ori = doc.createElement("orientation")
+            written = write_node(doc, ori, "roll",  item.orientation.x, {"unit":item.orientation_unit})
+            written = written | write_node(doc, ori, "pitch", item.orientation.y, {"unit":item.orientation_unit})
+            written = written | write_node(doc, ori, "yaw",   item.orientation.z, {"unit":item.orientation_unit})
+            if written == True:
+                det.appendChild(ori)
+                
+        
+        # Processes info
         for item in datainfo.process:
             node = doc.createElement("SASprocess")
             entry_node.appendChild(node)
 
-            write_node(doc, entry_node, "run", item.name)
+            write_node(doc, node, "name", item.name)
+            write_node(doc, node, "date", item.date)
+            write_node(doc, node, "description", item.description)
+            for term in item.term:
+                value = term['value']
+                del term['value']
+                write_node(doc, node, "term", value, term)
+            for note in item.notes:
+                write_node(doc, node, "SASprocessnote", note)
             
         
Index: DataLoader/release_notes.txt
===================================================================
--- DataLoader/release_notes.txt	(revision 4c00964bdd074de333f3ea90840473f22102bb04)
+++ DataLoader/release_notes.txt	(revision 579ba85b3ae066f0c232974fcfbc64c128eec44f)
@@ -4,6 +4,10 @@
 Package name: DataLoader 0.2
 
-1- 	Version 0.1
+1- 	Version 0.2
 	- Release date: ?
+	- First version of CanSAS reader/writer
+	- 1D data manipulations available
+	
+	Version 0.1
 	- First version of SANS data loader
 	- Formats: IGOR 1D, IGOR 2D, CanSAS 1D, 2- or 3-column ascii
@@ -25,5 +29,6 @@
 
 	3.1- All systems:
-		- None
+		- CanSAS format only allows a single SASdata section per SASentry.
+		- CanSAS format only allows one SASentry per file, for a single DataInfo object.
 
 	3.2- Windows:
Index: DataLoader/test/cansas1d.xml
===================================================================
--- DataLoader/test/cansas1d.xml	(revision 4c00964bdd074de333f3ea90840473f22102bb04)
+++ DataLoader/test/cansas1d.xml	(revision 579ba85b3ae066f0c232974fcfbc64c128eec44f)
@@ -8,5 +8,5 @@
 	<SASentry>
 		<Title>Test title</Title>
-		<Run>1234</Run>
+		<Run name='run name'>1234</Run>
 		<SASdata>
 			<Idata>
@@ -19,13 +19,13 @@
 			</Idata>
 			<Idata>
-				<Q unit="1/A">0.02</Q>
-				<I unit="1/cm">1000</I>
-				<Idev unit="1/cm">3</Idev>
-				<Qdev unit="1/A">0.01</Qdev>
+				<Q unit="1/A">0.03</Q>
+				<I unit="1/cm">1001</I>
+				<Idev unit="1/cm">4</Idev>
+				<Qdev unit="1/A">0.02</Qdev>
 				<Qmean unit="1/A"><!-- Qmean is optional --></Qmean>
 				<Shadowfactor><!-- Shadowfactor is optional --></Shadowfactor>
 			</Idata>
 		</SASdata>
-		<SASsample>
+		<SASsample name='my sample'>
 			<ID>SI600-new-long</ID>
 			<thickness unit="mm">1.03</thickness>
@@ -53,7 +53,7 @@
 			<SASsource name="source name">
 				<radiation>neutron</radiation>
-				<beam_size>
+				<beam_size name='bm'>
 					<x unit="mm">12.00</x>
-					<y unit="mm">12.00</y>
+					<y unit="mm">13.00</y>
 				</beam_size>
 				<beam_shape>disc</beam_shape>
@@ -74,5 +74,5 @@
 				</aperture>
 				<aperture name="sample" type="radius">
-					<size>
+					<size name='size name'>
 						<x unit="mm">1</x>
 					</size>
Index: taLoader/test/test_log.txt
===================================================================
--- DataLoader/test/test_log.txt	(revision 8176aadeec7f91a808564e0436d1b5e8bcbec335)
+++ 	(revision )
@@ -1,39 +1,0 @@
-2008-08-13 08:44:17,299 DEBUG Inside testLoad module
-2008-08-13 08:44:17,503 ERROR Error importing abs_reader
-  No module named data_util.uncertainty
-2008-08-13 08:44:17,503 ERROR Error importing ascii_reader
-  No module named data_util.uncertainty
-2008-08-13 08:44:17,503 ERROR Error importing cansas_reader
-  No module named data_util.uncertainty
-2008-08-13 08:44:17,519 ERROR Error importing danse_reader
-  No module named data_util.uncertainty
-2008-08-13 08:44:17,519 ERROR Error importing IgorReader
-  No module named data_util.uncertainty
-2008-08-13 08:44:17,674 ERROR Error importing abs_reader
-  No module named data_util.uncertainty
-2008-08-13 08:44:17,674 ERROR Error importing ascii_reader
-  No module named data_util.uncertainty
-2008-08-13 08:44:17,674 ERROR Error importing cansas_reader
-  No module named data_util.uncertainty
-2008-08-13 08:44:17,674 ERROR Error importing danse_reader
-  No module named data_util.uncertainty
-2008-08-13 08:44:17,690 ERROR Error importing IgorReader
-  No module named data_util.uncertainty
-2008-08-13 08:44:17,690 ERROR Load Error: TXT3_Reader can't read empty.txt
-2008-08-13 08:44:17,690 ERROR Load Error: TXT2_Reader can't read empty.txt
-2008-08-13 08:44:17,690 ERROR Load Error: TXT3_Reader can't read empty.txt
-2008-08-13 08:44:17,690 ERROR Load Error: TXT2_Reader can't read empty.txt
-2008-08-13 08:44:17,690 ERROR Load Error: TXT3_Reader can't read test_2_columns.txt
-2008-08-13 08:44:17,690 INFO TXT2_Reader reading  test_2_columns.txt
-
-2008-08-13 08:44:17,690 INFO TXT3_Reader reading test_3_columns.txt 
-
-2008-08-13 08:44:17,690 WARNING Unknown file type '.ASC'
-2008-08-13 08:44:17,690 WARNING Unknown file type '.sans'
-2008-08-13 08:44:18,065 INFO tiff_reader reading angles_flat.png
-2008-08-13 08:44:18,065 WARNING Unknown file type '.missing'
-2008-08-13 08:44:18,065 WARNING Unknown file type '.missing'
-2008-08-13 08:44:18,065 ERROR Load Error: TXT3_Reader can't read angles_flat.txt
-2008-08-13 08:44:18,082 ERROR Load Error: TXT2_Reader can't read angles_flat.txt
-2008-08-13 08:44:18,082 ERROR Load Error: TXT3_Reader can't read angles_flat.txt
-2008-08-13 08:44:18,082 ERROR Load Error: TXT2_Reader can't read angles_flat.txt
Index: DataLoader/test/utest_abs_reader.py
===================================================================
--- DataLoader/test/utest_abs_reader.py	(revision 4c00964bdd074de333f3ea90840473f22102bb04)
+++ DataLoader/test/utest_abs_reader.py	(revision 579ba85b3ae066f0c232974fcfbc64c128eec44f)
@@ -135,4 +135,8 @@
  
     def test_checkdata(self):
+        self.assertEqual(self.data.filename, "cansas1d.xml")
+        self._checkdata()
+        
+    def _checkdata(self):
         """
             Check the data content to see whether 
@@ -142,9 +146,25 @@
             tests won't pass
         """
-        self.assertEqual(self.data.filename, "cansas1d.xml")
-        self.assertEqual(self.data.run, "1234")
+        
+        self.assertEqual(self.data.run[0], "1234")
+        
+        # Data
+        self.assertEqual(len(self.data.x), 2)
+        self.assertEqual(self.data.x_unit, '1/A')
+        self.assertEqual(self.data.y_unit, '1/cm')
+        self.assertEqual(self.data.x[0], 0.02)
+        self.assertEqual(self.data.y[0], 1000)
+        self.assertEqual(self.data.dx[0], 0.01)
+        self.assertEqual(self.data.dy[0], 3)
+        self.assertEqual(self.data.x[1], 0.03)
+        self.assertEqual(self.data.y[1], 1001)
+        self.assertEqual(self.data.dx[1], 0.02)
+        self.assertEqual(self.data.dy[1], 4)
+        self.assertEqual(self.data.run_name['1234'], 'run name')
+        self.assertEqual(self.data.title, "Test title")
         
         # Sample info
         self.assertEqual(self.data.sample.ID, "SI600-new-long")
+        self.assertEqual(self.data.sample.name, "my sample")
         self.assertEqual(self.data.sample.thickness_unit, 'mm')
         self.assertEqual(self.data.sample.thickness, 1.03)
@@ -167,5 +187,5 @@
         
         # Instrument info
-        self.assertEqual(self.data.instrument, "TEST instrument")
+        self.assertEqual(self.data.instrument, "canSAS instrument")
         
         # Source
@@ -173,6 +193,7 @@
         
         self.assertEqual(self.data.source.beam_size_unit, "mm")
+        self.assertEqual(self.data.source.beam_size_name, "bm")
         self.assertEqual(self.data.source.beam_size.x, 12)
-        self.assertEqual(self.data.source.beam_size.y, 12)
+        self.assertEqual(self.data.source.beam_size.y, 13)
         
         self.assertEqual(self.data.source.beam_shape, "disc")
@@ -192,4 +213,5 @@
         _found2 = False
         self.assertEqual(self.data.collimation[0].length, 123.)
+        self.assertEqual(self.data.collimation[0].name, 'test coll name')
         
         for item in self.data.collimation[0].aperture:
@@ -198,7 +220,11 @@
             
             if item.size.x==50 \
-                and item.distance==11000.:
+                and item.distance==11000.0 \
+                and item.name=='source' \
+                and item.type=='radius':
                 _found1 = True
-            elif item.size.x==1.0:
+            elif item.size.x==1.0 \
+                and item.name=='sample' \
+                and item.type=='radius':
                 _found2 = True
                 
@@ -209,6 +235,6 @@
         # Detector
         self.assertEqual(self.data.detector[0].name, "fictional hybrid")
-        self.assertEqual(self.data.detector[0].distance_unit, "m")
-        self.assertEqual(self.data.detector[0].distance, 4.150)
+        self.assertEqual(self.data.detector[0].distance_unit, "mm")
+        self.assertEqual(self.data.detector[0].distance, 4150)
         
         self.assertEqual(self.data.detector[0].orientation_unit, "degree")
@@ -218,6 +244,6 @@
         
         self.assertEqual(self.data.detector[0].offset_unit, "m")
-        self.assertEqual(self.data.detector[0].offset.x, .01)
-        self.assertEqual(self.data.detector[0].offset.y, .02)
+        self.assertEqual(self.data.detector[0].offset.x, .001)
+        self.assertEqual(self.data.detector[0].offset.y, .002)
         self.assertEqual(self.data.detector[0].offset.z, None)
         
@@ -233,4 +259,23 @@
         
         # Process
+        _found_term1 = False
+        _found_term2 = False
+        for item in self.data.process:
+            self.assertTrue(item.name in ['NCNR-IGOR', 'spol'])
+            self.assertTrue(item.date in ['04-Sep-2007 18:35:02',
+                                          '03-SEP-2006 11:42:47'])
+            for t in item.term:
+                if t['name']=="ABS:DSTAND" \
+                    and t['unit']=='mm' \
+                    and float(t['value'])==1.0:
+                    _found_term2 = True
+                elif t['name']=="radialstep" \
+                    and t['unit']=='mm' \
+                    and float(t['value'])==10.0:
+                    _found_term1 = True
+                    
+        if _found_term1==False or _found_term2==False:
+            raise RuntimeError, "Could not find all process terms %s %s" % (_found_term1, _found_term2) 
+            
         
         
@@ -243,7 +288,10 @@
         dy = numpy.ones(5)
         
-        d = Loader().load("jan08002.ABS")
-        #d = Data1D(x, y, dy)
-        r.write("write_test.xml", d)
+        filename = "write_test.xml"
+        r.write(filename, self.data)
+        self.data = Loader().load(filename)
+        self.assertEqual(self.data.filename, filename)
+        self._checkdata()
+        
         
         
