Changeset b9d74f3 in sasview for src/sas/sascalc/dataloader/manipulations.py
- Timestamp:
- Apr 20, 2017 6:29:34 AM (8 years ago)
- Children:
- 0cc77d8
- Parents:
- b636dfc5
- git-author:
- Andrew Nelson <andyfaff@…> (04/20/17 06:25:57)
- git-committer:
- Andrew Nelson <andyfaff@…> (04/20/17 06:29:34)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/manipulations.py
r7432acb rb9d74f3 81 81 """ 82 82 if data2d.data is None or data2d.x_bins is None or data2d.y_bins is None: 83 raise ValueError , "Can't convert this data: data=None..."83 raise ValueError("Can't convert this data: data=None...") 84 84 new_x = numpy.tile(data2d.x_bins, (len(data2d.y_bins), 1)) 85 85 new_y = numpy.tile(data2d.y_bins, (len(data2d.x_bins), 1)) … … 146 146 msg = "_Slab._avg: invalid number of " 147 147 msg += " detectors: %g" % len(data2D.detector) 148 raise RuntimeError , msg148 raise RuntimeError(msg) 149 149 150 150 # Get data … … 168 168 nbins = int(math.ceil((self.y_max - y_min) / self.bin_width)) 169 169 else: 170 raise RuntimeError , "_Slab._avg: unrecognized axis %s" % str(maj)170 raise RuntimeError("_Slab._avg: unrecognized axis %s" % str(maj)) 171 171 172 172 x = numpy.zeros(nbins) … … 229 229 if not idx.any(): 230 230 msg = "Average Error: No points inside ROI to average..." 231 raise ValueError , msg231 raise ValueError(msg) 232 232 return Data1D(x=x[idx], y=y[idx], dy=err_y[idx]) 233 233 … … 302 302 msg = "Circular averaging: invalid number " 303 303 msg += "of detectors: %g" % len(data2D.detector) 304 raise RuntimeError , msg304 raise RuntimeError(msg) 305 305 # Get data 306 306 data = data2D.data[numpy.isfinite(data2D.data)] … … 464 464 if len(data2D.q_data) is None: 465 465 msg = "Circular averaging: invalid q_data: %g" % data2D.q_data 466 raise RuntimeError , msg466 raise RuntimeError(msg) 467 467 468 468 # Build array of Q intervals … … 488 488 ## No need to calculate the frac when all data are within range 489 489 if self.r_min >= self.r_max: 490 raise ValueError , "Limit Error: min > max"490 raise ValueError("Limit Error: min > max") 491 491 492 492 if self.r_min <= q_value and q_value <= self.r_max: … … 539 539 if not idx.any(): 540 540 msg = "Average Error: No points inside ROI to average..." 541 raise ValueError , msg541 raise ValueError(msg) 542 542 543 543 return Data1D(x=x[idx], y=y[idx], dy=err_y[idx], dx=d_x) … … 580 580 """ 581 581 if data2D.__class__.__name__ not in ["Data2D", "plottable_2D"]: 582 raise RuntimeError , "Ring averaging only take plottable_2D objects"582 raise RuntimeError("Ring averaging only take plottable_2D objects") 583 583 584 584 Pi = math.pi … … 640 640 if not idx.any(): 641 641 msg = "Average Error: No points inside ROI to average..." 642 raise ValueError , msg642 raise ValueError(msg) 643 643 #elif len(phi_bins[idx])!= self.nbins_phi: 644 644 # print "resulted",self.nbins_phi- len(phi_bins[idx]) … … 765 765 """ 766 766 if data2D.__class__.__name__ not in ["Data2D", "plottable_2D"]: 767 raise RuntimeError , "Ring averaging only take plottable_2D objects"767 raise RuntimeError("Ring averaging only take plottable_2D objects") 768 768 Pi = math.pi 769 769 … … 931 931 if not idx.any(): 932 932 msg = "Average Error: No points inside sector of ROI to average..." 933 raise ValueError , msg933 raise ValueError(msg) 934 934 #elif len(y[idx])!= self.nbins: 935 935 # print "resulted",self.nbins- len(y[idx]), … … 1007 1007 """ 1008 1008 if data2D.__class__.__name__ not in ["Data2D", "plottable_2D"]: 1009 raise RuntimeError , "Ring cut only take plottable_2D objects"1009 raise RuntimeError("Ring cut only take plottable_2D objects") 1010 1010 1011 1011 # Get data … … 1055 1055 """ 1056 1056 if data2D.__class__.__name__ not in ["Data2D", "plottable_2D"]: 1057 raise RuntimeError , "Boxcut take only plottable_2D objects"1057 raise RuntimeError("Boxcut take only plottable_2D objects") 1058 1058 # Get qx_ and qy_data 1059 1059 qx_data = data2D.qx_data … … 1106 1106 """ 1107 1107 if data2D.__class__.__name__ not in ["Data2D", "plottable_2D"]: 1108 raise RuntimeError , "Sectorcut take only plottable_2D objects"1108 raise RuntimeError("Sectorcut take only plottable_2D objects") 1109 1109 Pi = math.pi 1110 1110 # Get data
Note: See TracChangeset
for help on using the changeset viewer.