Changeset 1852b17 in sasview
- Timestamp:
- Oct 11, 2018 7:08:17 PM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1249
- Children:
- e4e9162
- Parents:
- 7c4bb4d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/pr_inversion/test/utest_explorer.py
r7c4bb4d r1852b17 8 8 from sas.sascalc.pr.invertor import Invertor 9 9 from sas.sascalc.pr.distance_explorer import DistExplorer 10 11 try: 12 from utest_invertor import load 13 except ImportError: 14 from .utest_invertor import load 10 15 11 16 def find(filename): … … 36 41 self.assertEqual(len(results.chi2), 25) 37 42 38 39 # Note: duplicated from utest_invertor because the following failed:40 #from .utest_invertor import load41 def load(path = "sphere_60_q0_2.txt"):42 import numpy as np43 import math44 import sys45 # Read the data from the data file46 data_x = np.zeros(0)47 data_y = np.zeros(0)48 data_err = np.zeros(0)49 scale = None50 if path is not None:51 input_f = open(path,'r')52 buff = input_f.read()53 lines = buff.split('\n')54 for line in lines:55 try:56 toks = line.split()57 x = float(toks[0])58 y = float(toks[1])59 if len(toks)>2:60 err = float(toks[2])61 else:62 if scale==None:63 scale = 0.15*math.sqrt(y)64 err = scale*math.sqrt(y)65 data_x = np.append(data_x, x)66 data_y = np.append(data_y, y)67 data_err = np.append(data_err, err)68 except:69 pass70 71 return data_x, data_y, data_err72 73 43 if __name__ == '__main__': 74 44 unittest.main()
Note: See TracChangeset
for help on using the changeset viewer.