Ignore:
Timestamp:
Aug 17, 2016 11:55:19 AM (8 years ago)
Author:
lewis
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
1ddf8f0
Parents:
54ba66e
Message:

Ensure SASdetector and SASsample are written/read correctly

File:
1 edited

Legend:

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

    r54ba66e r88d85c6  
    184184                    elif key == u'Title' and self.parent_class == u'SASsample': 
    185185                        self.current_datainfo.sample.name = data_point 
     186                    elif key == u'name' and self.parent_class == u'SASsample': 
     187                        self.current_datainfo.sample.name = data_point 
    186188                    elif key == u'thickness' and self.parent_class == u'SASsample': 
    187189                        self.current_datainfo.sample.thickness = data_point 
     
    207209                        self.process.name = data_point 
    208210                    elif key == u'Title' and self.parent_class == u'SASprocess': 
     211                        self.process.name = data_point 
     212                    elif key == u'name' and self.parent_class == u'SASprocess': 
    209213                        self.process.name = data_point 
    210214                    elif key == u'description' and self.parent_class == u'SASprocess': 
     
    433437            sample_entry = sasentry.create_group('sassample') 
    434438            sample_entry.attrs['canSAS_class'] = 'SASsample' 
    435             sample_entry.attrs['name'] = data_info.sample.name 
    436             sample_entry['ID'] = _h5_string(data_info.sample.name) 
     439            sample_entry['name'] = _h5_string(data_info.sample.name) 
    437440            sample_attrs = ['thickness', 'temperature'] 
    438441            for key in sample_attrs: 
    439442                if getattr(data_info.sample, key) is not None: 
    440443                    sample_entry.create_dataset(key, data=np.array([getattr(data_info.sample, key)])) 
    441                     # sample_entry[key] = np.array(getattr(data_info.sample, key), 
    442                     #     dtype=np.float32) 
    443444 
    444445            instrument_entry = sasentry.create_group('sasinstrument') 
     
    472473                    detector_entry = instrument_entry.create_group( 
    473474                        'sasdetector{0:0=2d}'.format(i)) 
    474                     detector_entry.attrs['casnSAS_class'] = 'SASdetector' 
     475                    detector_entry.attrs['canSAS_class'] = 'SASdetector' 
    475476                    if det_info.distance is not None: 
    476477                        detector_entry['SDD'] = det_info.distance 
     
    482483            else: 
    483484                detector_entry = instrument_entry.create_group('sasdetector01') 
    484                 detector_entry.attrs['casnSAS_class'] = 'SASdetector' 
     485                detector_entry.attrs['canSAS_class'] = 'SASdetector' 
    485486                detector_entry.attrs['name'] = '' 
    486487 
Note: See TracChangeset for help on using the changeset viewer.