Changeset 3053a4a in sasview for src/sas/sascalc
- Timestamp:
- Dec 5, 2017 12:29:37 PM (7 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- f53d684
- Parents:
- 79c9ce5
- git-author:
- Paul Kienzle <pkienzle@…> (12/05/17 12:29:37)
- git-committer:
- GitHub <noreply@…> (12/05/17 12:29:37)
- Location:
- src/sas/sascalc/dataloader
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/file_reader_base_class.py
rcb11a25 r3053a4a 47 47 # Current DataInfo object being loaded in 48 48 self.current_datainfo = None 49 # File path sent to reader 50 self.filepath = None 49 51 # Open file handle 50 52 self.f_open = None … … 56 58 :param filepath: The full or relative path to a file to be loaded 57 59 """ 60 self.filepath = filepath 58 61 if os.path.isfile(filepath): 59 62 basename, extension = os.path.splitext(os.path.basename(filepath)) … … 98 101 self.current_datainfo = None 99 102 self.current_dataset = None 103 self.filepath = None 100 104 self.output = [] 101 105 -
src/sas/sascalc/dataloader/readers/sesans_reader.py
r849094a r3053a4a 12 12 from ..file_reader_base_class import FileReader 13 13 from ..data_info import plottable_1D, DataInfo 14 from ..loader_exceptions import FileContentsException , DataReaderException14 from ..loader_exceptions import FileContentsException 15 15 16 16 # Check whether we have a converter available … … 18 18 try: 19 19 from sas.sascalc.data_util.nxsunit import Converter 20 except :20 except ImportError: 21 21 has_converter = False 22 22 _ZERO = 1e-16 … … 46 46 line = self.nextline() 47 47 params = {} 48 while not line.startswith("BEGIN_DATA"):48 while line and not line.startswith("BEGIN_DATA"): 49 49 terms = line.split() 50 50 if len(terms) >= 2: … … 63 63 raise FileContentsException("Wavelength has no units") 64 64 if params["SpinEchoLength_unit"] != params["Wavelength_unit"]: 65 raise FileContentsException("The spin echo data has rudely used " 66 "different units for the spin echo length " 67 "and the wavelength. While sasview could " 68 "handle this instance, it is a violation " 69 "of the file format and will not be " 70 "handled by other software.") 65 raise FileContentsException( 66 "The spin echo data has rudely used " 67 "different units for the spin echo length " 68 "and the wavelength. While sasview could " 69 "handle this instance, it is a violation " 70 "of the file format and will not be " 71 "handled by other software.") 71 72 72 73 headers = self.nextline().split() … … 86 87 87 88 if not data.size: 88 raise FileContentsException("{} is empty".format( path))89 raise FileContentsException("{} is empty".format(self.filepath)) 89 90 x = data[:, headers.index("SpinEchoLength")] 90 91 if "SpinEchoLength_error" in headers:
Note: See TracChangeset
for help on using the changeset viewer.