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 e5df560 was
7c372f8,
checked in by Jae Cho <jhjcho@…>, 14 years ago
|
updated resolution cal utest
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[3be3a80] | 1 | """ |
---|
| 2 | Unit test for resolution_calculator |
---|
| 3 | """ |
---|
| 4 | |
---|
| 5 | import unittest |
---|
| 6 | from sans.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) |
---|
[7c372f8] | 26 | qr, phi, sigma_1, sigma_2, _ = self.cal.compute(0, 0, coord = 'polar') |
---|
[3be3a80] | 27 | sigma_1d = self.cal.sigma_1d |
---|
| 28 | |
---|
| 29 | # The value "0.000213283" was obtained by manual calculation. |
---|
| 30 | self.assertAlmostEqual(sigma_1d, 0.000213283, 5) |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | if __name__ == '__main__': |
---|
| 34 | unittest.main() |
---|
| 35 | |
---|
Note: See
TracBrowser
for help on using the repository browser.