Changeset bec6cb8 in sasview


Ignore:
Timestamp:
Aug 19, 2016 7:21:53 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:
d3e1870
Parents:
a14fa99
Message:

Allow converting 1D data to NXcanSAS as well as CanSAS xml

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/file_converter/converter_panel.py

    r346d56e rbec6cb8  
    239239        """ 
    240240        valid_input = False 
    241         is_bsl = (self.data_type == 'bsl') 
    242         dlg = FrameSelectDialog(n_frames, is_bsl) 
     241        _, ext = os.path.splitext(self.output.GetPath()) 
     242        show_single_btn = (ext == '.h5') 
     243        dlg = FrameSelectDialog(n_frames, show_single_btn) 
    243244        frames = None 
    244245        increment = None 
     
    251252                    last_frame = int(dlg.last_input.GetValue()) 
    252253                    increment = int(dlg.increment_input.GetValue()) 
    253                     if not is_bsl: 
     254                    if not show_single_btn: 
    254255                        single_file = dlg.single_btn.GetValue() 
    255256 
     
    338339                    setattr(datainfo, key, value) 
    339340 
    340         self.convert_to_cansas(frame_data, output_path, single_file) 
     341        _, ext = os.path.splitext(output_path) 
     342        if ext == '.xml': 
     343            self.convert_to_cansas(frame_data, output_path, single_file) 
     344        else: # ext == '.h5' 
     345            w = NXcanSASWriter() 
     346            w.write(frame_data, output_path) 
    341347 
    342348    def on_convert(self, event): 
     
    471477            self.radiation_input.Enable() 
    472478            self.metadata_section.Enable() 
    473             self.output.SetWildcard("CanSAS 1D (*.xml)|*.xml") 
     479            self.output.SetWildcard("CanSAS 1D (*.xml)|*.xml|NXcanSAS HDF5 File (*.h5)|*.h5") 
    474480 
    475481    def radiationtype_changed(self, event): 
     
    560566 
    561567        self.output = FileInput(self, 
    562             wildcard="CanSAS 1D (*.xml)|*.xml") 
     568            wildcard="CanSAS 1D (*.xml)|*.xml|NXcanSAS HDF5 File (*.h5)|*.h5") 
    563569        input_grid.Add(self.output.GetCtrl(), (y,1), (1,1), wx.EXPAND | wx.ALL, 5) 
    564570        y += 1 
Note: See TracChangeset for help on using the changeset viewer.