Changeset 7b07fbe in sasview for src/sas/sascalc/dataloader/file_reader_base_class.py
- Timestamp:
- Sep 25, 2017 11:51:21 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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- deaa0c6
- Parents:
- 1fa4f736
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/file_reader_base_class.py
rae69c690 r7b07fbe 191 191 self.output = [] 192 192 193 def remove_empty_q_values(self, has_error_dx=False, has_error_dy=False, 194 has_error_dxl=False, has_error_dxw=False): 193 def data_cleanup(self): 194 """ 195 Clean up the data sets and refresh everything 196 :return: None 197 """ 198 self.remove_empty_q_values() 199 self.send_to_output() # Combine datasets with DataInfo 200 self.current_datainfo = DataInfo() # Reset DataInfo 201 202 def remove_empty_q_values(self): 195 203 """ 196 204 Remove any point where Q == 0 197 205 """ 198 x = self.current_dataset.x 199 self.current_dataset.x = self.current_dataset.x[x != 0] 200 self.current_dataset.y = self.current_dataset.y[x != 0] 201 if has_error_dy: 202 self.current_dataset.dy = self.current_dataset.dy[x != 0] 203 if has_error_dx: 204 self.current_dataset.dx = self.current_dataset.dx[x != 0] 205 if has_error_dxl: 206 self.current_dataset.dxl = self.current_dataset.dxl[x != 0] 207 if has_error_dxw: 208 self.current_dataset.dxw = self.current_dataset.dxw[x != 0] 206 if isinstance(self.current_dataset, plottable_1D): 207 # Booleans for resolutions 208 has_error_dx = self.current_dataset.dx is not None 209 has_error_dxl = self.current_dataset.dxl is not None 210 has_error_dxw = self.current_dataset.dxw is not None 211 has_error_dy = self.current_dataset.dy is not None 212 # Create arrays of zeros for non-existent resolutions 213 if has_error_dxw and not has_error_dxl: 214 array_size = self.current_dataset.dxw.size - 1 215 self.current_dataset.dxl = np.append(self.current_dataset.dxl, 216 np.zeros([array_size])) 217 has_error_dxl = True 218 elif has_error_dxl and not has_error_dxw: 219 array_size = self.current_dataset.dxl.size - 1 220 self.current_dataset.dxw = np.append(self.current_dataset.dxw, 221 np.zeros([array_size])) 222 has_error_dxw = True 223 elif not has_error_dxl and not has_error_dxw and not has_error_dx: 224 array_size = self.current_dataset.x.size - 1 225 self.current_dataset.dx = np.append(self.current_dataset.dx, 226 np.zeros([array_size])) 227 has_error_dx = True 228 if not has_error_dy: 229 array_size = self.current_dataset.y.size - 1 230 self.current_dataset.dy = np.append(self.current_dataset.dy, 231 np.zeros([array_size])) 232 has_error_dy = True 233 234 # Remove points where q = 0 235 x = self.current_dataset.x 236 self.current_dataset.x = self.current_dataset.x[x != 0] 237 self.current_dataset.y = self.current_dataset.y[x != 0] 238 if has_error_dy: 239 self.current_dataset.dy = self.current_dataset.dy[x != 0] 240 if has_error_dx: 241 self.current_dataset.dx = self.current_dataset.dx[x != 0] 242 if has_error_dxl: 243 self.current_dataset.dxl = self.current_dataset.dxl[x != 0] 244 if has_error_dxw: 245 self.current_dataset.dxw = self.current_dataset.dxw[x != 0] 246 elif isinstance(self.current_dataset, plottable_2D): 247 has_error_dqx = self.current_dataset.dqx_data is not None 248 has_error_dqy = self.current_dataset.dqy_data is not None 249 has_error_dy = self.current_dataset.err_data is not None 250 has_mask = self.current_dataset.mask is not None 251 has_q_data = self.current_dataset.q_data is not None 252 x = self.current_dataset.qx_data 253 self.current_dataset.data = self.current_dataset.data[x != 0] 254 self.current_dataset.qx_data = self.current_dataset.qx_data[x != 0] 255 self.current_dataset.qy_data = self.current_dataset.qy_data[x != 0] 256 if has_error_dy: 257 self.current_dataset.err_data = self.current_dataset.err_data[x != 0] 258 if has_error_dqx: 259 self.current_dataset.dqx_data = self.current_dataset.dqx_data[x != 0] 260 if has_error_dqy: 261 self.current_dataset.dqy_data = self.current_dataset.dqy_data[x != 0] 262 if has_mask: 263 self.current_dataset.mask = self.current_dataset.mask[x != 0] 264 if has_q_data: 265 self.current_dataset.q_data = self.current_dataset.q_data[x != 0] 209 266 210 267 def reset_data_list(self, no_lines=0):
Note: See TracChangeset
for help on using the changeset viewer.