Index: sansdataloader/src/sans/dataloader/data_info.py
===================================================================
--- sansdataloader/src/sans/dataloader/data_info.py	(revision f60a8c20e2f0018d19feff6fc41e188d2939a7e4)
+++ sansdataloader/src/sans/dataloader/data_info.py	(revision e2605a5f99adf1a9dbc17dff4689412d687b0c6b)
@@ -728,4 +728,16 @@
                     msg = "Incompatible data sets: x-values do not match"
                     raise ValueError, msg
+                if self.dxl != None and other.dxl == None:
+                    msg = "Incompatible data sets: dxl-values do not match"
+                    raise ValueError, msg
+                if self.dxl == None and other.dxl != None:
+                    msg = "Incompatible data sets: dxl-values do not match"
+                    raise ValueError, msg
+                if self.dxw != None and other.dxw == None:
+                    msg = "Incompatible data sets: dxw-values do not match"
+                    raise ValueError, msg
+                if self.dxw == None and other.dxw != None:
+                    msg = "Incompatible data sets: dxw-values do not match"
+                    raise ValueError, msg
             
             # Check that the other data set has errors, otherwise
@@ -748,13 +760,40 @@
         dy, dy_other = self._validity_check(other)
         result = self.clone_without_data(len(self.x))
-        
+        if self.dxw == None:
+            result.dxw = None
+        else:
+            result.dxw = numpy.zeros(len(self.x))
+        if self.dxl == None:
+            result.dxl = None
+        else:
+            result.dxl = numpy.zeros(len(self.x))
+
         for i in range(len(self.x)):
             result.x[i] = self.x[i]
             if self.dx is not None and len(self.x) == len(self.dx):
                 result.dx[i] = self.dx[i]
+            if self.dxw is not None and len(self.x) == len(self.dxw):
+                result.dxw[i] = self.dxw[i]
+            if self.dxl is not None and len(self.x) == len(self.dxl):
+                result.dxl[i] = self.dxl[i]
             
             a = Uncertainty(self.y[i], dy[i]**2)
             if isinstance(other, Data1D):
                 b = Uncertainty(other.y[i], dy_other[i]**2)
+                if other.dx is not None:
+                    result.dx[i] *= self.dx[i]
+                    result.dx[i] += (other.dx[i]**2)
+                    result.dx[i] /= 2
+                    result.dx[i] = math.sqrt(result.dx[i])
+                if result.dxl is not None and other.dxl is not None:
+                    result.dxl[i] *= self.dxl[i]
+                    other.dxl[i] += (other.dxl[i]**2)
+                    result.dxl[i] /= 2
+                    result.dxl[i] = math.sqrt(result.dxl[i])
+                if result.dxw is not None and self.dxw is not None:
+                    result.dxw[i] *= self.dxw[i]
+                    other.dxw[i] += (other.dxw[i]**2)
+                    result.dxw[i] /= 2
+                    result.dxw[i] = math.sqrt(result.dxw[i])
             else:
                 b = other
@@ -866,16 +905,24 @@
                 msg = "Unable to perform operation: data length are not equal"
                 raise ValueError, msg
-               
+            if numpy.size(self.qx_data) != numpy.size(other.qx_data):
+                msg = "Unable to perform operation: data length are not equal"
+                raise ValueError, msg
+            if numpy.size(self.qy_data) != numpy.size(other.qy_data):
+                msg = "Unable to perform operation: data length are not equal"
+                raise ValueError, msg
+            # Here we could also extrapolate between data points
+            for i in range(len(self.data)):
+                if self.qx_data[i] != other.qx_data[i]:
+                    msg = "Incompatible data sets: qx-values do not match"
+                    raise ValueError, msg
+                if self.qy_data[i] != other.qy_data[i]:
+                    msg = "Incompatible data sets: qy-values do not match"
+                    raise ValueError, msg
+                   
             # Check that the scales match
-            #TODO: matching scales?
-            
-            # Check that the other data set has errors, otherwise
-            # create zero vector
-            #TODO: test this
             err_other = other.err_data
             if other.err_data == None or \
                 (numpy.size(other.err_data) != numpy.size(other.data)):
-                err_other = numpy.zeros([numpy.size(other.data, 0),
-                                          numpy.size(other.data, 1)])
+                err_other = numpy.zeros(numpy.size(other.data))
             
         # Check that we have errors, otherwise create zero vector
@@ -883,6 +930,5 @@
         if self.err_data == None or \
             (numpy.size(self.err_data) != numpy.size(self.data)):
-            err = numpy.zeros([numpy.size(self.data, 0),
-                                numpy.size(self.data, 1)])
+            err = numpy.zeros(numpy.size(other.data))
             
         return err, err_other
@@ -898,23 +944,49 @@
         # First, check the data compatibility
         dy, dy_other = self._validity_check(other)
-    
-        result = self.clone_without_data([numpy.size(self.data, 0),
-                                          numpy.size(self.data, 1)])
-        
-        for i in range(numpy.size(self.data, 0)):
-            for j in range(numpy.size(self.data, 1)):
-                result.data[i][j] = self.data[i][j]
-                if self.err_data is not None and \
-                    numpy.size(self.data) == numpy.size(self.err_data):
-                    result.err_data[i][j] = self.err_data[i][j]
-                
-                a = Uncertainty(self.data[i][j], dy[i][j]**2)
-                if isinstance(other, Data2D):
-                    b = Uncertainty(other.data[i][j], dy_other[i][j]**2)
-                else:
-                    b = other
-                
-                output = operation(a, b)
-                result.data[i][j] = output.x
-                result.err_data[i][j] = math.sqrt(math.fabs(output.variance))
+        result = self.clone_without_data(numpy.size(self.data))
+        result.xmin = self.xmin
+        result.xmax = self.xmax
+        result.ymin = self.ymin
+        result.ymax = self.ymax
+        if self.dqx_data == None or self.dqy_data == None:
+            result.dqx_data = None
+            result.dqy_data = None
+        else:
+            result.dqx_data = numpy.zeros(len(self.data))
+            result.dqy_data = numpy.zeros(len(self.data))
+        for i in range(numpy.size(self.data)):
+            result.data[i] = self.data[i]
+            if self.err_data is not None and \
+                numpy.size(self.data) == numpy.size(self.err_data):
+                result.err_data[i] = self.err_data[i]    
+            if self.dqx_data is not None:
+                result.dqx_data[i] = self.dqx_data[i]
+            if self.dqy_data is not None:
+                result.dqy_data[i] = self.dqy_data[i]
+            result.qx_data[i] = self.qx_data[i]
+            result.qy_data[i] = self.qy_data[i]
+            result.q_data[i] = self.q_data[i]
+            result.mask[i] = self.mask[i]
+            
+            a = Uncertainty(self.data[i], dy[i]**2)
+            if isinstance(other, Data2D):
+                b = Uncertainty(other.data[i], dy_other[i]**2)
+                if other.dqx_data is not None and \
+                        result.dqx_data is not None:
+                    result.dqx_data[i] *= self.dqx_data[i]
+                    result.dqx_data[i] += (other.dqx_data[i]**2)
+                    result.dqx_data[i] /= 2
+                    result.dqx_data[i] = math.sqrt(result.dqx_data[i])     
+                if other.dqy_data is not None and \
+                        result.dqy_data is not None:
+                    result.dqy_data[i] *= self.dqy_data[i]
+                    result.dqy_data[i] += (other.dqy_data[i]**2)
+                    result.dqy_data[i] /= 2
+                    result.dqy_data[i] = math.sqrt(result.dqy_data[i])
+            else:
+                b = other
+            
+            output = operation(a, b)
+            result.data[i] = output.x
+            result.err_data[i] = math.sqrt(math.fabs(output.variance))
         return result
Index: sansdataloader/test/utest_manipulations.py
===================================================================
--- sansdataloader/test/utest_manipulations.py	(revision ca3b9c5d50642f889b5e4ad215325ebc3352ea06)
+++ sansdataloader/test/utest_manipulations.py	(revision e2605a5f99adf1a9dbc17dff4689412d687b0c6b)
@@ -133,11 +133,21 @@
     def setUp(self):
         # Create two data sets to play with
-        x_0 = 2.0*numpy.ones([5,4])
-        dx_0 = 0.5*numpy.ones([5,4])
-        self.data = Data2D(x_0, dx_0)
-        
-        y = numpy.ones([5,4])
-        dy = numpy.ones([5,4])
-        self.data2 = Data2D(y, dy)
+        x_0 = 2.0*numpy.ones(100)
+        dx_0 = 0.5*numpy.ones(100)
+        qx_0 = numpy.arange(100)
+        qy_0 = numpy.arange(100)
+        mask_0 = numpy.zeros(100)
+        dqx_0 = numpy.arange(100)/100
+        dqy_0 = numpy.arange(100)/100
+        q_0 = numpy.sqrt(qx_0 * qx_0 + qy_0 * qy_0)
+        self.data = Data2D(x_0, dx_0, qx_0, qy_0, q_0, mask_0, dqx_0, dqy_0)
+        
+        y = numpy.ones(100)
+        dy = numpy.ones(100)
+        qx = numpy.arange(100)
+        qy = numpy.arange(100)
+        mask = numpy.zeros(100)
+        q = numpy.sqrt(qx * qx + qy * qy)
+        self.data2 = Data2D(y, dy, qx, qy, q, mask)
         
         
@@ -147,94 +157,80 @@
         """
         # There should be 5 entries in the file
-        self.assertEqual(numpy.size(self.data.data, 0), 5)
-        self.assertEqual(numpy.size(self.data.data, 1), 4)
-        
-        for i in range(5):
-            for j in range(4):
-                # All y-error values should be 0.5
-                self.assertEqual(self.data.err_data[i][j], 0.5)    
-                
-                # All y values should be 2.0
-                self.assertEqual(self.data.data[i][j], 2.0)    
+        self.assertEqual(numpy.size(self.data.data), 100)
+        
+        for i in range(100):
+            # All y-error values should be 0.5
+            self.assertEqual(self.data.err_data[i], 0.5)    
+            
+            # All y values should be 2.0
+            self.assertEqual(self.data.data[i], 2.0)    
         
     def test_add(self):
         result = self.data2+self.data
-        for i in range(5):
-            for j in range(4):
-                self.assertEqual(result.data[i][j], 3.0)
-                self.assertEqual(result.err_data[i][j], math.sqrt(0.5**2+1.0))
+        for i in range(100):
+            self.assertEqual(result.data[i], 3.0)
+            self.assertEqual(result.err_data[i], math.sqrt(0.5**2+1.0))
         
     def test_sub(self):
         result = self.data2-self.data
-        for i in range(5):
-            for j in range(4):
-                self.assertEqual(result.data[i][j], -1.0)
-                self.assertEqual(result.err_data[i][j], math.sqrt(0.5**2+1.0))
+        for i in range(100):
+                self.assertEqual(result.data[i], -1.0)
+                self.assertEqual(result.err_data[i], math.sqrt(0.5**2+1.0))
         
     def test_mul(self):
         result = self.data2*self.data
-        for i in range(5):
-            for j in range(4):
-                self.assertEqual(result.data[i][j], 2.0)
-                self.assertEqual(result.err_data[i][j], math.sqrt((0.5*1.0)**2+(1.0*2.0)**2))
+        for i in range(100):
+            self.assertEqual(result.data[i], 2.0)
+            self.assertEqual(result.err_data[i], math.sqrt((0.5*1.0)**2+(1.0*2.0)**2))
         
     def test_div(self):
         result = self.data2/self.data
-        for i in range(5):
-            for j in range(4):
-                self.assertEqual(result.data[i][j], 0.5)
-                self.assertEqual(result.err_data[i][j], math.sqrt((1.0/2.0)**2+(0.5*1.0/4.0)**2))
+        for i in range(100):
+            self.assertEqual(result.data[i], 0.5)
+            self.assertEqual(result.err_data[i], math.sqrt((1.0/2.0)**2+(0.5*1.0/4.0)**2))
         
     def test_radd(self):
         result = self.data+3.0
-        for i in range(5):
-            for j in range(4):
-                self.assertEqual(result.data[i][j], 5.0)
-                self.assertEqual(result.err_data[i][j], 0.5)
+        for i in range(100):
+            self.assertEqual(result.data[i], 5.0)
+            self.assertEqual(result.err_data[i], 0.5)
             
         result = 3.0+self.data
-        for i in range(5):
-            for j in range(4):
-                self.assertEqual(result.data[i][j], 5.0)
-                self.assertEqual(result.err_data[i][j], 0.5)
+        for i in range(100):
+            self.assertEqual(result.data[i], 5.0)
+            self.assertEqual(result.err_data[i], 0.5)
             
     def test_rsub(self):
         result = self.data-3.0
-        for i in range(5):
-            for j in range(4):
-                self.assertEqual(result.data[i][j], -1.0)
-                self.assertEqual(result.err_data[i][j], 0.5)
+        for i in range(100):
+            self.assertEqual(result.data[i], -1.0)
+            self.assertEqual(result.err_data[i], 0.5)
             
         result = 3.0-self.data
-        for i in range(5):
-            for j in range(4):
-                self.assertEqual(result.data[i][j], 1.0)
-                self.assertEqual(result.err_data[i][j], 0.5)
+        for i in range(100):
+            self.assertEqual(result.data[i], 1.0)
+            self.assertEqual(result.err_data[i], 0.5)
             
     def test_rmul(self):
         result = self.data*3.0
-        for i in range(5):
-            for j in range(4):
-                self.assertEqual(result.data[i][j], 6.0)
-                self.assertEqual(result.err_data[i][j], 1.5)
+        for i in range(100):
+            self.assertEqual(result.data[i], 6.0)
+            self.assertEqual(result.err_data[i], 1.5)
             
         result = 3.0*self.data
-        for i in range(5):
-            for j in range(4):
-                self.assertEqual(result.data[i][j], 6.0)
-                self.assertEqual(result.err_data[i][j], 1.5)
+        for i in range(100):
+            self.assertEqual(result.data[i], 6.0)
+            self.assertEqual(result.err_data[i], 1.5)
             
     def test_rdiv(self):
         result = self.data/4.0
-        for i in range(5):
-            for j in range(4):
-                self.assertEqual(result.data[i][j], 0.5)
-                self.assertEqual(result.err_data[i][j], 0.125)
+        for i in range(100):
+            self.assertEqual(result.data[i], 0.5)
+            self.assertEqual(result.err_data[i], 0.125)
             
         result = 6.0/self.data
-        for i in range(5):
-            for j in range(4):
-                self.assertEqual(result.data[i][j], 3.0)
-                self.assertEqual(result.err_data[i][j], 6.0*0.5/4.0)
+        for i in range(100):
+            self.assertEqual(result.data[i], 3.0)
+            self.assertEqual(result.err_data[i], 6.0*0.5/4.0)
             
 
