Changeset b9d74f3 in sasview for src/sas/sascalc/invariant/invariant.py
- Timestamp:
- Apr 20, 2017 6:29:34 AM (8 years ago)
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/invariant/invariant.py
r7432acb rb9d74f3 424 424 if not issubclass(data.__class__, LoaderData1D): 425 425 #Process only data that inherited from DataLoader.Data_info.Data1D 426 raise ValueError , "Data must be of type DataLoader.Data1D"426 raise ValueError("Data must be of type DataLoader.Data1D") 427 427 #from copy import deepcopy 428 428 new_data = (self._scale * data) - self._background … … 484 484 msg = "Length x and y must be equal" 485 485 msg += " and greater than 1; got x=%s, y=%s" % (len(data.x), len(data.y)) 486 raise ValueError , msg486 raise ValueError(msg) 487 487 else: 488 488 # Take care of smeared data … … 533 533 msg = "Length of data.x and data.y must be equal" 534 534 msg += " and greater than 1; got x=%s, y=%s" % (len(data.x), len(data.y)) 535 raise ValueError , msg535 raise ValueError(msg) 536 536 else: 537 537 #Create error for data without dy error … … 742 742 range = range.lower() 743 743 if range not in ['high', 'low']: 744 raise ValueError , "Extrapolation range should be 'high' or 'low'"744 raise ValueError("Extrapolation range should be 'high' or 'low'") 745 745 function = function.lower() 746 746 if function not in ['power_law', 'guinier']: 747 747 msg = "Extrapolation function should be 'guinier' or 'power_law'" 748 raise ValueError , msg748 raise ValueError(msg) 749 749 750 750 if range == 'high': 751 751 if function != 'power_law': 752 752 msg = "Extrapolation only allows a power law at high Q" 753 raise ValueError , msg753 raise ValueError(msg) 754 754 self._high_extrapolation_npts = npts 755 755 self._high_extrapolation_power = power … … 852 852 """ 853 853 if contrast <= 0: 854 raise ValueError , "The contrast parameter must be greater than zero"854 raise ValueError("The contrast parameter must be greater than zero") 855 855 856 856 # Make sure Q star is up to date … … 859 859 if self._qstar <= 0: 860 860 msg = "Invalid invariant: Invariant Q* must be greater than zero" 861 raise RuntimeError , msg861 raise RuntimeError(msg) 862 862 863 863 # Compute intermediate constant … … 869 869 if discrim < 0: 870 870 msg = "Could not compute the volume fraction: negative discriminant" 871 raise RuntimeError , msg871 raise RuntimeError(msg) 872 872 elif discrim == 0: 873 873 return 1 / 2 … … 881 881 return volume2 882 882 msg = "Could not compute the volume fraction: inconsistent results" 883 raise RuntimeError , msg883 raise RuntimeError(msg) 884 884 885 885 def get_qstar_with_error(self, extrapolation=None):
Note: See TracChangeset
for help on using the changeset viewer.