source: sasview/test/sascalculator/test/utest_resolution_calculator.py @ b699768

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 b699768 was b699768, checked in by Piotr Rozyczko <piotr.rozyczko@…>, 8 years ago

Initial commit of the refactored SasCalc? module.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1"""
2    Unit test for resolution_calculator
3"""
4
5import unittest
6from  sas.sascalc.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.