Ignore:
Timestamp:
Feb 6, 2017 4:00:46 PM (7 years ago)
Author:
krzywon
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:
157b716
Parents:
2a2b43a
Message:

Save and load SESANS flag and zacceptance to/from project and analysis files.

File:
1 edited

Legend:

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

    r0639476 rad4632c  
    247247                ## I and Q Data 
    248248                elif tagname == 'I': 
    249                     self.current_dataset.yaxis("Intensity", unit) 
     249                    unit_list = unit.split(" | ") 
     250                    if len(unit_list) > 1: 
     251                        self.current_dataset.yaxis(unit_list[0], unit_list[1]) 
     252                    else: 
     253                        self.current_dataset.yaxis("Intensity", unit) 
    250254                    self.current_dataset.y = np.append(self.current_dataset.y, data_point) 
    251255                elif tagname == 'Idev': 
    252256                    self.current_dataset.dy = np.append(self.current_dataset.dy, data_point) 
    253257                elif tagname == 'Q': 
    254                     self.current_dataset.xaxis("Q", unit) 
     258                    unit_list = unit.split(" | ") 
     259                    if len(unit_list) > 1: 
     260                        self.current_dataset.xaxis(unit_list[0], unit_list[1]) 
     261                    else: 
     262                        self.current_dataset.xaxis("Q", unit) 
    255263                    self.current_dataset.x = np.append(self.current_dataset.x, data_point) 
    256264                elif tagname == 'Qdev': 
     
    264272                elif tagname == 'Shadowfactor': 
    265273                    pass 
     274                elif tagname == 'Sesans': 
     275                    self.current_datainfo.isSesans = bool(data_point) 
     276                elif tagname == 'zacceptance': 
     277                    self.current_datainfo.sample.zacceptance = (data_point, unit) 
    266278 
    267279                ## Sample Information 
     
    919931            node.append(point) 
    920932            self.write_node(point, "Q", datainfo.x[i], 
    921                             {'unit': datainfo.x_unit}) 
     933                            {'unit': datainfo._xaxis + " | " + datainfo._xunit}) 
    922934            if len(datainfo.y) >= i: 
    923935                self.write_node(point, "I", datainfo.y[i], 
    924                                 {'unit': datainfo.y_unit}) 
     936                                {'unit': datainfo._yaxis + " | " + datainfo._yunit}) 
    925937            if datainfo.dy is not None and len(datainfo.dy) > i: 
    926938                self.write_node(point, "Idev", datainfo.dy[i], 
    927                                 {'unit': datainfo.y_unit}) 
     939                                {'unit': datainfo._yaxis + " | " + datainfo._yunit}) 
    928940            if datainfo.dx is not None and len(datainfo.dx) > i: 
    929941                self.write_node(point, "Qdev", datainfo.dx[i], 
    930                                 {'unit': datainfo.x_unit}) 
     942                                {'unit': datainfo._xaxis + " | " + datainfo._xunit}) 
    931943            if datainfo.dxw is not None and len(datainfo.dxw) > i: 
    932944                self.write_node(point, "dQw", datainfo.dxw[i], 
    933                                 {'unit': datainfo.x_unit}) 
     945                                {'unit': datainfo._xaxis + " | " + datainfo._xunit}) 
    934946            if datainfo.dxl is not None and len(datainfo.dxl) > i: 
    935947                self.write_node(point, "dQl", datainfo.dxl[i], 
    936                                 {'unit': datainfo.x_unit}) 
     948                                {'unit': datainfo._xaxis + " | " + datainfo._xunit}) 
     949        if datainfo.isSesans: 
     950            sesans = self.create_element("Sesans") 
     951            sesans.text = str(datainfo.isSesans) 
     952            node.append(sesans) 
     953            self.write_node(node, "zacceptance", datainfo.sample.zacceptance[0], 
     954                             {'unit': datainfo.sample.zacceptance[1]}) 
     955 
    937956 
    938957    def _write_trans_spectrum(self, datainfo, entry_node): 
Note: See TracChangeset for help on using the changeset viewer.