Changeset 7ef319e in sasview for sansmodels/src/sans


Ignore:
Timestamp:
Oct 21, 2009 12:36:35 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
81bece4
Parents:
156a0b2
Message:

test model at q=0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/test/utest_other_models.py

    ra65ffcb r7ef319e  
    55            Some models return limit of the function at critical point . 
    66            So the user should expect finite value for some critical points. 
     7            Only critical q=0 will be tested.  
     8             
     9            Critical points tests that fail. the user is responsible of changing 
     10            the model tested or document the failure. 
     11             
    712            Initial values for models are given as the one of Igo software. 
    813    @author: Gervaise Alina / UTK 
     14    @summary: Run by G. Alina 10/21/2009 
     15            Most of the lamellar tests are not passing. Check lamellar im 
     16            plementation. 
     17            critial points tested not passing for: 
     18            - Flexible Cylinder 
     19            - PeakLorenzt 
     20            - Squarewell Structure 
     21            - StickyHstructure 
     22            - hardSphereStructure 
     23             
     24             
    925""" 
    1026 
     
    5672        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    5773         
    58          
     74    def testCriticalPoint(self): 
     75        """ Test coreshell at the critical point""" 
     76        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
    5977   
    6078class TestMultiShellModel(unittest.TestCase): 
     
    102120        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    103121     
     122    def testCriticalPoint(self): 
     123        """ Test multishell at the critical point""" 
     124        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
    104125     
    105126class TestVesicleModel(unittest.TestCase): 
     
    145166        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    146167     
    147        
     168    def testCriticalPoint(self): 
     169        """ Test vesicle at the critical point""" 
     170        self.assert_(numpy.isfinite(self.comp.run(0.0)))  
     171         
     172         
    148173class TestBinaryHSModel(unittest.TestCase): 
    149174    """ Unit tests for BinaryHS Model""" 
     
    189214        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    190215        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    191       
     216         
     217    def testCriticalPoint(self): 
     218        """ Test BinaryHS at the critical point""" 
     219        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
     220        
    192221      
    193222class TestCoreShellCylinderModel(unittest.TestCase): 
     
    242271        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    243272  
     273    def testCriticalPoint(self): 
     274        """ Test CoreShellCylinder at the critical point""" 
     275        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
     276  
    244277  
    245278class TestHollowCylinderModel(unittest.TestCase): 
     
    291324        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    292325         
     326    def testCriticalPoint(self): 
     327        """ Test HollowCylinder at the critical point""" 
     328        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
     329         
    293330         
    294331class TestFlexibleCylinderModel(unittest.TestCase): 
     
    340377        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    341378    
     379    def testCriticalPoint(self): 
     380        """ Test FlexibleCylinder at the critical point""" 
     381        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
    342382   
    343383               
     
    396436        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    397437        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    398    
     438     
     439    def testCriticalPoint(self): 
     440        """ Test StackedDisks at the critical point""" 
     441        self.assert_(numpy.isfinite(self.comp.run(0.0)))  
     442    
    399443   
    400444class TestParallelepipedModel(unittest.TestCase): 
     
    448492        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    449493    
     494    def testCriticalPoint(self): 
     495        """ Test Parallelepiped at the critical point""" 
     496        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
    450497   
    451498class TestEllipticalCylinderModel(unittest.TestCase): 
     
    499546        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    500547        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    501          
     548     
     549    def testCriticalPoint(self): 
     550        """ Test EllipticalCylinder at the critical point""" 
     551        self.assert_(numpy.isfinite(self.comp.run(0.0)))  
    502552   
    503553         
     
    549599        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    550600        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    551          
     601     
     602    def testCriticalPoint(self): 
     603        """ Test Ellipsoid at the critical point""" 
     604        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
    552605         
    553606class TestCoreShellEllipsoidModel(unittest.TestCase): 
     
    603656        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    604657        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    605   
     658     
     659    def testCriticalPoint(self): 
     660        """ Test CoreShellEllipsoid at the critical point""" 
     661        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
    606662     
    607663class TestTriaxialEllipsoidModel(unittest.TestCase): 
     
    656712        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    657713        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    658                       
     714     
     715    def testCriticalPoint(self): 
     716        """ Test TriaxialEllipsoid at the critical point""" 
     717        self.assert_(numpy.isfinite(self.comp.run(0.0)))             
    659718    
    660719class TestLamellarModel(unittest.TestCase): 
     
    699758        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8)         
    700759    
     760    def testCriticalPoint(self): 
     761        """ Test Lamellar at the critical point""" 
     762        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
    701763      
    702764class TestLamellarFFHGModel(unittest.TestCase): 
     
    743805        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    744806        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8)         
    745                    
     807     
     808    def testCriticalPoint(self): 
     809        """ Test LamellarFFHG at the critical point""" 
     810        self.assert_(numpy.isfinite(self.comp.run(0.0)))               
    746811     
    747812class TestLamellarPSModel(unittest.TestCase): 
     
    789854        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8)         
    790855             
    791       
     856    def testCriticalPoint(self): 
     857        """ Test LamellarPS at the critical point""" 
     858        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
    792859      
    793860class TestLamellarPSHGModel(unittest.TestCase): 
     
    836903        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    837904        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8)         
    838       
     905     
     906    def testCriticalPoint(self): 
     907        """ Test LamellarPSHG at the critical point""" 
     908        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
    839909      
    840910class TestSquareWellStructure(unittest.TestCase): 
     
    878948        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    879949        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    880                           
     950     
     951    def testCriticalPoint(self): 
     952        """ Test SquareWellStructure at the critical point""" 
     953        self.assert_(numpy.isfinite(self.comp.run(0.0)))                      
    881954      
    882955class TestHardsphereStructure(unittest.TestCase): 
     
    917990        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    918991        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    919                        
     992     
     993    def testCriticalPoint(self): 
     994        """ Test HardsphereStructure at the critical point""" 
     995        self.assert_(numpy.isfinite(self.comp.run(0.0)))                   
    920996     
    921997class TestStickyHSStructure(unittest.TestCase): 
     
    9521028        self.assertEquals(self.comp.run(1.3),self.x_array[1]) 
    9531029         
    954          
    9551030    def testEval_2D(self): 
    9561031        """ Test 2D model for a StickyHSStructure with evalDistribution""" 
     
    9601035        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    9611036                
    962       
     1037    def testCriticalPoint(self): 
     1038        """ Test StickyHSStructure at the critical point""" 
     1039        self.assert_(numpy.isfinite(self.comp.run(0.0)))  
    9631040         
    9641041class TestHayterMSAStructure(unittest.TestCase): 
     
    10031080        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    10041081        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    1005                         
     1082     
     1083    def testCriticalPoint(self): 
     1084        """ Test HayterMSAStructure at the critical point""" 
     1085        self.assert_(numpy.isfinite(self.comp.run(0.0)))                    
    10061086      
    10071087      
     
    10441124        self.assertEquals(self.comp.run(1.3),self.x_array[1]) 
    10451125         
    1046          
    10471126    def testEval_2D(self): 
    10481127        """ Test 2D model for a BEPolyelectrolyte with evalDistribution""" 
     
    10511130        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    10521131        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    1053                 
     1132    
     1133    def testCriticalPoint(self): 
     1134        """ Test BEPolyelectrolyte at the critical point""" 
     1135        self.assert_(numpy.isfinite(self.comp.run(0.0)))             
     1136              
    10541137              
    10551138class TestDABModel(unittest.TestCase): 
     
    10851168        self.assertEquals(self.comp.run(1.3),self.x_array[1]) 
    10861169         
    1087          
    10881170    def testEval_2D(self): 
    10891171        """ Test 2D model for a DABModel with evalDistribution""" 
     
    10921174        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    10931175        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    1094                 
     1176     
     1177    def testCriticalPoint(self): 
     1178        """ Test DABModel at the critical point""" 
     1179        self.assert_(numpy.isfinite(self.comp.run(0.0)))            
    10951180              
    10961181     
     
    11131198        self.xy_matrix = self.comp.evalDistribution([qx_prime, qy_prime]) 
    11141199         
    1115          
    11161200    def test1D(self): 
    11171201        """ Test 1D model for a GuinierModel""" 
     
    11221206        self.assertAlmostEqual(self.comp.run([1.0, 1.3]),0.716531, 4) 
    11231207      
    1124          
    11251208    def testEval_1D(self): 
    11261209        """ Test 1D model for a GuinierModel with evalDistribution""" 
     
    11351218        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    11361219     
     1220    def testCriticalPoint(self): 
     1221        """ Test GuinierModel at the critical point""" 
     1222        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
    11371223         
    11381224         
     
    11761262        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    11771263     
     1264    def testCriticalPoint(self): 
     1265        """ Test DebyeModel at the critical point""" 
     1266        self.assertEquals(self.comp.run(0.0),1.001) 
     1267         
    11781268        
    11791269class TestPorodModel(unittest.TestCase): 
     
    12151305        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    12161306     
    1217     def testCreaticalPt(self): 
     1307    def testCreaticalPoint(self): 
    12181308        """ Test for critical point for PorodModel run""" 
    12191309        self.assertRaises(ZeroDivisionError, self.comp.run, 0.0) 
     
    12591349        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    12601350        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    1261          
     1351     
     1352    def testCriticalPoint(self): 
     1353        """ Test PeakGauss at the critical point""" 
     1354        self.assert_(numpy.isfinite(self.comp.run(0.0)))     
    12621355         
    12631356class TestPeakLorentzModel(unittest.TestCase): 
     
    13011394        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    13021395         
    1303          
     1396    def testCriticalPoint(self): 
     1397        """ Test PeakLorentz at the critical point""" 
     1398        self.comp.setParam('B', 0.0) 
     1399        self.assertRaises(ZeroDivisionError, self.comp.run, 10) 
     1400        self.assert_(numpy.isfinite(self.comp.run(0.0)))   
     1401         
     1402        
    13041403class TestFractalAbsModel(unittest.TestCase): 
    13051404    """ Unit tests for FractalAbsModel""" 
     
    13441443        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    13451444        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    1346          
     1445     
     1446    def testCriticalPoint(self): 
     1447        """ Test Fractal Abs at the critical point""" 
     1448        self.assert_(numpy.isfinite(self.comp.run(0.0)))     
    13471449    
    13481450class TestFractalModel(unittest.TestCase): 
     
    13891491        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    13901492         
     1493    def testCriticalPoint(self): 
     1494        """ Test Fractal at the critical point""" 
     1495        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
    13911496     
    13921497class TestLorentzModel(unittest.TestCase): 
     
    14281533        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    14291534        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    1430              
     1535           
     1536    def testCriticalPoint(self): 
     1537        """ Test Lorentz at the critical point""" 
     1538        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
     1539         
     1540           
    14311541class TestPowerLawAbsModel(unittest.TestCase): 
    14321542    """ Unit tests for PowerLawAbsModel""" 
     
    14671577        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    14681578     
     1579    def testCriticalPoint(self): 
     1580        """ Test PowerLawAbs at the critical point""" 
     1581        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
     1582         
     1583         
    14691584class TestPowerLawModel(unittest.TestCase): 
    14701585    """ Unit tests for PowerLawModel""" 
     
    15041619        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    15051620        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
     1621     
     1622    def testCriticalPoint(self): 
     1623        """ Test PowerLawModel at the critical point""" 
     1624        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
    15061625       
    15071626       
     
    15441663        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    15451664        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    1546          
     1665     
     1666    def testCriticalPoint(self): 
     1667        """ Test TeubnerStrey at the critical point""" 
     1668        self.assert_(numpy.isfinite(self.comp.run(0.0)))     
     1669       
    15471670       
    15481671class TestLineModel(unittest.TestCase): 
     
    15781701        self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 
    15791702        self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 
    1580    
     1703     
     1704    def testCriticalPoint(self): 
     1705        """ Test line at the critical point""" 
     1706        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
    15811707  
    15821708if __name__ == '__main__': 
Note: See TracChangeset for help on using the changeset viewer.