Index: DataLoader/data_info.py
===================================================================
--- DataLoader/data_info.py	(revision fe78c7be16b3ca74072592fdeda007c4a989ce82)
+++ DataLoader/data_info.py	(revision 402638003032f4d9388c4b1ecea223c441d7c421)
@@ -564,4 +564,19 @@
         return _str
 
+    def is_slit_smeared(self):
+        """
+            Check whether the data has slit smearing information
+            
+            @return: True is slit smearing info is present, False otherwise
+        """
+        def _check(v):            
+            if (v.__class__==list or v.__class__==numpy.ndarray) \
+                and len(v)>0 and min(v)>0:
+                return True
+            
+            return False
+        
+        return _check(self.dxl) or _check(self.dxw)
+        
     def clone_without_data(self, length=0, clone=None):
         """
Index: DataLoader/invariant.py
===================================================================
--- DataLoader/invariant.py	(revision 01fb70bc9cd85ee19ac47a7039df8c183febb9ee)
+++ DataLoader/invariant.py	(revision 402638003032f4d9388c4b1ecea223c441d7c421)
@@ -14,5 +14,5 @@
         @note: The data boundaries are assumed as infinite range. 
     """
-    def __init__(self, data,contrast=None, pConst=None):
+    def __init__(self, data):
         """
             Initialize variables
@@ -21,18 +21,8 @@
             @param pConst: Porod Constant of type float
         """
-        self.q_star = self.getQstar(data= data)
-        self.volume = self._getVolFrac(contrast= contrast)
-        self.surface= self._getSurface(pConst= pConst)
+        ## Invariant
+        self.q_star = self._get_q_star(data= data)
         
-    def __call__(self, contrast, pConst):
-        """
-            @precondition: self.q_star has already been computed
-        """
-        self.volume = self._getVolFrac(contrast= contrast)
-        self.surface = self._getSurface(pConst= pConst)
-        
-        return self
-        
-    def getQstar(self, data):
+    def _get_q_star(self, data):
         """
             @param data: data of type Data1D
@@ -42,12 +32,14 @@
             #Process only data that inherited from DataLoader.Data_info.Data1D
             raise ValueError,"Data must be of type DataLoader.Data1D"
-        if data.dxl == None:
-            return self._getQStarUnsmear(data= data)
+        
+        # Check whether we have slit smearing information
+        if data.is_slit_smeared():
+            return self._get_qstar_unsmeared(data= data)
         else:
-            return self._getQStarSmear(data= data)
+            return self._get_qstar_smeared(data= data)
     
             
             
-    def _getQStarUnsmear(self, data):
+    def _get_qstar_unsmeared(self, data):
         """
             @param data: data of type Data1D
@@ -86,8 +78,8 @@
             
                
-    def _getQStarSmear(self, data):
+    def _get_qstar_smeared(self, data):
         """
             @param data: data of type Data1D
-            Compute invariant with smearing info
+            Compute invariant with slit smearing info
             q_star= x0*dxl *y0 *dx0 + x1*dxl *y1 *dx1 + ..+ xn*dxl *yn *dxn 
             where n= infinity
@@ -125,5 +117,5 @@
                 return sum
         
-    def _getVolFrac(self,contrast):
+    def get_volume_fraction(self, contrast):
         """
             Compute volume fraction is given by:
@@ -137,22 +129,18 @@
                 q_star unit  1/A^(3)*1/cm
                 
-            the result returned will be 0<= volume <= 1 or None
+            the result returned will be 0<= volume <= 1
             
             @param contrast: contrast value provides by the user of type float
-            @return None : if the invariant Calculator does not a computed
-            q_star already  stored
+            @return: volume fraction
             @note: volume fraction must have no unit
         """
-        if contrast ==None:
-            #No contrast value is provided for calculation then no calculation
-            return 
         if contrast < 0:
             raise ValueError, "contrast must be greater than zero"  
         
         if self.q_star ==None:
-            return  
+            raise RuntimeError, "Q_star is not defined"
         
         if self.q_star < 0:
-            raise ValueError, "invariant must be greater than zero"
+            raise ValueError, "invariant must be greater than zero. Q_star=%g" % self.q_star
        
         #compute intermediate constant
@@ -161,5 +149,5 @@
         discrim= 1 - 4*k
         if discrim < 0:
-            return 
+            raise RuntimeError, "could not compute the volume fraction: negative discriminant"
         elif discrim ==0:
             volume = 1/2
@@ -169,6 +157,4 @@
             volume1 = 0.5 *(1 - math.sqrt(discrim))
             volume2 = 0.5 *(1 + math.sqrt(discrim))
-            print "volume1",volume1
-            print "volume2",volume2
            
             if 0<= volume1 and volume1 <= 1:
@@ -176,24 +162,26 @@
             elif 0<= volume2 and volume2<= 1: 
                 return volume2 
-            return 
+            raise RuntimeError, "could not compute the volume fraction: inconsistent results"
     
-    def _getSurface(self, pConst, volume=None):
+    def get_surface(self, contrast, porod_const):
         """
             Compute the surface given by:
                 surface = (2*pi *volume(1- volume)*pConst)/ q_star
-            @param volume : volume previously calculated
-            @return None: if volume used for computation equal None
+                
+            @param contrast: contrast value provides by the user of type float
+            @param porod_const: Porod constant 
+            @return: specific surface
         """
-        #check if the user provides a value for volume
-        if volume != None:
-            self.volume = float(volume)
+        # Compute the volume
+        volume = self.get_volume_fraction(contrast)
         
-        #return None if volume or q_star is not computed
-        if self.q_star ==None or self.volume == None:
-            return 
+        # Check whether we have Q star
+        if self.q_star ==None:
+            raise RuntimeError, "Q_star is not defined"
+        
         if self.q_star ==0:
-            raise ZeroDivisionError, "invariant must be greater than zero"
+            raise ValueError, "invariant must be greater than zero. Q_star=%g" % self.q_star
         
-        return 2*math.pi*self.volume*(1- self.volume)*float(pConst)/self.q_star
+        return 2*math.pi*volume*(1-volume)*float(porod_const)/self.q_star
         
         
Index: DataLoader/test/utest_invariant.py
===================================================================
--- DataLoader/test/utest_invariant.py	(revision ac13512bccad81de2024a452befaf9d95a7682e8)
+++ DataLoader/test/utest_invariant.py	(revision 402638003032f4d9388c4b1ecea223c441d7c421)
@@ -15,40 +15,46 @@
     
     def setUp(self):
-        #Data iwth no slit smear information
-        data0= Loader().load("PolySpheres.txt")
-        self.I0 = InvariantCalculator( data= data0,contrast=2.6e-6, pConst=20)
+        #Data with no slit smear information
+        data0 = Loader().load("PolySpheres.txt")
+        self.I0 = InvariantCalculator( data=data0)
+        
         # data with smear info
         list = Loader().load("latex_smeared.xml")
         data1= list[0]
-        self.I1= InvariantCalculator( data= data1,contrast=5.3e-6, pConst=20)
+        self.I1= InvariantCalculator( data= data1)
+        
         data2= list[1]
-        self.I2= InvariantCalculator( data= data2,contrast=5.3e-6, pConst=20)
+        self.I2= InvariantCalculator( data= data2)
      
-    def testInvariant(self):
+    def test_invariant(self):
         """ test the invariant value for data with no slit smear"""
         self.assertAlmostEquals(self.I0.q_star, 7.48959e-5)
+        self.assertTrue(self.I1.q_star>0)
+        self.assertTrue(self.I2.q_star>0)
         
-        
-    def test_Computation(self):
+    def test_computation(self):
         """
             Test identity smearing
         """
-        # compute invariant with smear information
-        print "invariant initialized only with data:", self.I1
-        print "invariant q_star",self.I1.q_star
-        print "invariant volume",self.I1.volume
-        print "Invariant surface",self.I1.surface
-        print
-        print "invariant initialized __call__:", self.I1
-        print "invariant q_star",self.I1.q_star
-        print "invariant volume",self.I1.volume
-        print "Invariant surface",self.I1.surface
-        print
-        # compute invariant with smear information
-        print "invariant initialize with data, contrast,pConst:", self.I2
-        print "invariant q_star",self.I2.q_star
-        print "invariant volume",self.I2.volume
-        print "Invariant surface",self.I2.surface
-        print
+        vol = self.I0.get_volume_fraction(contrast=2.6e-6)
+        surface = self.I0.get_surface(contrast=2.6e-6, porod_const=20)
+        
+        # TODO: Need to test output values
+        #self.assertAlmostEquals(vol, 0)
+        #self.assertAlmostEquals(surface, 0)
+        vol = self.I1.get_volume_fraction(contrast=5.3e-6)
+        surface = self.I1.get_surface(contrast=5.3e-6, porod_const=20)
+        
+        # TODO: Need to test output values
+        #self.assertAlmostEquals(vol, 0)
+        #self.assertAlmostEquals(surface, 0)
+        
+        vol = self.I2.get_volume_fraction(contrast=5.3e-6)
+        surface = self.I2.get_surface(contrast=5.3e-6, porod_const=20)
+        
+        # TODO: Need to test output values
+        self.assertAlmostEquals(vol, 0)
+        self.assertAlmostEquals(surface, 0)
+        
       
         
