Ignore:
Timestamp:
Apr 20, 2017 6:29:34 AM (8 years ago)
Author:
andyfaff
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)
Message:

MAINT: use raise Exception() not raise Exception

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/manipulations.py

    r7432acb rb9d74f3  
    8181    """ 
    8282    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...") 
    8484    new_x = numpy.tile(data2d.x_bins, (len(data2d.y_bins), 1)) 
    8585    new_y = numpy.tile(data2d.y_bins, (len(data2d.x_bins), 1)) 
     
    146146            msg = "_Slab._avg: invalid number of " 
    147147            msg += " detectors: %g" % len(data2D.detector) 
    148             raise RuntimeError, msg 
     148            raise RuntimeError(msg) 
    149149 
    150150        # Get data 
     
    168168            nbins = int(math.ceil((self.y_max - y_min) / self.bin_width)) 
    169169        else: 
    170             raise RuntimeError, "_Slab._avg: unrecognized axis %s" % str(maj) 
     170            raise RuntimeError("_Slab._avg: unrecognized axis %s" % str(maj)) 
    171171 
    172172        x = numpy.zeros(nbins) 
     
    229229        if not idx.any(): 
    230230            msg = "Average Error: No points inside ROI to average..." 
    231             raise ValueError, msg 
     231            raise ValueError(msg) 
    232232        return Data1D(x=x[idx], y=y[idx], dy=err_y[idx]) 
    233233 
     
    302302            msg = "Circular averaging: invalid number " 
    303303            msg += "of detectors: %g" % len(data2D.detector) 
    304             raise RuntimeError, msg 
     304            raise RuntimeError(msg) 
    305305        # Get data 
    306306        data = data2D.data[numpy.isfinite(data2D.data)] 
     
    464464        if len(data2D.q_data) is None: 
    465465            msg = "Circular averaging: invalid q_data: %g" % data2D.q_data 
    466             raise RuntimeError, msg 
     466            raise RuntimeError(msg) 
    467467 
    468468        # Build array of Q intervals 
     
    488488            ## No need to calculate the frac when all data are within range 
    489489            if self.r_min >= self.r_max: 
    490                 raise ValueError, "Limit Error: min > max" 
     490                raise ValueError("Limit Error: min > max") 
    491491 
    492492            if self.r_min <= q_value and q_value <= self.r_max: 
     
    539539        if not idx.any(): 
    540540            msg = "Average Error: No points inside ROI to average..." 
    541             raise ValueError, msg 
     541            raise ValueError(msg) 
    542542 
    543543        return Data1D(x=x[idx], y=y[idx], dy=err_y[idx], dx=d_x) 
     
    580580        """ 
    581581        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") 
    583583 
    584584        Pi = math.pi 
     
    640640        if not idx.any(): 
    641641            msg = "Average Error: No points inside ROI to average..." 
    642             raise ValueError, msg 
     642            raise ValueError(msg) 
    643643        #elif len(phi_bins[idx])!= self.nbins_phi: 
    644644        #    print "resulted",self.nbins_phi- len(phi_bins[idx]) 
     
    765765        """ 
    766766        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") 
    768768        Pi = math.pi 
    769769 
     
    931931        if not idx.any(): 
    932932            msg = "Average Error: No points inside sector of ROI to average..." 
    933             raise ValueError, msg 
     933            raise ValueError(msg) 
    934934        #elif len(y[idx])!= self.nbins: 
    935935        #    print "resulted",self.nbins- len(y[idx]), 
     
    10071007        """ 
    10081008        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") 
    10101010 
    10111011        # Get data 
     
    10551055        """ 
    10561056        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") 
    10581058        # Get qx_ and qy_data 
    10591059        qx_data = data2D.qx_data 
     
    11061106        """ 
    11071107        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") 
    11091109        Pi = math.pi 
    11101110        # Get data 
Note: See TracChangeset for help on using the changeset viewer.