- Timestamp:
- May 17, 2017 4:53:56 PM (8 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 46cd1c3
- Parents:
- 5e903e8b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/sasdataloader/test/utest_averaging.py
rfa4af76 re123eb9 3 3 import os 4 4 import unittest 5 5 from scipy.stats import binned_statistic_2d 6 6 import numpy as np 7 7 … … 264 264 self.assertAlmostEqual(o.dy[i], answer.dy[i], 4) 265 265 266 def test_sectorq_log(self): 267 """ 268 Test sector averaging I(q) 269 The test data was not generated by IGOR. 270 """ 271 272 r = SectorQ(r_min=.005, r_max=.01, phi_min=0, phi_max=math.pi / 2.0, base=10) 273 r.nbins_phi = 20 274 o = r(self.data) 275 276 expected_binning = np.logspace(np.log10(0.005), np.log10(0.01), 20, base=10) 277 for i in range(len(o.x)): 278 self.assertAlmostEqual(o.x[i], expected_binning[i], 3) 279 280 # TODO: Test for Y values (o.y) 281 # print len(self.data.x_bins) 282 # print len(self.data.y_bins) 283 # print self.data.q_data.shape 284 # data_to_bin = np.array(self.data.q_data) 285 # data_to_bin = data_to_bin.reshape(len(self.data.x_bins), len(self.data.y_bins)) 286 # H, xedges, yedges, binnumber = binned_statistic_2d(self.data.x_bins, self.data.y_bins, data_to_bin, 287 # bins=[[0, math.pi / 2.0], expected_binning], statistic='mean') 288 # xedges_width = (xedges[1] - xedges[0]) 289 # xedges_center = xedges[1:] - xedges_width / 2 290 291 # yedges_width = (yedges[1] - yedges[0]) 292 # yedges_center = yedges[1:] - yedges_width / 2 293 294 # print H.flatten().shape 295 # print o.y.shape 296 266 297 267 298 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.