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 7fb69f26 was
7d8c41f,
checked in by Mathieu Doucet <doucetm@…>, 15 years ago
|
pr_inversion: added d_max explorer as independent computation module [should make similar code in PrView? obsolete]
|
-
Property mode set to
100644
|
File size:
980 bytes
|
Rev | Line | |
---|
[7d8c41f] | 1 | """ |
---|
| 2 | Unit tests for DistExplorer class |
---|
| 3 | """ |
---|
| 4 | |
---|
| 5 | import unittest, math, numpy |
---|
| 6 | from utest_invertor import load |
---|
| 7 | from sans.pr.invertor import Invertor |
---|
| 8 | from sans.pr.distance_explorer import DistExplorer |
---|
| 9 | |
---|
| 10 | class TestExplorer(unittest.TestCase): |
---|
| 11 | |
---|
| 12 | def setUp(self): |
---|
| 13 | self.invertor = Invertor() |
---|
| 14 | x, y, err = load('sphere_80.txt') |
---|
| 15 | |
---|
| 16 | # Choose the right d_max... |
---|
| 17 | self.invertor.d_max = 160.0 |
---|
| 18 | # Set a small alpha |
---|
| 19 | self.invertor.alpha = .0007 |
---|
| 20 | # Set data |
---|
| 21 | self.invertor.x = x |
---|
| 22 | self.invertor.y = y |
---|
| 23 | self.invertor.err = err |
---|
| 24 | self.invertor.nfunc = 15 |
---|
| 25 | |
---|
| 26 | self.explo = DistExplorer(self.invertor) |
---|
| 27 | |
---|
| 28 | def test_exploration(self): |
---|
| 29 | results = self.explo(120, 200, 25) |
---|
| 30 | self.assertEqual(len(results.errors), 0) |
---|
| 31 | self.assertEqual(len(results.chi2), 25) |
---|
| 32 | |
---|
| 33 | if __name__ == '__main__': |
---|
| 34 | unittest.main() |
---|
Note: See
TracBrowser
for help on using the repository browser.