Changeset 0bd8fac in sasview for src/sas/sascalc/dataloader/readers
- Timestamp:
- Jul 11, 2018 9:25:34 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:
- cf29187
- Parents:
- 7fd5e2a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py
rac38ab4 r0bd8fac 243 243 self.current_dataset.xaxis("Q", unit) 244 244 if isinstance(self.current_dataset, plottable_2D): 245 #FIXME: This is broken - need to properly handle 2D data 245 246 self.current_dataset.q = data_set.flatten() 246 247 else: 247 248 self.current_dataset.x = data_set.flatten() 248 249 elif key in self.q_uncertainties or key in self.q_resolutions: 250 # FIXME: This isn't right either. 249 251 if (len(self.q_resolutions) > 1 250 252 and np.where(self.q_resolutions == key)[0] == 0): … … 509 511 (n_rows, n_cols) = dataset.data.shape 510 512 dataset.y_bins = dataset.qy_data[0::n_cols] 511 dataset.x_bins = dataset.qx_data[ :n_cols]513 dataset.x_bins = dataset.qx_data[0::n_rows] 512 514 dataset.data = dataset.data.flatten() 513 515 self.current_dataset = dataset … … 562 564 :param value: SASdata/NXdata HDF5 Group 563 565 """ 564 signal = "I"565 i_axes = ["Q"]566 q_indices = [0]567 566 attrs = value.attrs 568 if hasattr(attrs, "signal"): 569 signal = attrs.get("signal") 570 if hasattr(attrs, "I_axes"): 571 i_axes = np.array(str(attrs.get("I_axes")).split(",")) 572 if hasattr(attrs, "Q_indices"): 573 q_indices = np.int_(attrs.get("Q_indices").split(",")) 567 signal = attrs.get("signal", "I") 568 i_axes = attrs.get("I_axes", ["Q"]) 569 q_indices = attrs.get("Q_indices", [0]) 570 try: 571 iter(q_indices) 572 except TypeError: 573 q_indices = [q_indices] 574 574 keys = value.keys() 575 575 self.mask_name = attrs.get("mask") … … 581 581 if item in keys: 582 582 q_vals = value.get(item) 583 if q_vals.attrs.get("uncertainties") :583 if q_vals.attrs.get("uncertainties") is not None: 584 584 self.q_uncertainties = q_vals.attrs.get("uncertainties") 585 elif q_vals.attrs.get("uncertainty") :585 elif q_vals.attrs.get("uncertainty") is not None: 586 586 self.q_uncertainties = q_vals.attrs.get("uncertainty") 587 if isinstance(self.q_uncertainties, str) :587 if isinstance(self.q_uncertainties, str) is not None: 588 588 self.q_uncertainties = [self.q_uncertainties] 589 if q_vals.attrs.get("resolutions") :589 if q_vals.attrs.get("resolutions") is not None: 590 590 self.q_resolutions = q_vals.attrs.get("resolutions") 591 591 if isinstance(self.q_resolutions, str): 592 self.q_resolutions = [self.q_resolutions]592 self.q_resolutions = self.q_resolutions.split(",") 593 593 if self.i_name in keys: 594 594 i_vals = value.get(self.i_name)
Note: See TracChangeset
for help on using the changeset viewer.