source: sasview/sanscalculator/test/utest_resolution_calculator.py @ ca2bdae

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since ca2bdae was 4ff95e9, checked in by Jae Cho <jhjcho@…>, 13 years ago

move out test folder to sanscalculator

  • Property mode set to 100644
File size: 1.2 KB
Line 
1"""
2    Unit test for resolution_calculator
3"""
4
5import unittest
6from  sans.calculator.resolution_calculator import ResolutionCalculator \
7                                            as calculator
8
9class resolution_calculator(unittest.TestCase):
10   
11    def setUp(self):
12       
13        self.cal = calculator()
14       
15    def test_resolution_calculation(self):
16        """
17            Test resolution_calculator"
18        """
19        self.cal.set_wavelength(15)
20        self.cal.set_source_aperture_size([2])
21        self.cal.set_sample_aperture_size([1])
22        self.cal.set_detector_pix_size([1])
23        self.cal.set_source2sample_distance([1500])
24        self.cal.set_sample2detector_distance([1500])
25        self.cal.set_wavelength_spread(0.1)
26        # all instr. params for cal
27        self.cal.get_all_instrument_params()
28        qr, phi, sigma_1, sigma_2, _, sigma_1d = self.cal.compute(15, 0.1, 
29                                                        0, 0, coord = 'polar')
30        sigma_1d = self.cal.sigma_1d
31       
32        # The value "0.000213283" was obtained by manual calculation.
33        self.assertAlmostEqual(sigma_1d,   0.000213283, 5)
34       
35       
36if __name__ == '__main__':
37    unittest.main()
38   
Note: See TracBrowser for help on using the repository browser.