Changeset ba65aff in sasview for src/sas/sasgui/perspectives/file_converter/otoko_loader.py
- Timestamp:
- Aug 8, 2016 10:09:38 AM (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:
- 9e9f848
- Parents:
- d6bf064
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/file_converter/otoko_loader.py
r4b862c4 rba65aff 15 15 self.__dict__.update(kwds) 16 16 17 class BSLParsingError(Exception):17 class OTOKOParsingError(Exception): 18 18 pass 19 19 20 class BSLData:20 class OTOKOData: 21 21 def __init__(self, q_axis, data_axis): 22 22 self.q_axis = q_axis 23 23 self.data_axis = data_axis 24 24 25 class BSLLoader(object):25 class OTOKOLoader(object): 26 26 27 27 def __init__(self, qaxis_path, data_path): … … 36 36 37 37 Given the paths of two header files, this function will load each axis in 38 turn. If loading is successfull then an instance of the BSLData class38 turn. If loading is successfull then an instance of the OTOKOData class 39 39 will be returned, else an exception will be raised. 40 40 … … 50 50 data_axis = self._load_bsl_axis(self.data_path) 51 51 52 return BSLData(q_axis, data_axis)52 return OTOKOData(q_axis, data_axis) 53 53 54 54 def _load_bsl_axis(self, header_path): … … 60 60 """ 61 61 if not os.path.exists(header_path): 62 raise BSLParsingError("The header file %s does not exist." % header_path)62 raise OTOKOParsingError("The header file %s does not exist." % header_path) 63 63 64 64 binary_file_info_list = [] … … 69 69 lines = header_file.readlines() 70 70 if len(lines) < 4: 71 raise BSLParsingError("Expected more lines in %s." % header_path)71 raise OTOKOParsingError("Expected more lines in %s." % header_path) 72 72 73 73 info = lines[0] + lines[1] … … 85 85 86 86 if len(indicators) != 10: 87 raise BSLParsingError(87 raise OTOKOParsingError( 88 88 "Expected 10 integer indicators on line 3 of %s." \ 89 89 % header_path) 90 90 if not all([i.isdigit() for i in indicators]): 91 raise BSLParsingError(91 raise OTOKOParsingError( 92 92 "Expected all indicators on line 3 of %s to be integers." \ 93 93 % header_path) … … 115 115 all_n_channels = [info.n_channels for info in binary_file_info_list] 116 116 if not all(all_n_channels[0] == c for c in all_n_channels): 117 raise BSLParsingError(117 raise OTOKOParsingError( 118 118 "Expected all binary files listed in %s to have the same number of channels." % header_path) 119 119 … … 123 123 for info in binary_file_info_list: 124 124 if not os.path.exists(info.file_path): 125 raise BSLParsingError(125 raise OTOKOParsingError( 126 126 "The data file %s does not exist." % info.file_path) 127 127
Note: See TracChangeset
for help on using the changeset viewer.