Changeset 400155b in sasview for src/sas/dataloader
- Timestamp:
- Feb 17, 2015 8:20:48 AM (10 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:
- 66f21cd
- Parents:
- 7eaf9f2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/dataloader/manipulations.py
r79492222 r400155b 582 582 """ 583 583 #Todo: remove center. 584 def __init__(self, r_min=0, r_max=0, center_x=0, center_y=0, nbins= 20):584 def __init__(self, r_min=0, r_max=0, center_x=0, center_y=0, nbins=36): 585 585 # Minimum radius 586 586 self.r_min = r_min … … 593 593 # Number of angular bins 594 594 self.nbins_phi = nbins 595 595 596 596 597 def __call__(self, data2D): … … 622 623 phi_values = numpy.zeros(self.nbins_phi) 623 624 phi_err = numpy.zeros(self.nbins_phi) 624 625 626 # Shift to apply to calculated phi values in order to center first bin at zero 627 phi_shift = Pi / self.nbins_phi 628 625 629 for npt in range(len(data)): 626 630 frac = 0 … … 637 641 continue 638 642 # binning 639 i_phi = int(math.floor((self.nbins_phi) * phi_value/ (2 * Pi)))643 i_phi = int(math.floor((self.nbins_phi) * (phi_value+phi_shift) / (2 * Pi))) 640 644 641 645 # Take care of the edge case at phi = 2pi. 642 if i_phi == self.nbins_phi:643 i_phi = self.nbins_phi - 1646 if i_phi >= self.nbins_phi: 647 i_phi = 0 644 648 phi_bins[i_phi] += frac * data[npt] 645 649 … … 655 659 phi_bins[i] = phi_bins[i] / phi_counts[i] 656 660 phi_err[i] = math.sqrt(phi_err[i]) / phi_counts[i] 657 phi_values[i] = 2.0 * math.pi / self.nbins_phi * (1.0 * i + 0.5)661 phi_values[i] = 2.0 * math.pi / self.nbins_phi * (1.0 * i) 658 662 659 663 idx = (numpy.isfinite(phi_bins))
Note: See TracChangeset
for help on using the changeset viewer.