Changeset 4ec7089 in sasview


Ignore:
Timestamp:
Nov 9, 2016 6:57:37 AM (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:
64c7f39
Parents:
3d8c49a (diff), 61a2a0c (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 ticket-795

Files:
1 added
7 edited

Legend:

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

    r7d94915 rd2471870  
    172172                input_f.close() 
    173173                if not is_data: 
    174                     return None 
     174                    msg = "ascii_reader: x has no data" 
     175                    raise RuntimeError, msg 
    175176                # Sanity check 
    176177                if has_error_dy == True and not len(ty) == len(tdy): 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py

    r245ae18 r29e872e  
    6565        # context menu 
    6666        self._slicerpop = None 
    67  
    6867        self._available_data = [] 
    6968        self._symbol_labels = self.get_symbol_label() 
     
    732731                self.subplot.set_ylim(y_range) 
    733732                self.subplot.figure.canvas.draw_idle() 
     733                self.is_zoomed = True 
    734734        d.Destroy() 
    735735 
  • src/sas/sasgui/perspectives/calculator/model_editor.py

    rcf1910f ra08b89b  
    632632        self.reader = None 
    633633        self.name = 'untitled' 
    634         self.overwrite_name = True 
     634        self.overwrite_name = False 
    635635        self.is_2d = False 
    636636        self.fname = None 
     
    684684        name_txt = wx.StaticText(self, -1, 'Function Name : ') 
    685685        overwrite_cb = wx.CheckBox(self, -1, "Overwrite existing plugin model of this name?", (10, 10)) 
    686         overwrite_cb.SetValue(True) 
     686        overwrite_cb.SetValue(False) 
    687687        overwrite_cb.SetToolTipString("Overwrite it if already exists?") 
    688688        wx.EVT_CHECKBOX(self, overwrite_cb.GetId(), self.on_over_cb) 
    689         #overwrite_cb.Show(False) 
    690689        self.name_tcl = wx.TextCtrl(self, -1, size=(PANEL_WIDTH * 3 / 5, -1)) 
    691690        self.name_tcl.Bind(wx.EVT_TEXT_ENTER, self.on_change_name) 
    692         self.name_tcl.SetValue('MyFunction') 
     691        self.name_tcl.SetValue('') 
    693692        self.name_tcl.SetFont(self.font) 
    694693        hint_name = "Unique Model Function Name." 
     
    947946        # First check for valid python name then if the name already exists 
    948947        if not name or not bool(re.match('^[A-Za-z0-9_]*$', name)): 
    949             msg = "is not a valid python name. Name must not be empty and \n" 
     948            msg = '"%s" '%name 
     949            msg += "is not a valid model name. Name must not be empty and \n" 
    950950            msg += "may include only alpha numeric or underline characters \n" 
    951951            msg += "and no spaces" 
     
    11521152 
    11531153        _TreeLocation = "user/sasgui/perspectives/fitting/fitting_help.html" 
    1154         _PageAnchor = "#New_Plugin_Model" 
     1154        _PageAnchor = "#new-plugin-model" 
    11551155        _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, _PageAnchor, 
    11561156                                          "Plugin Model Editor Help") 
  • src/sas/sasgui/plottools/PlotPanel.py

    r1a8e2e8e r198fa76  
    452452        """ 
    453453        self.cusor_line(event) 
    454         if self.gotLegend == 1: 
     454        if self.gotLegend == 1 and self.leftdown: 
    455455            self._on_legend_motion(event) 
    456456            return 
  • src/sas/sasgui/plottools/plottables.py

    r8abd96d r80f4684  
    212212                self.color += plottable.colors() 
    213213                self.plottables[plottable] = self.color 
     214                plottable.custom_color = self.color 
    214215 
    215216    def changed(self): 
  • src/sas/sasgui/perspectives/fitting/basepage.py

    rc8e1996 r3d8c49a  
    11571157            category_pos = int(state.categorycombobox) 
    11581158        except: 
    1159             state.formfactorcombobox = state.formfactorcombobox.lower() 
    1160             state.formfactorcombobox = \ 
    1161                 state.formfactorcombobox.replace('model', '') 
    1162             state.formfactorcombobox = unicode(state.formfactorcombobox) 
     1159            if state.formfactorcombobox is not None: 
     1160                state._convert_to_sasmodels() 
    11631161            state.categorycombobox = unicode(state.categorycombobox) 
    11641162            if state.categorycombobox in self.categorybox.Items: 
     
    15281526                        index_data = ((self.qmin_x <= self.data.x) & 
    15291527                                      (self.data.x <= self.qmax_x)) 
    1530                         val = str(len(self.data.x[index_data is True])) 
     1528                        val = str(len([index_data is True])) 
    15311529                        self.Npts_fit.SetValue(val) 
    15321530                    else: 
  • src/sas/sasgui/perspectives/fitting/pagestate.py

    rc8e1996 r3d8c49a  
    355355            obj.saved_states[copy_name] = copy_state 
    356356        return obj 
     357 
     358    def _convert_to_sasmodels(self): 
     359        """ 
     360        Convert parameters to a form usable by sasmodels converter 
     361 
     362        :return: None 
     363        """ 
     364        from sasmodels import convert 
     365        # Create conversion dictionary to send to sasmodels 
     366        p = dict() 
     367        for fittable, name, value, _, uncert, lower, upper, units in \ 
     368                self.parameters: 
     369            if not value: 
     370                value = numpy.nan 
     371            if not uncert or uncert[1] == '': 
     372                uncert[0] = False 
     373                uncert[1] = numpy.nan 
     374            if not upper or upper[1] == '': 
     375                upper[0] = False 
     376                upper[1] = numpy.nan 
     377            if not lower or lower[1] == '': 
     378                lower[0] = False 
     379                lower[1] = numpy.nan 
     380            p[name] = { 
     381                "fittable" : bool(fittable), 
     382                "value" : float(value), 
     383                "std" : float(uncert[1]), 
     384                "upper" : float(upper[1]), 
     385                "lower" : float(lower[1]), 
     386                "units" : units, 
     387            } 
     388        name, params = convert.convert_model(self.formfactorcombobox, p) 
     389 
     390        # Only convert if old != new, otherwise all the same 
     391        if name != self.formfactorcombobox: 
     392            self.formfactorcombobox = name 
     393            self.parameters = [] 
     394            for name, info in params.iteritems(): 
     395                if info.get("std") is not numpy.nan: 
     396                    std = ['True', str(info.get("std"))] 
     397                else: 
     398                    std = ['False', ''] 
     399                if info.get("lower") is not numpy.nan: 
     400                    lower = ['True', str(info.get("lower"))] 
     401                else: 
     402                    lower = ['False', ''] 
     403                if info.get("upper") is not numpy.nan: 
     404                    upper = ['True', str(info.get("upper"))] 
     405                else: 
     406                    upper = ['False', ''] 
     407                param_list = [info.get("fittable"), name, info.get("value"), 
     408                              "+/-", std, lower, upper] 
     409                self.parameters.append(param_list) 
     410 
    357411 
    358412    def _repr_helper(self, list, rep): 
Note: See TracChangeset for help on using the changeset viewer.