source: sasview/test/pr_inversion/test/utest_explorer.py @ 1852b17

magnetic_scattrelease-4.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1249
Last change on this file since 1852b17 was 1852b17, checked in by Paul Kienzle <pkienzle@…>, 6 years ago

fix pylint relative import error on pr_inversion test (reprise)

  • Property mode set to 100644
File size: 1.1 KB
Line 
1"""
2    Unit tests for DistExplorer class
3"""
4
5import sys
6import os.path
7import unittest, math, numpy
8from sas.sascalc.pr.invertor import Invertor
9from sas.sascalc.pr.distance_explorer import DistExplorer
10
11try:
12    from utest_invertor import load
13except ImportError:
14    from .utest_invertor import load
15
16def find(filename):
17    return os.path.join(os.path.dirname(__file__), filename)
18
19
20class TestExplorer(unittest.TestCase):
21           
22    def setUp(self):
23        self.invertor = Invertor()
24        x, y, err = load(find('sphere_80.txt'))
25       
26        # Choose the right d_max...
27        self.invertor.d_max = 160.0
28        # Set a small alpha
29        self.invertor.alpha = .0007
30        # Set data
31        self.invertor.x   = x
32        self.invertor.y   = y
33        self.invertor.err = err       
34        self.invertor.nfunc = 15
35       
36        self.explo = DistExplorer(self.invertor)
37       
38    def test_exploration(self):
39        results = self.explo(120, 200, 25)
40        self.assertEqual(len(results.errors), 0)
41        self.assertEqual(len(results.chi2), 25)
42
43if __name__ == '__main__':
44    unittest.main()
Note: See TracBrowser for help on using the repository browser.