Changeset fdef956 in sasview for sansguiframe


Ignore:
Timestamp:
Jun 14, 2012 8:05:22 PM (13 years ago)
Author:
Jae Cho <jhjcho@…>
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.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
d7b49576
Parents:
0008f54
Message:

sum model editot can handle multi model too.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansguiframe/src/sans/guiframe/dataFitting.py

    r0008f54 rfdef956  
    364364        return _str  
    365365     
     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     
    366434    def _perform_operation(self, other, operation): 
    367435        """ 
Note: See TracChangeset for help on using the changeset viewer.