Changeset eacc0b0 in sasview
- Timestamp:
- Jul 20, 2017 6:44:05 AM (7 years ago)
- 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 0267d56
- Parents:
- 8bcf866
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/file_converter/converter_panel.py
red9f872 reacc0b0 24 24 from sas.sascalc.file_converter.otoko_loader import OTOKOLoader 25 25 from sas.sascalc.file_converter.bsl_loader import BSLLoader 26 from sas.sascalc.file_converter.ascii2d_loader import ASCII2DLoader 26 27 from sas.sascalc.file_converter.nxcansas_writer import NXcanSASWriter 27 28 from sas.sascalc.dataloader.data_info import Detector … … 352 353 w.write(frame_data, output_path) 353 354 355 def convert_2d_data(self, dataset): 356 metadata = self.get_metadata() 357 for key, value in metadata.iteritems(): 358 setattr(dataset[0], key, value) 359 360 w = NXcanSASWriter() 361 w.write(dataset, self.output.GetPath()) 362 354 363 def on_convert(self, event): 355 364 """Called when the Convert button is clicked""" … … 367 376 qdata, iqdata = self.extract_otoko_data(self.q_input.GetPath()) 368 377 self.convert_1d_data(qdata, iqdata) 378 elif self.data_type == 'ascii2d': 379 loader = ASCII2DLoader(self.iq_input.GetPath()) 380 data = loader.load() 381 dataset = [data] # ASCII 2D only ever contains 1 frame 382 self.convert_2d_data(dataset) 369 383 else: # self.data_type == 'bsl' 370 384 dataset = self.extract_bsl_data(self.iq_input.GetPath()) … … 372 386 # Cancelled by user 373 387 return 374 375 metadata = self.get_metadata() 376 for key, value in metadata.iteritems(): 377 setattr(dataset[0], key, value) 378 379 w = NXcanSASWriter() 380 w.write(dataset, self.output.GetPath()) 388 self.convert_2d_data(dataset) 389 381 390 except Exception as ex: 382 391 msg = str(ex) … … 399 408 def validate_inputs(self): 400 409 msg = "You must select a" 401 if self.q_input.GetPath() == '' and self.data_type != 'bsl': 410 if self.q_input.GetPath() == '' and self.data_type != 'bsl' \ 411 and self.data_type != 'ascii2d': 402 412 msg += " Q Axis input file." 403 413 elif self.iq_input.GetPath() == '': … … 472 482 dtype = event.GetEventObject().GetName() 473 483 self.data_type = dtype 474 if dtype == 'bsl' :484 if dtype == 'bsl' or dtype == 'ascii2d': 475 485 self.q_input.SetPath("") 476 486 self.q_input.Disable() … … 526 536 wx.ALIGN_CENTER_VERTICAL, 5) 527 537 radio_sizer = wx.BoxSizer(wx.HORIZONTAL) 528 ascii_btn = wx.RadioButton(self, -1, "ASCII ", name="ascii",538 ascii_btn = wx.RadioButton(self, -1, "ASCII 1D", name="ascii", 529 539 style=wx.RB_GROUP) 530 540 ascii_btn.Bind(wx.EVT_RADIOBUTTON, self.datatype_changed) 531 541 radio_sizer.Add(ascii_btn) 542 ascii2d_btn = wx.RadioButton(self, -1, "ASCII 2D", name="ascii2d") 543 ascii2d_btn.Bind(wx.EVT_RADIOBUTTON, self.datatype_changed) 544 radio_sizer.Add(ascii2d_btn) 532 545 otoko_btn = wx.RadioButton(self, -1, "BSL 1D", name="otoko") 533 546 otoko_btn.Bind(wx.EVT_RADIOBUTTON, self.datatype_changed) 534 547 radio_sizer.Add(otoko_btn) 535 input_grid.Add(radio_sizer, (y,1), (1,1), wx.ALL, 5)536 548 bsl_btn = wx.RadioButton(self, -1, "BSL 2D", name="bsl") 537 549 bsl_btn.Bind(wx.EVT_RADIOBUTTON, self.datatype_changed) 538 550 radio_sizer.Add(bsl_btn) 551 input_grid.Add(radio_sizer, (y,1), (1,1), wx.ALL, 5) 539 552 y += 1 540 553 … … 549 562 y += 1 550 563 551 iq_label = wx.StaticText(self, -1, "Intensity -AxisData: ")564 iq_label = wx.StaticText(self, -1, "Intensity Data: ") 552 565 input_grid.Add(iq_label, (y,0), (1,1), wx.ALIGN_CENTER_VERTICAL, 5) 553 566
Note: See TracChangeset
for help on using the changeset viewer.