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 7034fc0 was
117a1d6,
checked in by Mathieu Doucet <doucetm@…>, 13 years ago
|
Re #5 improving tests
|
-
Property mode set to
100644
|
File size:
885 bytes
|
Line | |
---|
1 | """ |
---|
2 | Unit tests for slit_length_calculator |
---|
3 | """ |
---|
4 | |
---|
5 | import unittest |
---|
6 | from sans.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.