Changes in src/sas/dataloader/manipulations.py [79492222:400155b] in sasview
- 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.