Changeset 72538fc in sasview
- Timestamp:
- Jun 14, 2012 2:50:07 PM (13 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:
- 0008f54
- Parents:
- dcf73a4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansdataloader/test/utest_manipulations.py
r6f65614 r72538fc 7 7 import numpy, math 8 8 from sans.dataloader.loader import Loader 9 from sans. dataloader.data_infoimport Data1D, Data2D9 from sans.guiframe.dataFitting import Data1D, Data2D 10 10 11 11 import os.path … … 141 141 dqy_0 = numpy.arange(25)/100 142 142 q_0 = numpy.sqrt(qx_0 * qx_0 + qy_0 * qy_0) 143 self.data = Data2D(x_0, dx_0, qx_0, qy_0, q_0, mask_0, dqx_0, dqy_0) 143 self.data = Data2D(image=x_0, err_image=dx_0, qx_data=qx_0, 144 qy_data=qy_0, q_data=q_0, mask=mask_0, 145 dqx_data=dqx_0, dqy_data=dqy_0) 144 146 145 147 y = numpy.ones(25) … … 149 151 mask = numpy.zeros(25) 150 152 q = numpy.sqrt(qx * qx + qy * qy) 151 self.data2 = Data2D(y, dy, qx, qy, q, mask) 153 self.data2 = Data2D(image=y, err_image=dy, qx_data=qx, qy_data=qy, 154 q_data=q, mask=mask) 152 155 153 156 … … 195 198 self.assertEqual(result.data[i], 5.0) 196 199 self.assertEqual(result.err_data[i], 0.5) 197 #Currently NOT supported198 #result = 3.0+self.data199 #for i in range(25):200 #self.assertEqual(result.data[i], 5.0)201 #self.assertEqual(result.err_data[i], 0.5)200 201 result = 3.0+self.data 202 for i in range(25): 203 self.assertEqual(result.data[i], 5.0) 204 self.assertEqual(result.err_data[i], 0.5) 202 205 203 206 def test_rsub(self): … … 206 209 self.assertEqual(result.data[i], -1.0) 207 210 self.assertEqual(result.err_data[i], 0.5) 208 #Currently NOT supported209 #result = 3.0-self.data210 #for i in range(25):211 #self.assertEqual(result.data[i], 1.0)212 #self.assertEqual(result.err_data[i], 0.5)211 212 result = 3.0-self.data 213 for i in range(25): 214 self.assertEqual(result.data[i], 1.0) 215 self.assertEqual(result.err_data[i], 0.5) 213 216 214 217 def test_rmul(self): … … 217 220 self.assertEqual(result.data[i], 6.0) 218 221 self.assertEqual(result.err_data[i], 1.5) 219 #Currently NOT supported220 #result = 3.0*self.data221 #for i in range(25):222 #self.assertEqual(result.data[i], 6.0)223 #self.assertEqual(result.err_data[i], 1.5)222 223 result = 3.0*self.data 224 for i in range(25): 225 self.assertEqual(result.data[i], 6.0) 226 self.assertEqual(result.err_data[i], 1.5) 224 227 225 228 def test_rdiv(self): … … 228 231 self.assertEqual(result.data[i], 0.5) 229 232 self.assertEqual(result.err_data[i], 0.125) 230 #Currently NOT supported 231 #result = 6.0/self.data232 #for i in range(25):233 #self.assertEqual(result.data[i], 3.0)234 #self.assertEqual(result.err_data[i], 6.0*0.5/4.0)233 234 result = 6.0/self.data 235 for i in range(25): 236 self.assertEqual(result.data[i], 3.0) 237 self.assertEqual(result.err_data[i], 6.0*0.5/4.0) 235 238 236 239
Note: See TracChangeset
for help on using the changeset viewer.