Ignore:
Timestamp:
Aug 2, 2017 7:16:06 AM (7 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:
2651724
Parents:
0d93464
Message:

New method to read in dq and di data names.

File:
1 edited

Legend:

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

    r0d93464 r9e0dd49  
    136136                elif class_prog.match(u'SASdata'): 
    137137                    self._initialize_new_data_set(parent_list) 
     138                    self._find_data_attributes(value) 
    138139                # Recursion step to access data within the group 
    139140                self.read_children(value, parent_list) 
     
    572573        self.current_datainfo.filename = self.raw_data.filename 
    573574 
     575    def _find_data_attributes(self, value): 
     576        attrs = value.attrs 
     577        signal = attrs.get("signal") 
     578        i_axes = attrs.get("I_axes") 
     579        q_indices = attrs.get("Q_indices") 
     580        mask = attrs.get("mask") 
     581        mask_indices = attrs.get("Mask_indices") 
     582        keys = value.keys() 
     583        self.q_name = i_axes[q_indices] 
     584        self.mask_name = mask[mask_indices] 
     585        self.i_name = signal 
     586        if self.q_name in keys: 
     587            q_vals = value.get(self.q_name) 
     588            self.q_uncertainties = q_vals.attrs.get("uncertainties") 
     589            self.q_resolutions = q_vals.attrs.get("resolutions") 
     590        if self.i_name in keys: 
     591            i_vals = value.get(self.i_name) 
     592            self.i_uncertainties = i_vals.attrs.get("uncertainties") 
     593 
    574594    def _find_intermediate(self, parent_list, basename=""): 
    575595        """ 
Note: See TracChangeset for help on using the changeset viewer.