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 6df04e43 was
4ff95e9,
checked in by Jae Cho <jhjcho@…>, 13 years ago
|
move out test folder to sanscalculator
|
-
Property mode set to
100644
|
File size:
880 bytes
|
Line | |
---|
1 | """ |
---|
2 | Unit tests for slit_length_calculator |
---|
3 | """ |
---|
4 | |
---|
5 | import unittest |
---|
6 | from DataLoader.readers.ascii_reader import Reader |
---|
7 | from sans.calculator.slit_length_calculator import SlitlengthCalculator as calculator |
---|
8 | |
---|
9 | import os.path |
---|
10 | |
---|
11 | class slit_calculator(unittest.TestCase): |
---|
12 | |
---|
13 | def setUp(self): |
---|
14 | |
---|
15 | self.reader = Reader() |
---|
16 | |
---|
17 | def test_slitlength_calculation(self): |
---|
18 | """ |
---|
19 | Test slit_length_calculator" |
---|
20 | """ |
---|
21 | f = self.reader.read("beam profile.DAT") |
---|
22 | cal = calculator() |
---|
23 | cal.set_data(f.x,f.y) |
---|
24 | slitlength = cal.calculate_slit_length() |
---|
25 | |
---|
26 | # The value "5.5858" was obtained by manual calculation. |
---|
27 | # It turns out our slit length is FWHM/2 |
---|
28 | self.assertAlmostEqual(slitlength,5.5858/2, 3) |
---|
29 | |
---|
30 | |
---|
31 | if __name__ == '__main__': |
---|
32 | unittest.main() |
---|
33 | |
---|
Note: See
TracBrowser
for help on using the repository browser.