Changeset 8d5e11c in sasview
- Timestamp:
- Sep 11, 2018 11:47:02 AM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
- Children:
- 4fdcc65
- Parents:
- 9dc1500
- Location:
- src/sas/sascalc/dataloader
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/data_info.py
r9e6aeaf r8d5e11c 954 954 _str += "Data:\n" 955 955 _str += " Type: %s\n" % self.__class__.__name__ 956 _str += " X- & Y-axis: %s\t[%s]\n" % (self._yaxis, self._yunit) 956 _str += " X-axis: %s\t[%s]\n" % (self._xaxis, self._xunit) 957 _str += " Y-axis: %s\t[%s]\n" % (self._yaxis, self._yunit) 957 958 _str += " Z-axis: %s\t[%s]\n" % (self._zaxis, self._zunit) 958 959 _str += " Length: %g \n" % (len(self.data)) … … 983 984 qx_data=qx_data, qy_data=qy_data, 984 985 q_data=q_data, mask=mask) 986 987 clone._xaxis = self._xaxis 988 clone._yaxis = self._yaxis 989 clone._zaxis = self._zaxis 990 clone._xunit = self._xunit 991 clone._yunit = self._yunit 992 clone._zunit = self._zunit 985 993 986 994 clone.title = self.title … … 1153 1161 def combine_data_info_with_plottable(data, datainfo): 1154 1162 """ 1155 A function that combines the DataInfo data in self.current_datainto with a plottable_1D or 2D data object. 1163 A function that combines the DataInfo data in self.current_datainto with a 1164 plottable_1D or 2D data object. 1156 1165 1157 1166 :param data: A plottable_1D or plottable_2D data object … … 1171 1180 final_dataset.yaxis(data._yaxis, data._yunit) 1172 1181 elif isinstance(data, plottable_2D): 1173 final_dataset = Data2D(data.data, data.err_data, data.qx_data, data.qy_data, data.q_data, 1174 data.mask, data.dqx_data, data.dqy_data) 1182 final_dataset = Data2D(data.data, data.err_data, data.qx_data, 1183 data.qy_data, data.q_data, data.mask, 1184 data.dqx_data, data.dqy_data) 1175 1185 final_dataset.xaxis(data._xaxis, data._xunit) 1176 1186 final_dataset.yaxis(data._yaxis, data._yunit) … … 1181 1191 final_dataset.x_bins = data.qx_data[:int(n_cols)] 1182 1192 else: 1183 return_string = "Should Never Happen: _combine_data_info_with_plottable input is not a plottable1d or " + \ 1184 "plottable2d data object" 1193 return_string = ("Should Never Happen: _combine_data_info_with_plottabl" 1194 "e input is not a plottable1d or plottable2d data " 1195 "object") 1185 1196 return return_string 1186 1197 -
src/sas/sascalc/dataloader/file_reader_base_class.py
r8f882fe r8d5e11c 37 37 "load the file was made, but, should it be successful, " 38 38 "SasView cannot guarantee the accuracy of the data.") 39 39 40 40 41 class FileReader(object): … … 141 142 Returns the entire file as a string. 142 143 """ 143 #return self.f_open.read()144 144 return decode(self.f_open.read()) 145 145 … … 308 308 Converts al; data to the sasview default of units of A^{-1} for Q and 309 309 cm^{-1} for I. 310 :param default_ x_unit: The default xunit used by Sasview311 :param default_ y_unit: The default yunit used by Sasview310 :param default_q_unit: The default Q unit used by Sasview 311 :param default_i_unit: The default I unit used by Sasview 312 312 """ 313 313 new_output = [] … … 347 347 elif isinstance(data, Data2D): 348 348 try: 349 data.qx_data = data_conv_x(data.qx_data, units=default_q_unit) 349 data.qx_data = data_conv_x(data.qx_data, 350 units=default_q_unit) 350 351 if data.dqx_data is not None: 351 data.dqx_data = data_conv_x(data.dqx_data, units=default_q_unit) 352 data.qy_data = data_conv_y(data.qy_data, units=default_q_unit) 352 data.dqx_data = data_conv_x(data.dqx_data, 353 units=default_q_unit) 354 data.qy_data = data_conv_y(data.qy_data, 355 units=default_q_unit) 353 356 if data.dqy_data is not None: 354 data.dqy_data = data_conv_y(data.dqy_data, units=default_q_unit) 357 data.dqy_data = data_conv_y(data.dqy_data, 358 units=default_q_unit) 355 359 except KeyError: 356 360 message = "Unable to convert Q units from {0} to 1/A." … … 362 366 data.data = data_conv_z(data.data, units=default_i_unit) 363 367 if data.err_data is not None: 364 data.err_data = data_conv_z(data.err_data, units=default_i_unit) 368 data.err_data = data_conv_z(data.err_data, 369 units=default_i_unit) 365 370 except KeyError: 366 371 message = "Unable to convert I units from {0} to 1/cm." … … 462 467 self.current_dataset.qy_data)) 463 468 if has_error_dy: 464 self.current_dataset.err_data = self.current_dataset.err_data[x != 0] 469 self.current_dataset.err_data = self.current_dataset.err_data[ 470 x != 0] 465 471 if has_error_dqx: 466 self.current_dataset.dqx_data = self.current_dataset.dqx_data[x != 0] 472 self.current_dataset.dqx_data = self.current_dataset.dqx_data[ 473 x != 0] 467 474 if has_error_dqy: 468 self.current_dataset.dqy_data = self.current_dataset.dqy_data[x != 0] 475 self.current_dataset.dqy_data = self.current_dataset.dqy_data[ 476 x != 0] 469 477 if has_mask: 470 478 self.current_dataset.mask = self.current_dataset.mask[x != 0] -
src/sas/sascalc/dataloader/loader.py
r4a8d55c r8d5e11c 367 367 try: 368 368 return fn(path, data) 369 except Exception :369 except Exception as exep: 370 370 pass # give other loaders a chance to succeed 371 371 # If we get here it is because all loaders failed 372 raise # reraises last exception372 raise exep # raises last exception 373 373 374 374
Note: See TracChangeset
for help on using the changeset viewer.