Changeset 51a4d78 in sasview for src/sas/sasgui/guiframe/dataFitting.py
- Timestamp:
- Oct 8, 2016 3:33:04 PM (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.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 1fac6c0
- Parents:
- 7988501 (diff), f7bc948 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/dataFitting.py
r7988501 r51a4d78 378 378 _str = "%s\n" % LoadData2D.__str__(self) 379 379 return _str 380 381 def _validity_check(self, other): 382 """ 383 Checks that the data lengths are compatible. 384 Checks that the x vectors are compatible. 385 Returns errors vectors equal to original 386 errors vectors if they were present or vectors 387 of zeros when none was found. 388 389 :param other: other data set for operation 390 391 :return: dy for self, dy for other [numpy arrays] 392 393 :raise ValueError: when lengths are not compatible 394 395 """ 396 err_other = None 397 if isinstance(other, Data2D): 398 # Check that data lengths are the same 399 if len(self.data) != len(other.data) or \ 400 len(self.qx_data) != len(other.qx_data) or \ 401 len(self.qy_data) != len(other.qy_data): 402 msg = "Unable to perform operation: data length are not equal" 403 raise ValueError, msg 404 #if len(self.data) < 1: 405 # msg = "Incompatible data sets: I-values do not match" 406 # raise ValueError, msg 407 for ind in range(len(self.data)): 408 if self.qx_data[ind] != other.qx_data[ind]: 409 msg = "Incompatible data sets: qx-values do not match" 410 raise ValueError, msg 411 if self.qy_data[ind] != other.qy_data[ind]: 412 msg = "Incompatible data sets: qy-values do not match" 413 raise ValueError, msg 414 415 # Check that the scales match 416 err_other = other.err_data 417 if other.err_data == None or \ 418 (len(other.err_data) != len(other.data)): 419 err_other = numpy.zeros(len(other.data)) 420 421 # Check that we have errors, otherwise create zero vector 422 err = self.err_data 423 if self.err_data == None or \ 424 (len(self.err_data) != len(self.data)): 425 err = numpy.zeros(len(other.data)) 426 427 return err, err_other 428 429 def _validity_check_union(self, other): 430 """ 431 Checks that the data lengths are compatible. 432 Checks that the x vectors are compatible. 433 Returns errors vectors equal to original 434 errors vectors if they were present or vectors 435 of zeros when none was found. 436 437 :param other: other data set for operation 438 439 :return: bool 440 441 :raise ValueError: when data types are not compatible 442 443 """ 444 if not isinstance(other, Data2D): 445 msg = "Unable to perform operation: different types of data set" 446 raise ValueError, msg 447 return True 448 380 449 381 def _perform_operation(self, other, operation): 450 382 """
Note: See TracChangeset
for help on using the changeset viewer.