source: sasview/test/pr_inversion/test/utest_explorer.py @ 88d2e70

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

support for py37 in unit tests

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