Changeset 96d06a4 in sasview for src/sas/sascalc/dataloader
- Timestamp:
- Jul 24, 2018 12:22:13 PM (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:
- 35ac8df
- Parents:
- cf29187
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py
rcf29187 r96d06a4 207 207 # Everything else goes in meta_data 208 208 elif self.parent_class == u'SASdata': 209 self.process_data_object(data_set, key, unit) 209 if isinstance(self.current_dataset, plottable_2D): 210 self.process_2d_data_object(data_set, key, unit) 211 else: 212 self.process_1d_data_object(data_set, key, unit) 213 210 214 break 211 215 elif self.parent_class == u'SAStransmission_spectrum': … … 221 225 self.errors.add("ShouldNeverHappenException") 222 226 223 def process_ data_object(self, data_set, key, unit):224 """ 225 SASdata processor method 227 def process_1d_data_object(self, data_set, key, unit): 228 """ 229 SASdata processor method for 1d data items 226 230 :param data_set: data from HDF5 file 227 231 :param key: canSAS_class attribute … … 229 233 """ 230 234 if key == self.i_name: 231 if isinstance(self.current_dataset, plottable_2D): 232 self.current_dataset.data = data_set 233 self.current_dataset.zaxis("Intensity", unit) 234 else: 235 self.current_dataset.y = data_set.flatten() 236 self.current_dataset.yaxis("Intensity", unit) 235 self.current_dataset.y = data_set.flatten() 236 self.current_dataset.yaxis("Intensity", unit) 237 237 elif key == self.i_uncertainties: 238 if isinstance(self.current_dataset, plottable_2D): 239 self.current_dataset.err_data = data_set.flatten() 240 else: 241 self.current_dataset.dy = data_set.flatten() 238 self.current_dataset.dy = data_set.flatten() 242 239 elif key in self.q_name: 243 240 self.current_dataset.xaxis("Q", unit) 244 if isinstance(self.current_dataset, plottable_2D): 245 #FIXME: This is broken - need to properly handle 2D data 246 self.current_dataset.q = data_set.flatten() 247 else: 248 self.current_dataset.x = data_set.flatten() 241 self.current_dataset.x = data_set.flatten() 249 242 elif key in self.q_uncertainties or key in self.q_resolutions: 250 # FIXME: This isn't right either.251 243 if (len(self.q_resolutions) > 1 252 244 and np.where(self.q_resolutions == key)[0] == 0): … … 257 249 else: 258 250 self.current_dataset.dx = data_set.flatten() 251 elif key == self.mask_name: 252 self.current_dataset.mask = data_set.flatten() 253 elif key == u'wavelength': 254 self.current_datainfo.source.wavelength = data_set[0] 255 self.current_datainfo.source.wavelength_unit = unit 256 257 def process_2d_data_object(self, data_set, key, unit): 258 if key == self.i_name: 259 self.current_dataset.data = data_set 260 self.current_dataset.zaxis("Intensity", unit) 261 elif key == self.i_uncertainties: 262 self.current_dataset.err_data = data_set.flatten() 263 elif key in self.q_name: 264 self.current_dataset.xaxis("Q", unit) 265 self.current_dataset.yaxis("Q", unit) 266 #FIXME: This is broken - need to properly handle 2D data 267 # TODO: Check shape of array (2d - cash money, homey!) 268 # TODO: 3D - check dims, etc. 269 # TODO: Put data where it belongs 270 pass 271 elif key in self.q_uncertainties or key in self.q_resolutions: 272 # FIXME: This isn't right either. 273 # TODO: find resolution/uncertainty specific to q_name 274 pass 259 275 elif key == u'Qy': 260 276 self.current_dataset.yaxis("Q_y", unit) … … 267 283 elif key == u'Qxdev': 268 284 self.current_dataset.dqx_data = data_set.flatten() 269 elif key == self.mask_name:270 self.current_dataset.mask = data_set.flatten()271 elif key == u'wavelength':272 self.current_datainfo.source.wavelength = data_set[0]273 self.current_datainfo.source.wavelength_unit = unit274 285 275 286 def process_trans_spectrum(self, data_set, key):
Note: See TracChangeset
for help on using the changeset viewer.