Changeset 2ab812d in sasview


Ignore:
Timestamp:
Apr 9, 2017 3:41:56 AM (7 years ago)
Author:
GitHub <noreply@…>
Parents:
527a190 (diff), ed28d8c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Adam Washington <rprospero@…> (04/09/17 03:41:56)
git-committer:
GitHub <noreply@…> (04/09/17 03:41:56)
Message:

Merge ed28d8c9231b1ae5a84bb9caaf5d8794509e6500 into 527a1907e8dcf230cf6e6cdc74ed054c69493d0a

Location:
src/sas
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/fitpage.py

    rd85f1d8a r6ad9c1a  
    12391239            mod_cat = self.categorybox.GetStringSelection() 
    12401240            if mod_cat == custom_model: 
     1241                temp_id = self.model.id 
    12411242                temp = self.parent.update_model_list() 
     1243                for v in self.parent.model_dictionary.values(): 
     1244                    if v.id == temp_id: 
     1245                        self.model = v() 
    12421246                if temp: 
    12431247                    self.model_list_box = temp 
  • src/sas/sasgui/perspectives/fitting/models.py

    r11b094f red28d8c  
    319319        """ 
    320320        new_plugins = self.findModels() 
    321         if len(new_plugins) > 0: 
    322             for name, plug in  new_plugins.iteritems(): 
    323                 if name not in self.stored_plugins.keys(): 
    324                     self.stored_plugins[name] = plug 
    325                     self.plugins.append(plug) 
    326                     self.model_dictionary[name] = plug 
     321        if new_plugins: 
     322            for name, plug in  new_plugins.items(): 
     323                self.stored_plugins[name] = plug 
     324                self.plugins.append(plug) 
     325                self.model_dictionary[name] = plug 
    327326            self.model_combobox.set_list("Plugin Models", self.plugins) 
    328327            return self.model_combobox.get_list() 
  • src/sas/sascalc/dataloader/readers/cansas_reader.py

    r8434365 r527a190  
    156156                    # If the file does not match the schema, raise this error 
    157157                    invalid_xml = self.find_invalid_xml() 
    158                     invalid_xml = INVALID_XML.format(basename + extension) + invalid_xml 
    159                     self.errors.add(invalid_xml) 
     158                    if invalid_xml != "": 
     159                        invalid_xml = INVALID_XML.format(basename + extension) + invalid_xml 
     160                        self.errors.add(invalid_xml) 
    160161                    # Try again with an invalid CanSAS schema, that requires only a data set in each 
    161162                    base_name = xml_reader.__file__ 
     
    261262                # I and Q - 1D data 
    262263                elif tagname == 'I' and isinstance(self.current_dataset, plottable_1D): 
    263                     unit_list = unit.split("|") 
    264                     if len(unit_list) > 1: 
    265                         self.current_dataset.yaxis(unit_list[0].strip(), 
    266                                                    unit_list[1].strip()) 
    267                     else: 
    268                         self.current_dataset.yaxis("Intensity", unit) 
     264                    self.current_dataset.yaxis("Intensity", unit) 
    269265                    self.current_dataset.y = np.append(self.current_dataset.y, data_point) 
    270266                elif tagname == 'Idev' and isinstance(self.current_dataset, plottable_1D): 
    271267                    self.current_dataset.dy = np.append(self.current_dataset.dy, data_point) 
    272268                elif tagname == 'Q': 
    273                     unit_list = unit.split("|") 
    274                     if len(unit_list) > 1: 
    275                         self.current_dataset.xaxis(unit_list[0].strip(), 
    276                                                    unit_list[1].strip()) 
    277                     else: 
    278                         self.current_dataset.xaxis("Q", unit) 
     269                    self.current_dataset.xaxis("Q", unit) 
    279270                    self.current_dataset.x = np.append(self.current_dataset.x, data_point) 
    280271                elif tagname == 'Qdev': 
     
    290281                elif tagname == 'Sesans': 
    291282                    self.current_datainfo.isSesans = bool(data_point) 
     283                    self.current_dataset.xaxis(attr.get('x_axis'), 
     284                                                attr.get('x_unit')) 
     285                    self.current_dataset.yaxis(attr.get('y_axis'), 
     286                                                attr.get('y_unit')) 
    292287                elif tagname == 'zacceptance': 
    293288                    self.current_datainfo.sample.zacceptance = (data_point, unit) 
     
    781776                    value_unit = local_unit 
    782777            except KeyError: 
    783                 err_msg = "CanSAS reader: unexpected " 
    784                 err_msg += "\"{0}\" unit [{1}]; " 
    785                 err_msg = err_msg.format(tagname, local_unit) 
    786                 err_msg += "expecting [{0}]".format(default_unit) 
     778                # Do not throw an error for loading Sesans data in cansas xml 
     779                # This is a temporary fix. 
     780                if local_unit != "A" and local_unit != 'pol': 
     781                    err_msg = "CanSAS reader: unexpected " 
     782                    err_msg += "\"{0}\" unit [{1}]; " 
     783                    err_msg = err_msg.format(tagname, local_unit) 
     784                    err_msg += "expecting [{0}]".format(default_unit) 
    787785                value_unit = local_unit 
    788786            except: 
     
    10351033            node.append(point) 
    10361034            self.write_node(point, "Q", datainfo.x[i], 
    1037                             {'unit': datainfo._xaxis + " | " + datainfo._xunit}) 
     1035                            {'unit': datainfo.x_unit}) 
    10381036            if len(datainfo.y) >= i: 
    10391037                self.write_node(point, "I", datainfo.y[i], 
    1040                                 {'unit': datainfo._yaxis + " | " + datainfo._yunit}) 
     1038                                {'unit': datainfo.y_unit}) 
    10411039            if datainfo.dy is not None and len(datainfo.dy) > i: 
    10421040                self.write_node(point, "Idev", datainfo.dy[i], 
    1043                                 {'unit': datainfo._yaxis + " | " + datainfo._yunit}) 
     1041                                {'unit': datainfo.y_unit}) 
    10441042            if datainfo.dx is not None and len(datainfo.dx) > i: 
    10451043                self.write_node(point, "Qdev", datainfo.dx[i], 
    1046                                 {'unit': datainfo._xaxis + " | " + datainfo._xunit}) 
     1044                                {'unit': datainfo.x_unit}) 
    10471045            if datainfo.dxw is not None and len(datainfo.dxw) > i: 
    10481046                self.write_node(point, "dQw", datainfo.dxw[i], 
    1049                                 {'unit': datainfo._xaxis + " | " + datainfo._xunit}) 
     1047                                {'unit': datainfo.x_unit}) 
    10501048            if datainfo.dxl is not None and len(datainfo.dxl) > i: 
    10511049                self.write_node(point, "dQl", datainfo.dxl[i], 
    1052                                 {'unit': datainfo._xaxis + " | " + datainfo._xunit}) 
     1050                                {'unit': datainfo.x_unit}) 
    10531051        if datainfo.isSesans: 
    1054             sesans = self.create_element("Sesans") 
     1052            sesans_attrib = {'x_axis': datainfo._xaxis, 
     1053                             'y_axis': datainfo._yaxis, 
     1054                             'x_unit': datainfo.x_unit, 
     1055                             'y_unit': datainfo.y_unit} 
     1056            sesans = self.create_element("Sesans", attrib=sesans_attrib) 
    10551057            sesans.text = str(datainfo.isSesans) 
    1056             node.append(sesans) 
    1057             self.write_node(node, "zacceptance", datainfo.sample.zacceptance[0], 
     1058            entry_node.append(sesans) 
     1059            self.write_node(entry_node, "zacceptance", datainfo.sample.zacceptance[0], 
    10581060                             {'unit': datainfo.sample.zacceptance[1]}) 
    10591061 
  • src/sas/sascalc/dataloader/readers/xml_reader.py

    ra235f715 r527a190  
    128128            first_error = schema.assertValid(self.xmldoc) 
    129129        except etree.DocumentInvalid as err: 
     130            # Suppress errors for <'any'> elements 
     131            if "##other" in str(err): 
     132                return first_error 
    130133            first_error = str(err) 
    131134        return first_error 
Note: See TracChangeset for help on using the changeset viewer.