Changeset 4026380 in sasview for DataLoader/test/utest_invariant.py


Ignore:
Timestamp:
Nov 14, 2009 10:33:21 AM (15 years ago)
Author:
Mathieu Doucet <doucetm@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
fd6b789
Parents:
c13b8cc
Message:

dataloader: improved invariant

File:
1 edited

Legend:

Unmodified
Added
Removed
  • DataLoader/test/utest_invariant.py

    rac13512 r4026380  
    1515     
    1616    def setUp(self): 
    17         #Data iwth no slit smear information 
    18         data0= Loader().load("PolySpheres.txt") 
    19         self.I0 = InvariantCalculator( data= data0,contrast=2.6e-6, pConst=20) 
     17        #Data with no slit smear information 
     18        data0 = Loader().load("PolySpheres.txt") 
     19        self.I0 = InvariantCalculator( data=data0) 
     20         
    2021        # data with smear info 
    2122        list = Loader().load("latex_smeared.xml") 
    2223        data1= list[0] 
    23         self.I1= InvariantCalculator( data= data1,contrast=5.3e-6, pConst=20) 
     24        self.I1= InvariantCalculator( data= data1) 
     25         
    2426        data2= list[1] 
    25         self.I2= InvariantCalculator( data= data2,contrast=5.3e-6, pConst=20) 
     27        self.I2= InvariantCalculator( data= data2) 
    2628      
    27     def testInvariant(self): 
     29    def test_invariant(self): 
    2830        """ test the invariant value for data with no slit smear""" 
    2931        self.assertAlmostEquals(self.I0.q_star, 7.48959e-5) 
     32        self.assertTrue(self.I1.q_star>0) 
     33        self.assertTrue(self.I2.q_star>0) 
    3034         
    31          
    32     def test_Computation(self): 
     35    def test_computation(self): 
    3336        """ 
    3437            Test identity smearing 
    3538        """ 
    36         # compute invariant with smear information 
    37         print "invariant initialized only with data:", self.I1 
    38         print "invariant q_star",self.I1.q_star 
    39         print "invariant volume",self.I1.volume 
    40         print "Invariant surface",self.I1.surface 
    41         print 
    42         print "invariant initialized __call__:", self.I1 
    43         print "invariant q_star",self.I1.q_star 
    44         print "invariant volume",self.I1.volume 
    45         print "Invariant surface",self.I1.surface 
    46         print 
    47         # compute invariant with smear information 
    48         print "invariant initialize with data, contrast,pConst:", self.I2 
    49         print "invariant q_star",self.I2.q_star 
    50         print "invariant volume",self.I2.volume 
    51         print "Invariant surface",self.I2.surface 
    52         print 
     39        vol = self.I0.get_volume_fraction(contrast=2.6e-6) 
     40        surface = self.I0.get_surface(contrast=2.6e-6, porod_const=20) 
     41         
     42        # TODO: Need to test output values 
     43        #self.assertAlmostEquals(vol, 0) 
     44        #self.assertAlmostEquals(surface, 0) 
     45        vol = self.I1.get_volume_fraction(contrast=5.3e-6) 
     46        surface = self.I1.get_surface(contrast=5.3e-6, porod_const=20) 
     47         
     48        # TODO: Need to test output values 
     49        #self.assertAlmostEquals(vol, 0) 
     50        #self.assertAlmostEquals(surface, 0) 
     51         
     52        vol = self.I2.get_volume_fraction(contrast=5.3e-6) 
     53        surface = self.I2.get_surface(contrast=5.3e-6, porod_const=20) 
     54         
     55        # TODO: Need to test output values 
     56        self.assertAlmostEquals(vol, 0) 
     57        self.assertAlmostEquals(surface, 0) 
     58         
    5359       
    5460         
Note: See TracChangeset for help on using the changeset viewer.