source: sasview/test/sasdataloader/test/utest_sesans.py @ ebed4de

ESS_GUIESS_GUI_CategroyManagerESS_GUI_PrESS_GUI_corfESS_GUI_py2_OLDSVCC-1costrafo411docsticket-1032-slditicket-776-orientationticket-873ticket-976ticket1007trueunittest-saveload
Last change on this file since ebed4de was ebed4de, checked in by Adam Washington <adam.washington@…>, 8 months ago

Start adding TOF file

  • Property mode set to 100644
File size: 1.2 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
40
41if __name__ == "__main__":
42    unittest.main()
Note: See TracBrowser for help on using the repository browser.