Changes in / [6ea6902:711d8e2] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/model_test.py
r5428233 r5ca9762 66 66 args = exc.args 67 67 if not args: 68 arg0 = msg68 exc.args = (msg,) 69 69 else: 70 arg0 = " ".join((args[0],msg)) 71 exc.args = tuple([arg0] + list(args[1:])) 70 try: 71 arg0 = " ".join((args[0],msg)) 72 exc.args = tuple([arg0] + list(args[1:])) 73 except: 74 exc.args = (" ".join((str(exc),msg)),) 72 75 73 76 def suite(): … … 83 86 84 87 model = getattr(module, model_name, None) 85 tests = getattr(model, 'tests', []) 88 smoke_tests = [[{},0.1,None],[{},(0.1,0.1),None]] 89 tests = smoke_tests + getattr(model, 'tests', []) 86 90 87 91 if tests: … … 120 124 121 125 if isinstance(Q[0], tuple): 122 npQ = [np.array([Qi[d] for Qi in Q]) for d in xrange(len(Q[0]))] 126 Qx,Qy = zip(*Q) 127 Q_vectors = [np.array(Qx), np.array(Qy)] 123 128 else: 124 npQ= [np.array(Q)]129 Q_vectors = [np.array(Q)] 125 130 126 self.assertTrue(Q) 127 self.assertEqual(len(I), len(Q)) 131 self.assertEqual(len(I), len(Q)) 128 132 129 Iq = eval_kernel(self.kernel, npQ, params)133 Iq = eval_kernel(self.kernel, Q_vectors, params) 130 134 131 135 self.assertGreater(len(Iq), 0) … … 133 137 134 138 for q, i, iq in zip(Q, I, Iq): 139 if i is None: continue # smoke test --- make sure it runs 135 140 err = np.abs(i - iq) 136 141 nrm = np.abs(i)
Note: See TracChangeset
for help on using the changeset viewer.