magnetic_scattrelease-4.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since 5bb05a4 was
959eb01,
checked in by ajj, 7 years ago
|
normalising line endings
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | """ |
---|
2 | Unit test for resolution_calculator |
---|
3 | """ |
---|
4 | |
---|
5 | import unittest |
---|
6 | from sas.sascalc.calculator.resolution_calculator import ResolutionCalculator \ |
---|
7 | as calculator |
---|
8 | |
---|
9 | class 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 | |
---|
36 | if __name__ == '__main__': |
---|
37 | unittest.main() |
---|
38 | |
---|
Note: See
TracBrowser
for help on using the repository browser.