Changeset dcd534e in sasview


Ignore:
Timestamp:
Dec 5, 2017 6:55:39 AM (6 years ago)
Author:
krzywon
Children:
163c3e0
Parents:
814ee32 (diff), 79c9ce5 (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.
Message:

Merge branch 'master' into sesans_reader

Location:
src/sas
Files:
1 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/file_reader_base_class.py

    r814ee32 rdcd534e  
    2727 
    2828class FileReader(object): 
    29     # List of Data1D and Data2D objects to be sent back to data_loader 
    30     output = [] 
    31     # Current plottable_(1D/2D) object being loaded in 
    32     current_dataset = None 
    33     # Current DataInfo object being loaded in 
    34     current_datainfo = None 
    3529    # String to describe the type of data this reader can load 
    3630    type_name = "ASCII" 
     
    4337    # Able to import the unit converter 
    4438    has_converter = True 
    45     # Open file handle 
    46     f_open = None 
    4739    # Default value of zero 
    4840    _ZERO = 1e-16 
     41 
     42    def __init__(self): 
     43        # List of Data1D and Data2D objects to be sent back to data_loader 
     44        self.output = [] 
     45        # Current plottable_(1D/2D) object being loaded in 
     46        self.current_dataset = None 
     47        # Current DataInfo object being loaded in 
     48        self.current_datainfo = None 
     49        # Open file handle 
     50        self.f_open = None 
    4951 
    5052    def read(self, filepath): 
  • src/sas/sascalc/fit/MultiplicationModel.py

    r574adc7 r0a9cbc3  
    6868        try: 
    6969            multiplicity = p_model.multiplicity 
    70         except: 
     70        except AttributeError: 
    7171            multiplicity = 1 
    7272        ## functional multiplicity of the model 
     
    7676        self.non_fittable = p_model.non_fittable 
    7777        self.multiplicity_info = [] 
    78         self.fun_list = {} 
     78        self.fun_list = [] 
    7979        if self.non_fittable > 1: 
    8080            try: 
     
    8282                self.fun_list = p_model.fun_list 
    8383                self.is_multiplicity_model = True 
    84             except: 
     84            except AttributeError: 
    8585                pass 
    8686        else: 
  • src/sas/sasgui/perspectives/fitting/basepage.py

    r3bd677b reee94bf  
    16431643                        if item_page[2].__class__.__name__ == "ComboBox": 
    16441644                            if item_page_info[2] in self.model.fun_list: 
    1645                                 fun_val = self.model.fun_list[item_page_info[2]] 
     1645                                fun_val = self.model.fun_list.index(item_page_info[2]) 
    16461646                                self.model.setParam(item_page_info[1], fun_val) 
    16471647                    if item_page[3] is not None: 
     
    16871687                selection = value 
    16881688                if value in self.model.fun_list: 
    1689                     selection = self.model.fun_list[value] 
     1689                    selection = self.model.fun_list.index(value) 
    16901690                item_page[2].SetValue(selection) 
    16911691                self.model.setParam(param_name, selection) 
     
    33653365                    if item[2].__class__.__name__ == "ComboBox": 
    33663366                        if content[name][1] in self.model.fun_list: 
    3367                             fun_val = self.model.fun_list[content[name][1]] 
     3367                            fun_val = self.model.fun_list.index(content[name][1]) 
    33683368                            self.model.setParam(name, fun_val) 
    33693369                    try: 
     
    34153415                        if item[2].__class__.__name__ == "ComboBox": 
    34163416                            if value[0] in self.model.fun_list: 
    3417                                 fun_val = self.model.fun_list[value[0]] 
     3417                                fun_val = self.model.fun_list.index(value[0]) 
    34183418                                self.model.setParam(name, fun_val) 
    34193419                                # save state 
  • src/sas/sasgui/perspectives/fitting/fitpage.py

    r3bd677b rbfeb823  
    17261726                and not self.temp_multi_functional: 
    17271727            return None 
    1728         # Get the func name list 
    1729         list = self.model.fun_list 
    1730         if len(list) == 0: 
    1731             return None 
    1732         # build function (combo)box 
    1733         ind = 0 
    1734         while(ind < len(list)): 
    1735             for key, val in list.items(): 
    1736                 if val == ind: 
    1737                     fun_box.Append(key, val) 
    1738                     break 
    1739             ind += 1 
     1728        for index, choice in enumerate(self.model.fun_list): 
     1729            fun_box.Append(choice, index) 
    17401730 
    17411731    def _on_select_accuracy(self, event): 
     
    17651755        value = fun_box.GetValue() 
    17661756        if value in self.model.fun_list: 
    1767             fun_val = self.model.fun_list[value] 
     1757            fun_val = self.model.fun_list.index(value) 
    17681758 
    17691759        self.model.setParam(name, fun_val) 
  • src/sas/sascalc/dataloader/readers/sesans_reader.py

    r849094a r814ee32  
    1212from ..file_reader_base_class import FileReader 
    1313from ..data_info import plottable_1D, DataInfo 
    14 from ..loader_exceptions import FileContentsException, DataReaderException 
     14from ..loader_exceptions import FileContentsException 
    1515 
    1616# Check whether we have a converter available 
     
    1818try: 
    1919    from sas.sascalc.data_util.nxsunit import Converter 
    20 except: 
     20except ImportError: 
    2121    has_converter = False 
    2222_ZERO = 1e-16 
     
    4646        line = self.nextline() 
    4747        params = {} 
    48         while not line.startswith("BEGIN_DATA"): 
     48        while line and not line.startswith("BEGIN_DATA"): 
    4949            terms = line.split() 
    5050            if len(terms) >= 2: 
     
    6363            raise FileContentsException("Wavelength has no units") 
    6464        if params["SpinEchoLength_unit"] != params["Wavelength_unit"]: 
    65             raise FileContentsException("The spin echo data has rudely used " 
    66                                "different units for the spin echo length " 
    67                                "and the wavelength.  While sasview could " 
    68                                "handle this instance, it is a violation " 
    69                                "of the file format and will not be " 
    70                                "handled by other software.") 
     65            raise FileContentsException( 
     66                "The spin echo data has rudely used " 
     67                "different units for the spin echo length " 
     68                "and the wavelength.  While sasview could " 
     69                "handle this instance, it is a violation " 
     70                "of the file format and will not be " 
     71                "handled by other software.") 
    7172 
    7273        headers = self.nextline().split() 
     
    8687 
    8788        if not data.size: 
    88             raise FileContentsException("{} is empty".format(path)) 
     89            raise FileContentsException("{} is empty".format(self.filepath)) 
    8990        x = data[:, headers.index("SpinEchoLength")] 
    9091        if "SpinEchoLength_error" in headers: 
Note: See TracChangeset for help on using the changeset viewer.