Ignore:
Timestamp:
Aug 3, 2017 2:27:25 AM (7 years ago)
Author:
lewis
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:
cb62bd5
Parents:
5c3c310
Message:

Esnure background value is saved/loaded when analysis is saved/loaded

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/pr/inversion_panel.py

    r5c3c310 ra0e6b1b  
    316316        # Read the panel's parameters 
    317317        flag, alpha, dmax, nfunc, qmin, \ 
    318         qmax, height, width = self._read_pars() 
     318        qmax, height, width, bck = self._read_pars() 
    319319 
    320320        state.nfunc = nfunc 
     
    330330 
    331331        # Background evaluation checkbox 
    332         state.estimate_bck = self.bck_est_ctl.GetValue() 
     332        state.estimate_bck = self.has_bck 
     333        state.bck_value = bck 
    333334 
    334335        # Estimates 
     
    375376        self.plot_data.SetValue(str(state.file)) 
    376377 
    377         # Background evaluation checkbox 
    378         self.bck_man_ctl.SetValue(state.estimate_bck) 
     378        # Background value 
     379        self.bck_est_ctl.SetValue(state.estimate_bck) 
     380        self.bck_man_ctl.SetValue(not state.estimate_bck) 
     381        if not state.estimate_bck: 
     382            self.bck_input.Enable() 
     383            self.bck_input.SetValue(str(state.bck_value)) 
     384        self.has_bck = state.estimate_bck 
     385        self.bck_value = state.bck_value 
    379386 
    380387        # Estimates 
     
    456463            size=(60, 20), value="0.0") 
    457464        self.bck_input.Disable() 
     465        self.bck_input.Bind(wx.EVT_TEXT, self._read_pars) 
    458466        background_units = wx.StaticText(self, -1, "[A^(-1)]", size=(55, 20)) 
    459467        iy += 1 
     
    808816        scenes. 
    809817        """ 
    810         flag, alpha, dmax, nfunc, qmin, qmax, height, width = self._read_pars() 
     818        flag, alpha, dmax, nfunc, qmin, qmax, height, width, bck = self._read_pars() 
    811819 
    812820        # If the pars are valid, estimate alpha 
     
    834842        height = 0 
    835843        width = 0 
     844        background = 0 
    836845        flag = True 
    837846        # Read slit height 
     
    927936            self.qmax_ctl.Refresh() 
    928937 
    929         return flag, alpha, dmax, nfunc, qmin, qmax, height, width 
     938        # Read background 
     939        if not self.has_bck: 
     940            try: 
     941                bck_str = self.bck_input.GetValue() 
     942                if len(bck_str.strip()) == 0: 
     943                    background = 0.0 
     944                else: 
     945                    background = float(bck_str) 
     946                    self.bck_input.SetBackgroundColour(wx.WHITE) 
     947            except ValueError: 
     948                background = 0.0 
     949                self.bck_input.SetBackgroundColour("pink") 
     950            self.bck_input.Refresh() 
     951 
     952        return flag, alpha, dmax, nfunc, qmin, qmax, height, width, background 
    930953 
    931954    def _on_explore(self, evt): 
     
    952975        # Push it to the manager 
    953976 
    954         flag, alpha, dmax, nfunc, qmin, qmax, height, width = self._read_pars() 
     977        flag, alpha, dmax, nfunc, qmin, qmax, height, width, bck = self._read_pars() 
    955978 
    956979        if flag: 
Note: See TracChangeset for help on using the changeset viewer.