Changeset 444a657 in sasview for src


Ignore:
Timestamp:
Jun 9, 2017 1:13:46 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
7b15990
Parents:
47d93073 (diff), 8cec26b (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 batch_slicer

Location:
src/sas
Files:
1 added
1 deleted
6 edited
1 moved

Legend:

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

    ra1b8fee ra534432  
    17341734            @param unsmeared_error: data error, rescaled to unsmeared model 
    17351735        """ 
    1736         try: 
    1737             np.nan_to_num(y) 
    1738             new_plot = self.create_theory_1D(x, y, page_id, model, data, state, 
    1739                                              data_description=model.name, 
    1740                                              data_id=str(page_id) + " " + data.name) 
    1741             if unsmeared_model is not None: 
    1742                 self.create_theory_1D(x, unsmeared_model, page_id, model, data, state, 
    1743                                       data_description=model.name + " unsmeared", 
    1744                                       data_id=str(page_id) + " " + data.name + " unsmeared") 
    1745  
    1746                 if unsmeared_data is not None and unsmeared_error is not None: 
    1747                     self.create_theory_1D(x, unsmeared_data, page_id, model, data, state, 
    1748                                           data_description="Data unsmeared", 
    1749                                           data_id="Data  " + data.name + " unsmeared", 
    1750                                           dy=unsmeared_error) 
    1751             # Comment this out until we can get P*S models with correctly populated parameters 
    1752             #if sq_model is not None and pq_model is not None: 
    1753             #    self.create_theory_1D(x, sq_model, page_id, model, data, state, 
    1754             #                          data_description=model.name + " S(q)", 
    1755             #                          data_id=str(page_id) + " " + data.name + " S(q)") 
    1756             #    self.create_theory_1D(x, pq_model, page_id, model, data, state, 
    1757             #                          data_description=model.name + " P(q)", 
    1758             #                          data_id=str(page_id) + " " + data.name + " P(q)") 
    1759  
    1760             current_pg = self.fit_panel.get_page_by_id(page_id) 
    1761             title = new_plot.title 
    1762             batch_on = self.fit_panel.get_page_by_id(page_id).batch_on 
    1763             if not batch_on: 
    1764                 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, 
    1765                                             title=str(title))) 
    1766             elif plot_result: 
    1767                 top_data_id = self.fit_panel.get_page_by_id(page_id).data.id 
    1768                 if data.id == top_data_id: 
    1769                     wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, 
    1770                                             title=str(title))) 
    1771             caption = current_pg.window_caption 
    1772             self.page_finder[page_id].set_fit_tab_caption(caption=caption) 
    1773  
    1774             self.page_finder[page_id].set_theory_data(data=new_plot, 
     1736             
     1737        number_finite = np.count_nonzero(np.isfinite(y))  
     1738        np.nan_to_num(y) 
     1739        new_plot = self.create_theory_1D(x, y, page_id, model, data, state, 
     1740                                         data_description=model.name, 
     1741                                         data_id=str(page_id) + " " + data.name) 
     1742        if unsmeared_model is not None: 
     1743            self.create_theory_1D(x, unsmeared_model, page_id, model, data, state, 
     1744                                  data_description=model.name + " unsmeared", 
     1745                                  data_id=str(page_id) + " " + data.name + " unsmeared") 
     1746 
     1747            if unsmeared_data is not None and unsmeared_error is not None: 
     1748                self.create_theory_1D(x, unsmeared_data, page_id, model, data, state, 
     1749                                      data_description="Data unsmeared", 
     1750                                      data_id="Data  " + data.name + " unsmeared", 
     1751                                      dy=unsmeared_error) 
     1752        # Comment this out until we can get P*S models with correctly populated parameters 
     1753        #if sq_model is not None and pq_model is not None: 
     1754        #    self.create_theory_1D(x, sq_model, page_id, model, data, state, 
     1755        #                          data_description=model.name + " S(q)", 
     1756        #                          data_id=str(page_id) + " " + data.name + " S(q)") 
     1757        #    self.create_theory_1D(x, pq_model, page_id, model, data, state, 
     1758        #                          data_description=model.name + " P(q)", 
     1759        #                          data_id=str(page_id) + " " + data.name + " P(q)") 
     1760 
     1761        current_pg = self.fit_panel.get_page_by_id(page_id) 
     1762        title = new_plot.title 
     1763        batch_on = self.fit_panel.get_page_by_id(page_id).batch_on 
     1764        if not batch_on: 
     1765            wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title=str(title))) 
     1766        elif plot_result: 
     1767            top_data_id = self.fit_panel.get_page_by_id(page_id).data.id 
     1768            if data.id == top_data_id: 
     1769                wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title=str(title))) 
     1770        caption = current_pg.window_caption 
     1771        self.page_finder[page_id].set_fit_tab_caption(caption=caption) 
     1772 
     1773        self.page_finder[page_id].set_theory_data(data=new_plot, 
    17751774                                                      fid=data.id) 
    1776             if toggle_mode_on: 
    1777                 wx.PostEvent(self.parent, 
    1778                              NewPlotEvent(group_id=str(page_id) + " Model2D", 
     1775        if toggle_mode_on: 
     1776            wx.PostEvent(self.parent, 
     1777                         NewPlotEvent(group_id=str(page_id) + " Model2D", 
    17791778                                          action="Hide")) 
    1780             else: 
    1781                 if update_chisqr: 
    1782                     wx.PostEvent(current_pg, 
    1783                                  Chi2UpdateEvent(output=self._cal_chisqr( 
     1779        else: 
     1780            if update_chisqr: 
     1781                wx.PostEvent(current_pg, 
     1782                             Chi2UpdateEvent(output=self._cal_chisqr( 
    17841783                                                                data=data, 
    17851784                                                                fid=fid, 
    17861785                                                                weight=weight, 
    1787                                                             page_id=page_id, 
    1788                                                             index=index))) 
    1789                 else: 
    1790                     self._plot_residuals(page_id=page_id, data=data, fid=fid, 
    1791                                          index=index, weight=weight) 
    1792  
     1786                                                                page_id=page_id, 
     1787                                                                index=index))) 
     1788            else: 
     1789                self._plot_residuals(page_id=page_id, data=data, fid=fid, 
     1790                                     index=index, weight=weight) 
     1791 
     1792        if not number_finite: 
     1793            logger.error("Using the present parameters the model does not return any finite value. ") 
     1794            msg = "Computing Error: Model did not return any finite value." 
     1795            wx.PostEvent(self.parent, StatusEvent(status = msg, info="error")) 
     1796        else:                  
    17931797            msg = "Computation  completed!" 
     1798            if number_finite != y.size: 
     1799                msg += ' PROBLEM: For some Q values the model returns non finite intensities!' 
     1800                logger.error("For some Q values the model returns non finite intensities.") 
    17941801            wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop")) 
    1795         except: 
    1796             raise 
    17971802 
    17981803    def _calc_exception(self, etype, value, tb): 
     
    18191824        that can be plot. 
    18201825        """ 
     1826        number_finite = np.count_nonzero(np.isfinite(image))  
    18211827        np.nan_to_num(image) 
    18221828        new_plot = Data2D(image=image, err_image=data.err_data) 
     
    18771883                self._plot_residuals(page_id=page_id, data=data, fid=fid, 
    18781884                                      index=index, weight=weight) 
    1879         msg = "Computation  completed!" 
    1880         wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop")) 
     1885 
     1886        if not number_finite: 
     1887            logger.error("Using the present parameters the model does not return any finite value. ") 
     1888            msg = "Computing Error: Model did not return any finite value." 
     1889            wx.PostEvent(self.parent, StatusEvent(status = msg, info="error")) 
     1890        else: 
     1891            msg = "Computation  completed!" 
     1892            if number_finite != image.size: 
     1893                msg += ' PROBLEM: For some Qx,Qy values the model returns non finite intensities!' 
     1894                logger.error("For some Qx,Qy values the model returns non finite intensities.") 
     1895            wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop")) 
    18811896 
    18821897    def _draw_model2D(self, model, page_id, qmin, 
  • src/sas/sasgui/perspectives/fitting/models.py

    r81b1f4d r8cec26b  
    156156    try: 
    157157        import compileall 
    158         compileall.compile_dir(dir=dir, ddir=dir, force=1, 
     158        compileall.compile_dir(dir=dir, ddir=dir, force=0, 
    159159                               quiet=report_problem) 
    160160    except: 
  • src/sas/sascalc/dataloader/manipulations.py

    r46cd1c3 r324e0bf  
    199199    z_max = max(data2D.q_data) 
    200200    z_min = min(data2D.q_data) 
    201     x_max = data2D.dqx_data[data2D.q_data[z_max]] 
    202     x_min = data2D.dqx_data[data2D.q_data[z_min]] 
    203     y_max = data2D.dqy_data[data2D.q_data[z_max]] 
    204     y_min = data2D.dqy_data[data2D.q_data[z_min]] 
     201    dqx_at_z_max = data2D.dqx_data[np.argmax(data2D.q_data)] 
     202    dqx_at_z_min = data2D.dqx_data[np.argmin(data2D.q_data)] 
     203    dqy_at_z_max = data2D.dqy_data[np.argmax(data2D.q_data)] 
     204    dqy_at_z_min = data2D.dqy_data[np.argmin(data2D.q_data)] 
    205205    # Find qdx at q = 0 
    206     dq_overlap_x = (x_min * z_max - x_max * z_min) / (z_max - z_min) 
     206    dq_overlap_x = (dqx_at_z_min * z_max - dqx_at_z_max * z_min) / (z_max - z_min) 
    207207    # when extrapolation goes wrong 
    208208    if dq_overlap_x > min(data2D.dqx_data): 
     
    210210    dq_overlap_x *= dq_overlap_x 
    211211    # Find qdx at q = 0 
    212     dq_overlap_y = (y_min * z_max - y_max * z_min) / (z_max - z_min) 
     212    dq_overlap_y = (dqy_at_z_min * z_max - dqy_at_z_max * z_min) / (z_max - z_min) 
    213213    # when extrapolation goes wrong 
    214214    if dq_overlap_y > min(data2D.dqy_data): 
     
    220220    # Final protection of dq 
    221221    if dq_overlap < 0: 
    222         dq_overlap = y_min 
     222        dq_overlap = dqy_at_z_min 
    223223    dqx_data = data2D.dqx_data[np.isfinite(data2D.data)] 
    224224    dqy_data = data2D.dqy_data[np.isfinite( 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter2D.py

    r7432acb r3e5648b  
    361361                if self.slicer.__class__.__name__ != "BoxSum": 
    362362                    wx_id = ids.next() 
    363                     slicerpop.Append(wx_id, '&Edit Slicer Parameters') 
     363                    name = '&Edit Slicer Parameters and Batch Slicing' 
     364                    slicerpop.Append(wx_id, name) 
    364365                    wx.EVT_MENU(self, wx_id, self._onEditSlicer) 
    365366            slicerpop.AppendSeparator() 
     
    532533 
    533534        """ 
    534         ## Clear current slicer 
     535        # Clear current slicer 
    535536        if self.slicer is not None: 
    536537            self.slicer.clear() 
    537         ## Create a new slicer 
     538        # Create a new slicer 
    538539        self.slicer_z += 1 
    539540        self.slicer = slicer(self, self.subplot, zorder=self.slicer_z) 
    540541        self.subplot.set_ylim(self.data2D.ymin, self.data2D.ymax) 
    541542        self.subplot.set_xlim(self.data2D.xmin, self.data2D.xmax) 
    542         ## Draw slicer 
     543        # Draw slicer 
    543544        self.update() 
    544545        self.slicer.update() 
     
    572573        npt = math.floor(npt) 
    573574        from sas.sascalc.dataloader.manipulations import CircularAverage 
    574         ## compute the maximum radius of data2D 
     575        # compute the maximum radius of data2D 
    575576        self.qmax = max(math.fabs(self.data2D.xmax), 
    576577                        math.fabs(self.data2D.xmin)) 
     
    578579                        math.fabs(self.data2D.ymin)) 
    579580        self.radius = math.sqrt(math.pow(self.qmax, 2) + math.pow(self.ymax, 2)) 
    580         ##Compute beam width 
     581        # Compute beam width 
    581582        bin_width = (self.qmax + self.qmax) / npt 
    582         ## Create data1D circular average of data2D 
     583        # Create data1D circular average of data2D 
    583584        Circle = CircularAverage(r_min=0, r_max=self.radius, 
    584585                                 bin_width=bin_width) 
     
    599600        new_plot.name = "Circ avg " + self.data2D.name 
    600601        new_plot.source = self.data2D.source 
    601         #new_plot.info = self.data2D.info 
     602        # new_plot.info = self.data2D.info 
    602603        new_plot.interactive = True 
    603604        new_plot.detector = self.data2D.detector 
    604605 
    605         ## If the data file does not tell us what the axes are, just assume... 
     606        # If the data file does not tell us what the axes are, just assume... 
    606607        new_plot.xaxis("\\rm{Q}", "A^{-1}") 
    607608        if hasattr(self.data2D, "scale") and \ 
     
    615616        new_plot.id = "Circ avg " + self.data2D.name 
    616617        new_plot.is_data = True 
    617         self.parent.update_theory(data_id=self.data2D.id, \ 
    618                                        theory=new_plot) 
     618        self.parent.update_theory(data_id=self.data2D.id, theory=new_plot) 
    619619        wx.PostEvent(self.parent, 
    620620                     NewPlotEvent(plot=new_plot, title=new_plot.name)) 
     
    630630        """ 
    631631        if self.slicer is not None: 
    632             from SlicerParameters import SlicerParameterPanel 
     632            from parameters_panel_slicer import SlicerParameterPanel 
    633633            dialog = SlicerParameterPanel(self, -1, "Slicer Parameters") 
    634634            dialog.set_slicer(self.slicer.__class__.__name__, 
     
    668668        params = self.slicer.get_params() 
    669669        ## Create a new panel to display results of summation of Data2D 
    670         from slicerpanel import SlicerPanel 
     670        from parameters_panel_boxsum import SlicerPanel 
    671671        win = MDIFrame(self.parent, None, 'None', (100, 200)) 
    672672        new_panel = SlicerPanel(parent=win, id=-1, 
     
    758758        if default_name.count('.') > 0: 
    759759            default_name = default_name.split('.')[0] 
    760         #default_name += "_out" 
    761760        if self.parent is not None: 
    762761            self.parent.show_data2d(data, default_name) 
    763762 
    764763    def modifyGraphAppearance(self, e): 
    765         self.graphApp = graphAppearance(self, 'Modify graph appearance', legend=False) 
     764        self.graphApp = graphAppearance(self, 'Modify graph appearance', 
     765                                        legend=False) 
    766766        self.graphApp.setDefaults(self.grid_on, self.legend_on, 
    767767                                  self.xaxis_label, self.yaxis_label, 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/SectorSlicer.py

    r7432acb r8de66b6  
    3737        ## Absolute value of the Angle between the middle line and any side line 
    3838        self.phi = math.pi / 12 
     39        # Binning base for log/lin binning 
     40        self.bin_base = 0 
    3941        ## Middle line 
    4042        self.main_line = LineInteractor(self, self.base.subplot, color='blue', 
     
    151153        phimin = -self.left_line.phi + self.main_line.theta 
    152154        phimax = self.left_line.phi + self.main_line.theta 
     155        bin_base = self.bin_base 
    153156        if nbins is None: 
    154157            nbins = 20 
    155158        sect = SectorQ(r_min=0.0, r_max=radius, 
    156159                       phi_min=phimin + math.pi, 
    157                        phi_max=phimax + math.pi, nbins=nbins) 
     160                       phi_max=phimax + math.pi, nbins=nbins, base=bin_base) 
    158161 
    159162        sector = sect(self.base.data2D) 
     
    239242        params["Delta_Phi [deg]"] = math.fabs(self.left_line.phi * 180 / math.pi) 
    240243        params["nbins"] = self.nbins 
     244        params["binning base"] = self.bin_base 
    241245        return params 
    242246 
     
    252256        phi = math.fabs(params["Delta_Phi [deg]"] * math.pi / 180) 
    253257        self.nbins = int(params["nbins"]) 
     258        self.bin_base = params["binning base"] 
    254259        self.main_line.theta = main 
    255260        ## Reset the slicer parameters 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_boxsum.py

    r7432acb r37d461c  
    11import wx 
    22import wx.lib.newevent 
    3 #from copy import deepcopy 
     3from parameters_panel_slicer import SlicerParameterPanel 
    44from sas.sasgui.guiframe.utils import format_number 
    5 from sas.sasgui.guiframe.events import SlicerParameterEvent 
    6 from sas.sasgui.guiframe.events import EVT_SLICER_PARS 
    7 from sas.sasgui.guiframe.events import EVT_SLICER 
     5from sas.sasgui.guiframe.panel_base import PanelBase 
     6from sas.sasgui.guiframe.events import (SlicerParameterEvent, EVT_SLICER_PARS, 
     7                                        EVT_SLICER) 
    88 
    9 from sas.sasgui.guiframe.panel_base import PanelBase 
    109 
    1110class SlicerPanel(wx.Panel, PanelBase): 
     
    1312    Panel class to show the slicer parameters 
    1413    """ 
    15     #TODO: show units 
    16     #TODO: order parameters properly 
    17     ## Internal name for the AUI manager 
     14    # Internal name for the AUI manager 
    1815    window_name = "Slicer panel" 
    19     ## Title to appear on top of the window 
     16    # Title to appear on top of the window 
    2017    window_caption = "Slicer Panel" 
    2118    CENTER_PANE = False 
     
    2522        wx.Panel.__init__(self, parent, id, *args, **kwargs) 
    2623        PanelBase.__init__(self) 
    27         ## Initialization of the class 
     24        # Initialization of the class 
    2825        self.base = base 
    2926        if params is None: 
     
    4441        else: 
    4542            self.set_slicer(type, params) 
    46         ## Bindings 
    47         self.parent.Bind(EVT_SLICER, self.onEVT_SLICER) 
    48         self.parent.Bind(EVT_SLICER_PARS, self.onParamChange) 
    49  
    50     def onEVT_SLICER(self, event): 
    51         """ 
    52         Process EVT_SLICER events 
    53         When the slicer changes, update the panel 
    54  
    55         :param event: EVT_SLICER event 
    56  
    57         """ 
    58         event.Skip() 
    59         if event.obj_class is None: 
    60             self.set_slicer(None, None) 
    61         else: 
    62             self.set_slicer(event.type, event.params) 
     43        # Bindings 
     44        self.parent.Bind(EVT_SLICER, SlicerParameterPanel.on_evt_slicer) 
     45        self.parent.Bind(EVT_SLICER_PARS, SlicerParameterPanel.on_param_change) 
    6346 
    6447    def set_slicer(self, type, params): 
     
    8467            keys.sort() 
    8568            for item in keys: 
    86                 if not item.lower() in ["num_points", "avg", "avg_error", "sum", "sum_error"]: 
     69                if not item.lower() in ["num_points", "avg", "avg_error", "sum", 
     70                                        "sum_error"]: 
    8771                    n += 1 
    8872                    text = wx.StaticText(self, -1, item, style=wx.ALIGN_LEFT) 
    8973                    self.bck.Add(text, (n - 1, 0), 
    90                                  flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=15) 
     74                                 flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 
     75                                 border=15) 
    9176                    ctl = wx.TextCtrl(self, -1, size=(80, 20), 
    9277                                      style=wx.TE_PROCESS_ENTER) 
     
    9580                    ctl.SetToolTipString(hint_msg) 
    9681                    ctl.SetValue(str(format_number(params[item]))) 
    97                     self.Bind(wx.EVT_TEXT_ENTER, self.onTextEnter) 
    98                     ctl.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 
    99                     ctl.Bind(wx.EVT_KILL_FOCUS, self.onTextEnter) 
     82                    self.Bind(wx.EVT_TEXT_ENTER, self.on_text_enter) 
     83                    ctl.Bind(wx.EVT_SET_FOCUS, self.on_set_focus) 
     84                    ctl.Bind(wx.EVT_KILL_FOCUS, self.on_text_enter) 
    10085                    self.parameters.append([item, ctl]) 
    101                     self.bck.Add(ctl, (n - 1, 1), flag=wx.TOP | wx.BOTTOM, border=0) 
     86                    self.bck.Add(ctl, (n - 1, 1), flag=wx.TOP | wx.BOTTOM, 
     87                                 border=0) 
    10288            for item in keys: 
    103                 if  item.lower() in ["num_points", "avg", "avg_error", "sum", "sum_error"]: 
     89                if item.lower() in ["num_points", "avg", "avg_error", "sum", 
     90                                    "sum_error"]: 
    10491                    n += 1 
    105                     text = wx.StaticText(self, -1, item + ": ", style=wx.ALIGN_LEFT) 
    106                     self.bck.Add(text, (n - 1, 0), flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 
     92                    text = wx.StaticText(self, -1, item + ": ", 
     93                                         style=wx.ALIGN_LEFT) 
     94                    self.bck.Add(text, (n - 1, 0), 
     95                                 flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 
    10796                                 border=15) 
    10897                    ctl = wx.StaticText(self, -1, 
     
    11099                                        style=wx.ALIGN_LEFT) 
    111100                    ctl.SetToolTipString("Result %s" % item) 
    112                     self.bck.Add(ctl, (n - 1, 1), flag=wx.TOP | wx.BOTTOM, border=0) 
     101                    self.bck.Add(ctl, (n - 1, 1), flag=wx.TOP | wx.BOTTOM, 
     102                                 border=0) 
    113103        self.bck.Layout() 
    114104        self.Layout() 
    115         psizer = self.parent.GetSizer() 
    116         if psizer is not None: 
    117             psizer.Layout() 
     105        p_sizer = self.parent.GetSizer() 
     106        if p_sizer is not None: 
     107            p_sizer.Layout() 
    118108 
    119     def onSetFocus(self, evt): 
     109    def on_set_focus(self, evt): 
    120110        """ 
    121111        Highlight the txtcrtl 
     
    126116        # Select the whole control, after this event resolves 
    127117        wx.CallAfter(widget.SetSelection, -1, -1) 
    128         return 
    129118 
    130     def onParamChange(self, evt): 
    131         """ 
    132         Receive and event and reset the text field contained in self.parameters 
    133  
    134         """ 
    135         evt.Skip() 
    136         for item in self.parameters: 
    137             if item[0] in evt.params: 
    138                 item[1].SetValue(format_number(evt.params[item[0]])) 
    139                 item[1].Refresh() 
    140  
    141     def onTextEnter(self, evt): 
     119    def on_text_enter(self, evt): 
    142120        """ 
    143121        Parameters have changed 
     
    149127            try: 
    150128                params[item[0]] = float(item[1].GetValue()) 
    151                 item[1].SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)) 
     129                item[1].SetBackgroundColour(wx.SystemSettings_GetColour( 
     130                    wx.SYS_COLOUR_WINDOW)) 
    152131                item[1].Refresh() 
    153132            except: 
     
    155134                item[1].SetBackgroundColour("pink") 
    156135                item[1].Refresh() 
    157  
    158         if has_error == False: 
     136        if not has_error: 
    159137            # Post parameter event 
    160             ## base is guiframe is this case 
     138            # base is guiframe is this case 
    161139            event = SlicerParameterEvent(type=self.type, params=params) 
    162140            wx.PostEvent(self.base, event) 
     
    166144        On Close Event 
    167145        """ 
    168         ID = self.uid 
    169         self.parent.delete_panel(ID) 
     146        uid = self.uid 
     147        self.parent.delete_panel(uid) 
    170148        self.frame.Destroy() 
  • src/sas/sasgui/perspectives/fitting/basepage.py

    ra1b8fee r914c49d5  
    254254        if not hasattr(self, "model_view"): 
    255255            return 
    256         toggle_mode_on = self.model_view.IsEnabled() 
     256        toggle_mode_on = self.model_view.IsEnabled() or self.data is None 
    257257        if toggle_mode_on: 
    258258            if self.enable2D and not check_data_validity(self.data): 
Note: See TracChangeset for help on using the changeset viewer.