Changeset 0b79323 in sasview for src/sas/sascalc/dataloader/file_reader_base_class.py
- Timestamp:
- Jul 27, 2017 7:11:42 AM (7 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 9d786e5
- Parents:
- 7477fb9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/file_reader_base_class.py
r7477fb9 r0b79323 54 54 self.f_open = open(filepath, 'rb') 55 55 self.get_file_contents() 56 self.sort_one_d_data() 56 57 if isinstance(self.output[0], Data1D): 58 self.sort_one_d_data() 59 elif isinstance(self.output[0], Data2D): 60 self.sort_two_d_data() 61 57 62 except DataReaderException as e: 58 63 self.handle_error_message(e.message) … … 124 129 self.output = final_list 125 130 131 def sort_two_d_data(self): 132 final_list = [] 133 for dataset in self.output: 134 dataset.data = dataset.data.astype(np.float64) 135 dataset.qx_data = dataset.qx_data.astype(np.float64) 136 dataset.xmin = np.min(dataset.qx_data) 137 dataset.xmax = np.max(dataset.qx_data) 138 dataset.qy_data = dataset.qy_data.astype(np.float64) 139 dataset.ymin = np.min(dataset.qy_data) 140 dataset.ymax = np.max(dataset.qy_data) 141 dataset.q_data = np.sqrt(dataset.qx_data * dataset.qx_data 142 + dataset.qy_data * dataset.qy_data) 143 if dataset.err_data is not None: 144 dataset.err_data = dataset.err_data.astype(np.float64) 145 if dataset.dqx_data is not None: 146 dataset.dqx_data = dataset.dqx_data.astype(np.float64) 147 if dataset.dqy_data is not None: 148 dataset.dqy_data = dataset.dqy_data.astype(np.float64) 149 if dataset.mask is not None: 150 dataset.mask = dataset.mask.astype(dtype=bool) 151 152 if len(dataset.shape) == 2: 153 n_rows, n_cols = dataset.shape 154 dataset.y_bins = dataset.qy_data[0::int(n_cols)] 155 dataset.x_bins = dataset.qx_data[:int(n_cols)] 156 dataset.data = dataset.data.flatten() 157 else: 158 dataset.y_bins = [] 159 dataset.x_bins = [] 160 dataset.data = dataset.data.flatten() 161 final_list.append(dataset) 162 self.output = final_list 163 126 164 def set_all_to_none(self): 127 165 """
Note: See TracChangeset
for help on using the changeset viewer.