Changeset 346d56e in sasview


Ignore:
Timestamp:
Aug 19, 2016 6:43:06 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:
a14fa99
Parents:
995f4eb
Message:

Allow adding metadata to 2d files and ensure it's written correctly

Location:
src/sas
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/file_converter/nxcansas_writer.py

    r9f4d891 r346d56e  
    6262                run_name = data_info.run_name[run_number] 
    6363 
     64        import pdb; pdb.set_trace() 
     65 
    6466        f = h5py.File(filename, 'w') 
    6567        sasentry = f.create_group('sasentry01') 
     
    9092            if getattr(data_info.sample, key) is not None: 
    9193                sample_entry.create_dataset(key, 
    92                     data=np.array([getattr(data_info.sample, key)])) 
     94                    data=_h5_float(getattr(data_info.sample, key))) 
    9395 
    9496        instrument_entry = sasentry.create_group('sasinstrument') 
     
    183185        I = np.reshape(data.data, (n_rows, n_cols)) 
    184186        dI = np.zeros((n_rows, n_cols)) 
    185         # import pdb; pdb.set_trace() 
    186187        if not all(data.err_data == [None]): 
    187188            dI = np.reshape(data.err_data, (n_rows, n_cols)) 
    188189        qx =  np.reshape(data.qx_data, (n_rows, n_cols)) 
    189190        qy = np.reshape(data.qy_data, (n_rows, n_cols)) 
     191 
    190192        I_entry = data_entry.create_dataset('I', data=I) 
    191193        I_entry.attrs['units'] = data.I_unit 
  • src/sas/sasgui/perspectives/file_converter/converter_panel.py

    redf0e06 r346d56e  
    364364                for key, value in metadata.iteritems(): 
    365365                    setattr(dataset[0], key, value) 
     366                if self.run != []: 
     367                    run_number = self.run[0] 
     368                    dataset[0].run_name[run_number] = self.run_name 
    366369 
    367370                w = NXcanSASWriter() 
     
    463466            self.q_input.SetPath("") 
    464467            self.q_input.Disable() 
    465             # self.radiation_input.Disable() 
    466             # self.metadata_section.Collapse() 
    467             # self.on_collapsible_pane(None) 
    468             # self.metadata_section.Disable() 
    469468            self.output.SetWildcard("NXcanSAS HDF5 File (*.h5)|*.h5") 
    470469        else: 
Note: See TracChangeset for help on using the changeset viewer.