Changeset 8ba103f in sasview
- Timestamp:
- Apr 17, 2009 12:21:13 PM (16 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:
- 5ee2306
- Parents:
- c16557c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DataLoader/manipulations.py
ree3b2c0c r8ba103f 167 167 err_y[i_q] += frac * frac * data2D.err_data[j][i] * data2D.err_data[j][i] 168 168 y_counts[i_q] += frac 169 169 170 170 # Average the sums 171 171 for i in range(nbins): … … 378 378 det_dist = data2D.detector[0].distance 379 379 wavelength = data2D.source.wavelength 380 center_x = data2D.detector[0].beam_center.x/pixel_width_x 381 center_y = data2D.detector[0].beam_center.y/pixel_width_y 380 center_x = data2D.detector[0].beam_center.x/pixel_width_x+0.5 381 center_y = data2D.detector[0].beam_center.y/pixel_width_y+0.5 382 382 383 383 # Find out the maximum Q range 384 xwidth = numpy.size(data2D.data,1)*pixel_width_x384 xwidth = (numpy.size(data2D.data,1))*pixel_width_x 385 385 dx_max = xwidth - data2D.detector[0].beam_center.x 386 386 if xwidth-dx_max>dx_max: 387 387 dx_max = xwidth-dx_max 388 388 389 ywidth = numpy.size(data2D.data,0)*pixel_width_y389 ywidth = (numpy.size(data2D.data,0))*pixel_width_y 390 390 dy_max = ywidth - data2D.detector[0].beam_center.y 391 391 if ywidth-dy_max>dy_max: … … 441 441 442 442 i_q = int(math.ceil((q_value-self.r_min)/self.bin_width)) - 1 443 443 if q_value > qmax or q_value < self.r_min: 444 continue 445 444 446 x[i_q] = q_value 445 447 y[i_q] += frac * data2D.data[j][i] … … 449 451 err_y[i_q] += frac * frac * data2D.err_data[j][i] * data2D.err_data[j][i] 450 452 y_counts[i_q] += frac 451 453 452 454 # Average the sums 455 nzero = 0 453 456 for i in range(nbins): 454 457 if y_counts[i]>0: 455 458 err_y[i] = math.sqrt(err_y[i])/y_counts[i] 456 459 y[i] = y[i]/y_counts[i] 457 458 return Data1D(x=x, y=y, dy=err_y) 460 else: 461 nzero += 1 462 ## Get rid of NULL points 463 tx = numpy.zeros(nbins-nzero) 464 ty = numpy.zeros(nbins-nzero) 465 terr_y = numpy.zeros(nbins-nzero) 466 j=0 467 for i in range(nbins): 468 if err_y[i] != 0 : 469 tx[j] = x[i] 470 ty[j] = y[i] 471 terr_y[j] = err_y[i] 472 j+=1 473 474 return Data1D(x=tx, y=ty, dy=terr_y) 459 475 460 476 … … 480 496 self.center_y = center_y 481 497 # Number of angular bins 482 self.nbins_phi = nbins _phi498 self.nbins_phi = nbins 483 499 484 500 def __call__(self, data2D): … … 856 872 self.phi_max=self.phi_max+2*math.pi 857 873 858 #In case of two ROI (symmetric major and minor regions)(for 'q2')874 #In case of two ROI (symmetric major and minor wings)(for 'q2') 859 875 if run.lower()=='q2': 860 876 if ((self.phi_max>=0 and self.phi_max<math.pi)and (self.phi_min>=0 and self.phi_min<math.pi)): … … 904 920 qmax=temp 905 921 #Beam center is already corrected, but the calculation below assumed it was not. 906 # Thus Beam center shifted back to uncorrected value. ToDo: cleanup th is codes.922 # Thus Beam center shifted back to uncorrected value. ToDo: cleanup the mess. 907 923 center_x=center_x+0.5 908 924 center_y=center_y+0.5
Note: See TracChangeset
for help on using the changeset viewer.