Changeset ef908db in sasview for test/sasdataloader


Ignore:
Timestamp:
Mar 19, 2016 10:42:09 AM (8 years ago)
Author:
krzywon
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:
66f21cd
Parents:
05fb3d6b
Message:

Remove all tests referring to saview Models and delete unused test files.

Location:
test/sasdataloader/test
Files:
9 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • test/sasdataloader/test/utest_smearing.py

    rfc18690 ref908db  
    1010#from DataLoader.qsmearing import SlitSmearer, QSmearer, smear_selection 
    1111from sas.sascalc.data_util.qsmearing import SlitSmearer, QSmearer, smear_selection 
    12 from sas.models.SphereModel import SphereModel 
    1312import os.path 
    1413from time import time 
     
    9291        for i in range(len(input)): 
    9392            self.assertAlmostEqual(answer[i], output[i], 2) 
    94        
    95 class smear_test_1Dpinhole(unittest.TestCase): 
    96      
    97     def setUp(self): 
    98         # NIST sample data 
    99         self.data = Loader().load("CMSphere5.txt") 
    100         # NIST smeared sphere w/ param values below 
    101         self.answer = Loader().load("CMSphere5smearsphere.txt") 
    102         # call spheremodel 
    103         self.model = SphereModel() 
    104         # setparams consistent with Igor default 
    105         self.model.setParam('scale', 1.0) 
    106         self.model.setParam('background', 0.01) 
    107         self.model.setParam('radius', 60.0) 
    108         self.model.setParam('sldSolv', 6.3e-06) 
    109         self.model.setParam('sldSph', 1.0e-06) 
    110          
    111     def test_q(self): 
    112         """ 
    113         Compare Pinhole resolution smearing with NIST 
    114         """ 
    115         # x values 
    116         input = numpy.zeros(len(self.data.x)) 
    117         # set time 
    118         st1 = time() 
    119         # cal I w/o smear 
    120         input = self.model.evalDistribution(self.data.x) 
    121         # Cal_smear (first call) 
    122         for i in range(1000): 
    123             s = QSmearer(self.data, self.model) 
    124         # stop and record time taken 
    125         first_call_time = time()-st1 
    126         # set new time 
    127         st = time() 
    128         # cal I w/o smear (this is not neccessary to call but just to be fare 
    129         input = self.model.evalDistribution(self.data.x) 
    130         # smear cal (after first call done above) 
    131         for i in range(1000): 
    132             output = s(input) 
    133  
    134         # record time taken 
    135         last_call_time = time()-st 
    136         # compare the ratio of ((NIST_answer-SsanView_answer)/NIST_answer) 
    137         # If the ratio less than 1%, pass the test  
    138         for i in range(len(self.data.x)): 
    139             ratio  = math.fabs((self.answer.y[i]-output[i])/self.answer.y[i]) 
    140             if ratio > 0.006: 
    141                 ratio = 0.006 
    142             self.assertEqual(math.fabs((self.answer.y[i]-output[i])/ \ 
    143                                        self.answer.y[i]), ratio)  
    144         # print 
    145         print "\n NIST_time = 10sec:" 
    146         print "Cal_time(1000 times of first_calls; ) = ",  first_call_time   
    147         print "Cal_time(1000 times of calls) = ",  last_call_time  
    14893         
    14994if __name__ == '__main__': 
Note: See TracChangeset for help on using the changeset viewer.