Changes in / [5dd7499:ee563d5] in sasview


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/dataFitting.py

    rd85c194 r9b6d62d  
    363363        _str = "%s\n" % LoadData2D.__str__(self) 
    364364        return _str  
    365      
    366     def _validity_check(self, other): 
    367         """ 
    368         Checks that the data lengths are compatible. 
    369         Checks that the x vectors are compatible. 
    370         Returns errors vectors equal to original 
    371         errors vectors if they were present or vectors 
    372         of zeros when none was found. 
    373          
    374         :param other: other data set for operation 
    375          
    376         :return: dy for self, dy for other [numpy arrays] 
    377          
    378         :raise ValueError: when lengths are not compatible 
    379          
    380         """ 
    381         err_other = None 
    382         if isinstance(other, Data2D): 
    383             # Check that data lengths are the same 
    384             if len(self.data) != len(other.data) or \ 
    385                 len(self.qx_data) != len(other.qx_data) or \ 
    386                 len(self.qy_data) != len(other.qy_data): 
    387                 msg = "Unable to perform operation: data length are not equal" 
    388                 raise ValueError, msg 
    389             #if len(self.data) < 1: 
    390             #    msg = "Incompatible data sets: I-values do not match" 
    391             #    raise ValueError, msg  
    392             for ind in range(len(self.data)): 
    393                 if self.qx_data[ind] != other.qx_data[ind]: 
    394                     msg = "Incompatible data sets: qx-values do not match" 
    395                     raise ValueError, msg 
    396                 if self.qy_data[ind] != other.qy_data[ind]: 
    397                     msg = "Incompatible data sets: qy-values do not match" 
    398                     raise ValueError, msg 
    399                     
    400             # Check that the scales match 
    401             err_other = other.err_data 
    402             if other.err_data == None or \ 
    403                 (len(other.err_data) != len(other.data)): 
    404                 err_other = numpy.zeros(len(other.data)) 
    405              
    406         # Check that we have errors, otherwise create zero vector 
    407         err = self.err_data 
    408         if self.err_data == None or \ 
    409             (len(self.err_data) != len(self.data)): 
    410             err = numpy.zeros(len(other.data)) 
    411              
    412         return err, err_other 
    413  
    414     def _validity_check_union(self, other): 
    415         """ 
    416         Checks that the data lengths are compatible. 
    417         Checks that the x vectors are compatible. 
    418         Returns errors vectors equal to original 
    419         errors vectors if they were present or vectors 
    420         of zeros when none was found. 
    421          
    422         :param other: other data set for operation 
    423          
    424         :return: bool 
    425          
    426         :raise ValueError: when data types are not compatible 
    427          
    428         """ 
    429         if not isinstance(other, Data2D): 
    430             msg = "Unable to perform operation: different types of data set" 
    431             raise ValueError, msg    
    432         return True 
    433      
     365 
    434366    def _perform_operation(self, other, operation): 
    435367        """ 
Note: See TracChangeset for help on using the changeset viewer.