Changeset 7c4bb4d in sasview for test/pr_inversion
- Timestamp:
- Oct 11, 2018 2:34:40 PM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1249
- Children:
- 1852b17
- Parents:
- 88d2e70
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/pr_inversion/test/utest_explorer.py
r88d2e70 r7c4bb4d 3 3 """ 4 4 5 import sys 5 6 import os.path 6 7 import unittest, math, numpy 7 8 from sas.sascalc.pr.invertor import Invertor 8 9 from sas.sascalc.pr.distance_explorer import DistExplorer 9 from .utest_invertor import load10 11 10 12 11 def find(filename): … … 36 35 self.assertEqual(len(results.errors), 0) 37 36 self.assertEqual(len(results.chi2), 25) 37 38 39 # Note: duplicated from utest_invertor because the following failed: 40 #from .utest_invertor import load 41 def load(path = "sphere_60_q0_2.txt"): 42 import numpy as np 43 import math 44 import sys 45 # Read the data from the data file 46 data_x = np.zeros(0) 47 data_y = np.zeros(0) 48 data_err = np.zeros(0) 49 scale = None 50 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 pass 70 71 return data_x, data_y, data_err 38 72 39 73 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.