Changeset 7e99f5c in sasview for sansmodels/src/sans
- Timestamp:
- Mar 12, 2010 1:04:16 PM (15 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 3080527
- Parents:
- 83195f7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/test/utest_evaldist.py
recc58e72 r7e99f5c 56 56 qx = numpy.asarray(qx_values) 57 57 qy = numpy.asarray(qy_values) 58 59 qx_prime = numpy.reshape(qx, [3,1]) 60 qy_prime = numpy.reshape(qy, [1,3]) 58 59 new_x = numpy.tile(qx, (len(qy),1)) 60 new_y = numpy.tile(qy, (len(qx),1)) 61 new_y = new_y.swapaxes(0,1) 62 63 #iq is 1d array now (since 03-12-2010) 64 qx_prime = new_x.flatten() 65 qy_prime = new_y.flatten() 61 66 62 67 iq = self.model.evalDistribution([qx_prime, qy_prime]) … … 64 69 for i in range(3): 65 70 for j in range(3): 66 self.assertAlmostEquals(iq[i][j], expected[i][j]) 71 k = i+len(qx)*j 72 self.assertAlmostEquals(iq[k], expected[i][j]) 67 73 68 74 def test_rectangle_methods(self): … … 92 98 qx = numpy.asarray(qx_values) 93 99 qy = numpy.asarray(qy_values) 94 95 qx_prime = numpy.reshape(qx, [3,1]) 96 qy_prime = numpy.reshape(qy, [1,2]) 100 101 new_x = numpy.tile(qx, (len(qy),1)) 102 new_y = numpy.tile(qy, (len(qx),1)) 103 new_y = new_y.swapaxes(0,1) 104 105 #iq is 1d array now (since 03-12-2010) 106 qx_prime = new_x.flatten() 107 qy_prime = new_y.flatten() 97 108 98 109 iq = self.model.evalDistribution([qx_prime, qy_prime]) … … 100 111 for i in range(3): 101 112 for j in range(2): 102 self.assertAlmostEquals(iq[i][j], expected[i][j]) 113 k = i+len(qx)*j 114 self.assertAlmostEquals(iq[k], expected[i][j]) 103 115 104 116 … … 151 163 qx = numpy.asarray(qx_values) 152 164 qy = numpy.asarray(qy_values) 153 154 qx_prime = numpy.reshape(qx, [3,1]) 155 qy_prime = numpy.reshape(qy, [1,3]) 165 166 new_x = numpy.tile(qx, (len(qy),1)) 167 new_y = numpy.tile(qy, (len(qx),1)) 168 new_y = new_y.swapaxes(0,1) 169 170 #iq is 1d array now (since 03-12-2010) 171 qx_prime = new_x.flatten() 172 qy_prime = new_y.flatten() 156 173 157 174 iq = self.model.evalDistribution([qx_prime, qy_prime]) … … 159 176 for i in range(3): 160 177 for j in range(3): 161 self.assertAlmostEquals(iq[i][j], expected[i][j]) 178 # convert index into 1d array 179 k = i+len(qx)*j 180 self.assertAlmostEquals(iq[k], expected[i][j]) 162 181 163 182
Note: See TracChangeset
for help on using the changeset viewer.