Changeset 02c1608e in sasview


Ignore:
Timestamp:
Jul 9, 2018 4:02:07 PM (12 months 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:
369ed11d
Parents:
f5483ef
Message:

Allow for multiple Q resolutions/uncertainties for USANS data. refs #976

Location:
src/sas
Files:
2 edited

Legend:

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

    rcf820f5 r02c1608e  
    105105        self.i_name = u'' 
    106106        self.i_node = u'' 
    107         self.q_uncertainties = u'' 
    108         self.q_resolutions = u'' 
     107        self.q_uncertainties = [] 
     108        self.q_resolutions = [] 
    109109        self.i_uncertainties = u'' 
    110110        self.parent_class = u'' 
     
    246246            else: 
    247247                self.current_dataset.x = data_set.flatten() 
    248         elif key in self.q_resolutions: 
    249             if key == u'dQw': 
     248        elif key in self.q_uncertainties or key in self.q_resolutions: 
     249            if (len(self.q_resolutions) > 1 
     250                    and np.where(self.q_resolutions == key)[0] == 0): 
    250251                self.current_dataset.dxw = data_set.flatten() 
    251             elif key == u'dQl': 
     252            elif (len(self.q_resolutions) > 1 
     253                  and np.where(self.q_resolutions == key)[0] == 1): 
    252254                self.current_dataset.dxl = data_set.flatten() 
    253255            else: 
     
    553555        self.i_node = "" 
    554556        self.q_name = [] 
    555         self.q_uncertainties = "" 
    556         self.q_resolutions = "" 
     557        self.q_uncertainties = [] 
     558        self.q_resolutions = [] 
    557559        self.i_uncertainties = "" 
    558560 
     
    582584            if item in keys: 
    583585                q_vals = value.get(item) 
    584                 self.q_uncertainties = q_vals.attrs.get("uncertainties") 
    585                 if self.q_uncertainties is None: 
     586                if q_vals.attrs.get("uncertainties"): 
     587                    self.q_uncertainties = q_vals.attrs.get("uncertainties") 
     588                elif q_vals.attrs.get("uncertainty"): 
    586589                    self.q_uncertainties = q_vals.attrs.get("uncertainty") 
    587                 self.q_resolutions = q_vals.attrs.get("resolutions") 
     590                if isinstance(self.q_uncertainties, str): 
     591                    self.q_uncertainties = [self.q_uncertainties] 
     592                if q_vals.attrs.get("resolutions"): 
     593                    self.q_resolutions = q_vals.attrs.get("resolutions") 
     594                if isinstance(self.q_resolutions, str): 
     595                    self.q_resolutions = [self.q_resolutions] 
    588596        if self.i_name in keys: 
    589597            i_vals = value.get(self.i_name) 
  • src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py

    r2924532 r02c1608e  
    239239            self.load_complete(output=output, message="Loading data complete!", 
    240240                               info="info") 
    241         else: 
    242             self.load_complete(output=None, message=error_message, info="error") 
    243241 
    244242    def load_update(self, message="", info="warning"): 
Note: See TracChangeset for help on using the changeset viewer.