source: sasview/test/sasdataloader/test/utest_sesans.py @ 7e56311

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.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 7e56311 was 7e56311, checked in by Adam Washington <adam.washington@…>, 3 years ago

More tests on TOF Sesans

  • Property mode set to 100644
File size: 1.4 KB
Line 
1"""
2    Unit tests for the SESANS .ses reader
3"""
4
5import unittest
6from sas.sascalc.dataloader.loader import Loader
7
8
9class sesans_reader(unittest.TestCase):
10
11    def setUp(self):
12        self.loader = Loader()
13
14    def test_sesans_load(self):
15        """
16            Test .SES file loading
17        """
18        f = self.loader.load("sphere2micron.ses")
19        # self.assertEqual(f, 5)
20        self.assertEqual(len(f.x), 40)
21        self.assertEqual(f.x[0], 391.56)
22        self.assertEqual(f.x[-1], 46099)
23        self.assertEqual(f.y[-1], -0.19956)
24        self.assertEqual(f.x_unit, "A")
25        self.assertEqual(f.y_unit, "A-2 cm-1")
26        self.assertEqual(f.sample.name, "Polystyrene 2 um in 53% H2O, 47% D2O")
27        self.assertEqual(f.sample.thickness, 0.2)
28        self.assertEqual(f.sample.zacceptance, (0.0168, "radians"))
29        self.assertEqual(f.isSesans, True)
30
31    def test_sesans_tof(self):
32        """
33            Test .SES loading on a TOF dataset
34        """
35        f = self.loader.load("sphere_isis.ses")
36        self.assertEqual(len(f.x), 57)
37        self.assertEqual(f.x[-1], 19303.4)
38        self.assertEqual(f.source.wavelength[-1], 13.893668)
39        self.assertEqual(f.source.wavelength[0], 1.612452)
40        self.assertEqual(f.sample.yacceptance, (0.09, "radians"))
41        self.assertEqual(f.sample.zacceptance, (0.09, "radians"))
42        self.assertEqual(f.sample.thickness, 0.2)
43
44
45if __name__ == "__main__":
46    unittest.main()
Note: See TracBrowser for help on using the repository browser.