Changeset cf29187 in sasview for src/sas/sascalc


Ignore:
Timestamp:
Jul 13, 2018 4:22:31 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:
96d06a4
Parents:
0bd8fac
Message:

Fix typo in writer, output new files, and fix reader to properly read in indices.

Location:
src/sas/sascalc
Files:
2 edited

Legend:

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

    r0bd8fac rcf29187  
    558558        self.i_uncertainties = "" 
    559559 
     560    @staticmethod 
     561    def check_is_list_or_array(iterable): 
     562        try: 
     563            iter(iterable) 
     564            if (not isinstance(iterable, np.ndarray)) or (isinstance(iterable, str) 
     565                    or isinstance(iterable, unicode)): 
     566                raise TypeError 
     567        except TypeError: 
     568            iterable = iterable.split(",") 
     569        return iterable 
     570 
    560571    def _find_data_attributes(self, value): 
    561572        """ 
     
    568579        i_axes = attrs.get("I_axes", ["Q"]) 
    569580        q_indices = attrs.get("Q_indices", [0]) 
    570         try: 
    571             iter(q_indices) 
    572         except TypeError: 
    573             q_indices = [q_indices] 
     581        q_indices = map(int, self.check_is_list_or_array(q_indices)) 
     582        i_axes = self.check_is_list_or_array(i_axes) 
    574583        keys = value.keys() 
    575584        self.mask_name = attrs.get("mask") 
  • src/sas/sascalc/file_converter/nxcansas_writer.py

    rac38ab4 rcf29187  
    304304        data_entry.attrs['signal'] = 'I' 
    305305        data_entry.attrs['I_axes'] = 'Q' 
    306         data_entry.attrs['Q_indicies'] = 0 
     306        data_entry.attrs['Q_indices'] = [0] 
    307307        q_entry = data_entry.create_dataset('Q', data=data_obj.x) 
    308308        q_entry.attrs['units'] = data_obj.x_unit 
     
    333333        data_entry.attrs['signal'] = 'I' 
    334334        data_entry.attrs['I_axes'] = 'Qx,Qy' 
    335         data_entry.attrs['Q_indicies'] = [0,1] 
     335        data_entry.attrs['Q_indices'] = [0,1] 
    336336 
    337337        (n_rows, n_cols) = (len(data.y_bins), len(data.x_bins)) 
Note: See TracChangeset for help on using the changeset viewer.