Changeset dcd534e in sasview for src/sas/sascalc/dataloader
- Timestamp:
- Dec 5, 2017 6:55:39 AM (7 years ago)
- Children:
- 163c3e0
- Parents:
- 814ee32 (diff), 79c9ce5 (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. - Location:
- src/sas/sascalc/dataloader
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/file_reader_base_class.py
r814ee32 rdcd534e 27 27 28 28 class FileReader(object): 29 # List of Data1D and Data2D objects to be sent back to data_loader30 output = []31 # Current plottable_(1D/2D) object being loaded in32 current_dataset = None33 # Current DataInfo object being loaded in34 current_datainfo = None35 29 # String to describe the type of data this reader can load 36 30 type_name = "ASCII" … … 43 37 # Able to import the unit converter 44 38 has_converter = True 45 # Open file handle46 f_open = None47 39 # Default value of zero 48 40 _ZERO = 1e-16 41 42 def __init__(self): 43 # List of Data1D and Data2D objects to be sent back to data_loader 44 self.output = [] 45 # Current plottable_(1D/2D) object being loaded in 46 self.current_dataset = None 47 # Current DataInfo object being loaded in 48 self.current_datainfo = None 49 # Open file handle 50 self.f_open = None 49 51 50 52 def read(self, filepath): -
src/sas/sascalc/dataloader/readers/sesans_reader.py
r849094a r814ee32 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.