Ignore:
File:
1 edited

Legend:

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

    rdeaa0c6 r4fdcc65  
    716716                self.y_unit = '1/cm' 
    717717        except: # the data is not recognized/supported, and the user is notified 
    718             raise(TypeError, 'data not recognized, check documentation for supported 1D data formats') 
     718            raise TypeError('data not recognized, check documentation for supported 1D data formats') 
    719719 
    720720    def __str__(self): 
     
    796796                len(self.y) != len(other.y): 
    797797                msg = "Unable to perform operation: data length are not equal" 
    798                 raise ValueError, msg 
     798                raise ValueError(msg) 
    799799            # Here we could also extrapolate between data points 
    800800            TOLERANCE = 0.01 
     
    802802                if math.fabs((self.x[i] - other.x[i])/self.x[i]) > TOLERANCE: 
    803803                    msg = "Incompatible data sets: x-values do not match" 
    804                     raise ValueError, msg 
     804                    raise ValueError(msg) 
    805805 
    806806            # Check that the other data set has errors, otherwise 
     
    876876        if not isinstance(other, Data1D): 
    877877            msg = "Unable to perform operation: different types of data set" 
    878             raise ValueError, msg 
     878            raise ValueError(msg) 
    879879        return True 
    880880 
     
    948948 
    949949        if len(self.detector) > 0: 
    950             raise RuntimeError, "Data2D: Detector bank already filled at init" 
     950            raise RuntimeError("Data2D: Detector bank already filled at init") 
    951951 
    952952    def __str__(self): 
     
    954954        _str += "Data:\n" 
    955955        _str += "   Type:         %s\n" % self.__class__.__name__ 
    956         _str += "   X- & Y-axis:  %s\t[%s]\n" % (self._yaxis, self._yunit) 
     956        _str += "   X-axis:       %s\t[%s]\n" % (self._xaxis, self._xunit) 
     957        _str += "   Y-axis:       %s\t[%s]\n" % (self._yaxis, self._yunit) 
    957958        _str += "   Z-axis:       %s\t[%s]\n" % (self._zaxis, self._zunit) 
    958959        _str += "   Length:       %g \n" % (len(self.data)) 
     
    983984                           qx_data=qx_data, qy_data=qy_data, 
    984985                           q_data=q_data, mask=mask) 
     986 
     987        clone._xaxis = self._xaxis 
     988        clone._yaxis = self._yaxis 
     989        clone._zaxis = self._zaxis 
     990        clone._xunit = self._xunit 
     991        clone._yunit = self._yunit 
     992        clone._zunit = self._zunit 
     993        clone.x_bins = self.x_bins 
     994        clone.y_bins = self.y_bins 
    985995 
    986996        clone.title = self.title 
     
    10201030                len(self.qy_data) != len(other.qy_data): 
    10211031                msg = "Unable to perform operation: data length are not equal" 
    1022                 raise ValueError, msg 
     1032                raise ValueError(msg) 
    10231033            for ind in range(len(self.data)): 
    10241034                if math.fabs((self.qx_data[ind] - other.qx_data[ind])/self.qx_data[ind]) > TOLERANCE: 
    10251035                    msg = "Incompatible data sets: qx-values do not match: %s %s" % (self.qx_data[ind], other.qx_data[ind]) 
    1026                     raise ValueError, msg 
     1036                    raise ValueError(msg) 
    10271037                if math.fabs((self.qy_data[ind] - other.qy_data[ind])/self.qy_data[ind]) > TOLERANCE: 
    10281038                    msg = "Incompatible data sets: qy-values do not match: %s %s" % (self.qy_data[ind], other.qy_data[ind]) 
    1029                     raise ValueError, msg 
     1039                    raise ValueError(msg) 
    10301040 
    10311041            # Check that the scales match 
     
    11081118        if not isinstance(other, Data2D): 
    11091119            msg = "Unable to perform operation: different types of data set" 
    1110             raise ValueError, msg 
     1120            raise ValueError(msg) 
    11111121        return True 
    11121122 
     
    11531163def combine_data_info_with_plottable(data, datainfo): 
    11541164    """ 
    1155     A function that combines the DataInfo data in self.current_datainto with a plottable_1D or 2D data object. 
     1165    A function that combines the DataInfo data in self.current_datainto with a 
     1166    plottable_1D or 2D data object. 
    11561167 
    11571168    :param data: A plottable_1D or plottable_2D data object 
     
    11711182        final_dataset.yaxis(data._yaxis, data._yunit) 
    11721183    elif isinstance(data, plottable_2D): 
    1173         final_dataset = Data2D(data.data, data.err_data, data.qx_data, data.qy_data, data.q_data, 
    1174                                data.mask, data.dqx_data, data.dqy_data) 
     1184        final_dataset = Data2D(data.data, data.err_data, data.qx_data, 
     1185                               data.qy_data, data.q_data, data.mask, 
     1186                               data.dqx_data, data.dqy_data) 
    11751187        final_dataset.xaxis(data._xaxis, data._xunit) 
    11761188        final_dataset.yaxis(data._yaxis, data._yunit) 
    11771189        final_dataset.zaxis(data._zaxis, data._zunit) 
    1178         if len(data.data.shape) == 2: 
    1179             n_rows, n_cols = data.data.shape 
    1180             final_dataset.y_bins = data.qy_data[0::int(n_cols)] 
    1181             final_dataset.x_bins = data.qx_data[:int(n_cols)] 
     1190        final_dataset.y_bins = data.y_bins 
     1191        final_dataset.x_bins = data.x_bins 
    11821192    else: 
    1183         return_string = "Should Never Happen: _combine_data_info_with_plottable input is not a plottable1d or " + \ 
    1184                         "plottable2d data object" 
     1193        return_string = ("Should Never Happen: _combine_data_info_with_plottabl" 
     1194                         "e input is not a plottable1d or plottable2d data " 
     1195                         "object") 
    11851196        return return_string 
    11861197 
Note: See TracChangeset for help on using the changeset viewer.