Changeset 9dda8cc in sasview for src/sas/sascalc
- Timestamp:
- Apr 6, 2017 11:42:01 AM (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:
- ccc7192
- Parents:
- a470e88
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/manipulations.py
rfd5d6eac r9dda8cc 83 83 """ 84 84 if data2d.data is None or data2d.x_bins is None or data2d.y_bins is None: 85 raise ValueError , "Can't convert this data: data=None..."85 raise ValueError("Can't convert this data: data=None...") 86 86 new_x = np.tile(data2d.x_bins, (len(data2d.y_bins), 1)) 87 87 new_y = np.tile(data2d.y_bins, (len(data2d.x_bins), 1)) … … 149 149 msg = "_Slab._avg: invalid number of " 150 150 msg += " detectors: %g" % len(data2D.detector) 151 raise RuntimeError , msg151 raise RuntimeError(msg) 152 152 153 153 # Get data … … 171 171 nbins = int(math.ceil((self.y_max - y_min) / self.bin_width)) 172 172 else: 173 raise RuntimeError , "_Slab._avg: unrecognized axis %s" % str(maj)173 raise RuntimeError("_Slab._avg: unrecognized axis %s" % str(maj)) 174 174 175 175 x = np.zeros(nbins) … … 232 232 if not idx.any(): 233 233 msg = "Average Error: No points inside ROI to average..." 234 raise ValueError , msg234 raise ValueError(msg) 235 235 return Data1D(x=x[idx], y=y[idx], dy=err_y[idx]) 236 236 … … 308 308 msg = "Circular averaging: invalid number " 309 309 msg += "of detectors: %g" % len(data2D.detector) 310 raise RuntimeError , msg310 raise RuntimeError(msg) 311 311 # Get data 312 312 data = data2D.data[np.isfinite(data2D.data)] … … 473 473 if len(data2D.q_data) == None: 474 474 msg = "Circular averaging: invalid q_data: %g" % data2D.q_data 475 raise RuntimeError , msg475 raise RuntimeError(msg) 476 476 477 477 # Build array of Q intervals … … 497 497 # No need to calculate the frac when all data are within range 498 498 if self.r_min >= self.r_max: 499 raise ValueError , "Limit Error: min > max"499 raise ValueError("Limit Error: min > max") 500 500 501 501 if self.r_min <= q_value and q_value <= self.r_max: … … 548 548 if not idx.any(): 549 549 msg = "Average Error: No points inside ROI to average..." 550 raise ValueError , msg550 raise ValueError(msg) 551 551 552 552 return Data1D(x=x[idx], y=y[idx], dy=err_y[idx], dx=d_x) … … 589 589 """ 590 590 if data2D.__class__.__name__ not in ["Data2D", "plottable_2D"]: 591 raise RuntimeError , "Ring averaging only take plottable_2D objects"591 raise RuntimeError("Ring averaging only take plottable_2D objects") 592 592 593 593 Pi = math.pi … … 649 649 if not idx.any(): 650 650 msg = "Average Error: No points inside ROI to average..." 651 raise ValueError , msg651 raise ValueError(msg) 652 652 # elif len(phi_bins[idx])!= self.nbins_phi: 653 653 # print "resulted",self.nbins_phi- len(phi_bins[idx]) … … 775 775 """ 776 776 if data2D.__class__.__name__ not in ["Data2D", "plottable_2D"]: 777 raise RuntimeError , "Ring averaging only take plottable_2D objects"777 raise RuntimeError("Ring averaging only take plottable_2D objects") 778 778 Pi = math.pi 779 779 … … 942 942 if not idx.any(): 943 943 msg = "Average Error: No points inside sector of ROI to average..." 944 raise ValueError , msg944 raise ValueError(msg) 945 945 # elif len(y[idx])!= self.nbins: 946 946 # print "resulted",self.nbins- len(y[idx]), … … 1021 1021 """ 1022 1022 if data2D.__class__.__name__ not in ["Data2D", "plottable_2D"]: 1023 raise RuntimeError , "Ring cut only take plottable_2D objects"1023 raise RuntimeError("Ring cut only take plottable_2D objects") 1024 1024 1025 1025 # Get data … … 1070 1070 """ 1071 1071 if data2D.__class__.__name__ not in ["Data2D", "plottable_2D"]: 1072 raise RuntimeError , "Boxcut take only plottable_2D objects"1072 raise RuntimeError("Boxcut take only plottable_2D objects") 1073 1073 # Get qx_ and qy_data 1074 1074 qx_data = data2D.qx_data … … 1122 1122 """ 1123 1123 if data2D.__class__.__name__ not in ["Data2D", "plottable_2D"]: 1124 raise RuntimeError , "Sectorcut take only plottable_2D objects"1124 raise RuntimeError("Sectorcut take only plottable_2D objects") 1125 1125 Pi = math.pi 1126 1126 # Get data
Note: See TracChangeset
for help on using the changeset viewer.