Changeset 0bd8fac in sasview


Ignore:
Timestamp:
Jul 11, 2018 9:25:34 PM (6 years ago)
Author:
krzywon
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
Message:

Code cleanup and removal of non-standard NXcanSAS files.

Location:
src/sas
Files:
2 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py

    rac38ab4 r0bd8fac  
    243243            self.current_dataset.xaxis("Q", unit) 
    244244            if isinstance(self.current_dataset, plottable_2D): 
     245                #FIXME: This is broken - need to properly handle 2D data 
    245246                self.current_dataset.q = data_set.flatten() 
    246247            else: 
    247248                self.current_dataset.x = data_set.flatten() 
    248249        elif key in self.q_uncertainties or key in self.q_resolutions: 
     250            # FIXME: This isn't right either. 
    249251            if (len(self.q_resolutions) > 1 
    250252                    and np.where(self.q_resolutions == key)[0] == 0): 
     
    509511                (n_rows, n_cols) = dataset.data.shape 
    510512                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] 
    512514                dataset.data = dataset.data.flatten() 
    513515            self.current_dataset = dataset 
     
    562564        :param value: SASdata/NXdata HDF5 Group 
    563565        """ 
    564         signal = "I" 
    565         i_axes = ["Q"] 
    566         q_indices = [0] 
    567566        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] 
    574574        keys = value.keys() 
    575575        self.mask_name = attrs.get("mask") 
     
    581581            if item in keys: 
    582582                q_vals = value.get(item) 
    583                 if q_vals.attrs.get("uncertainties"): 
     583                if q_vals.attrs.get("uncertainties") is not None: 
    584584                    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: 
    586586                    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: 
    588588                    self.q_uncertainties = [self.q_uncertainties] 
    589                 if q_vals.attrs.get("resolutions"): 
     589                if q_vals.attrs.get("resolutions") is not None: 
    590590                    self.q_resolutions = q_vals.attrs.get("resolutions") 
    591591                if isinstance(self.q_resolutions, str): 
    592                     self.q_resolutions = [self.q_resolutions] 
     592                    self.q_resolutions = self.q_resolutions.split(",") 
    593593        if self.i_name in keys: 
    594594            i_vals = value.get(self.i_name) 
Note: See TracChangeset for help on using the changeset viewer.