Changeset b682c6a in sasview


Ignore:
Timestamp:
Aug 17, 2017 10:14:00 AM (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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
c9ecd1b
Parents:
ce2819b (diff), a06ee7e (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 4_1_issues

Files:
27 edited

Legend:

Unmodified
Added
Removed
  • docs/sphinx-docs/build_sphinx.py

    r01f1e17 r4abc05d8  
    3838#/sasview-local-trunk/docs/sphinx-docs/build_sphinx.py 
    3939SASMODELS_SOURCE_PROLOG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc") 
    40 SASMODELS_SOURCE_GPU = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "gpu") 
    41 SASMODELS_SOURCE_SESANS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "sesans") 
    42 SASMODELS_SOURCE_SESANSIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "sesans", "sesans_img") 
    43 SASMODELS_SOURCE_MAGNETISM = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "magnetism") 
    44 SASMODELS_SOURCE_MAGIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "magnetism", "mag_img") 
    45 SASMODELS_SOURCE_REF_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "models") 
     40SASMODELS_SOURCE_GPU = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "gpu") 
     41SASMODELS_SOURCE_SESANS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "sesans") 
     42SASMODELS_SOURCE_SESANSIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "sesans", "sesans_img") 
     43SASMODELS_SOURCE_MAGNETISM = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "magnetism") 
     44SASMODELS_SOURCE_MAGIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "magnetism", "mag_img") 
     45SASMODELS_SOURCE_REF_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "models") 
    4646SASMODELS_SOURCE_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model") 
    4747SASMODELS_SOURCE_IMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model", "img") 
  • src/sas/sascalc/pr/c_extensions/Cinvertor.c

    r959eb01 rcb62bd5  
    294294} 
    295295 
    296 const char set_has_bck_doc[] = 
     296const char set_est_bck_doc[] = 
    297297        "Sets background flag\n"; 
    298298 
     
    300300 * Sets the maximum distance 
    301301 */ 
    302 static PyObject * set_has_bck(Cinvertor *self, PyObject *args) { 
    303         int has_bck; 
    304  
    305         if (!PyArg_ParseTuple(args, "i", &has_bck)) return NULL; 
    306         self->params.has_bck = has_bck; 
    307         return Py_BuildValue("i", self->params.has_bck); 
    308 } 
    309  
    310 const char get_has_bck_doc[] = 
     302static PyObject * set_est_bck(Cinvertor *self, PyObject *args) { 
     303        int est_bck; 
     304 
     305        if (!PyArg_ParseTuple(args, "i", &est_bck)) return NULL; 
     306        self->params.est_bck = est_bck; 
     307        return Py_BuildValue("i", self->params.est_bck); 
     308} 
     309 
     310const char get_est_bck_doc[] = 
    311311        "Gets background flag\n"; 
    312312 
     
    314314 * Gets the maximum distance 
    315315 */ 
    316 static PyObject * get_has_bck(Cinvertor *self, PyObject *args) { 
    317         return Py_BuildValue("i", self->params.has_bck); 
     316static PyObject * get_est_bck(Cinvertor *self, PyObject *args) { 
     317        return Py_BuildValue("i", self->params.est_bck); 
    318318} 
    319319 
     
    882882        sqrt_alpha = sqrt(self->params.alpha); 
    883883        pi = acos(-1.0); 
    884         offset = (self->params.has_bck==1) ? 0 : 1; 
     884        offset = (self->params.est_bck==1) ? 0 : 1; 
    885885 
    886886    for (j=0; j<nfunc; j++) { 
     
    892892            } 
    893893            if (accept_q(self, self->params.x[i])){ 
    894                 if (self->params.has_bck==1 && j==0) { 
     894                if (self->params.est_bck==1 && j==0) { 
    895895                    a[i*nfunc+j] = 1.0/self->params.err[i]; 
    896896                } else { 
     
    906906        } 
    907907        for (i_r=0; i_r<nr; i_r++){ 
    908             if (self->params.has_bck==1 && j==0) { 
     908            if (self->params.est_bck==1 && j==0) { 
    909909                a[(i_r+self->params.npoints)*nfunc+j] = 0.0; 
    910910            } else { 
     
    10291029                   {"set_slit_height", (PyCFunction)set_slit_height, METH_VARARGS, set_slit_height_doc}, 
    10301030                   {"get_slit_height", (PyCFunction)get_slit_height, METH_VARARGS, get_slit_height_doc}, 
    1031                    {"set_has_bck", (PyCFunction)set_has_bck, METH_VARARGS, set_has_bck_doc}, 
    1032                    {"get_has_bck", (PyCFunction)get_has_bck, METH_VARARGS, get_has_bck_doc}, 
     1031                   {"set_est_bck", (PyCFunction)set_est_bck, METH_VARARGS, set_est_bck_doc}, 
     1032                   {"get_est_bck", (PyCFunction)get_est_bck, METH_VARARGS, get_est_bck_doc}, 
    10331033                   {"get_nx", (PyCFunction)get_nx, METH_VARARGS, get_nx_doc}, 
    10341034                   {"get_ny", (PyCFunction)get_ny, METH_VARARGS, get_ny_doc}, 
  • src/sas/sascalc/pr/c_extensions/invertor.c

    r959eb01 rcb62bd5  
    2020        pars->q_min = -1.0; 
    2121        pars->q_max = -1.0; 
    22         pars->has_bck = 0; 
     22        pars->est_bck = 0; 
    2323} 
    2424 
     
    313313    return sqrt(sum_r2/(2.0*sum)); 
    314314} 
    315  
  • src/sas/sascalc/pr/c_extensions/invertor.h

    r959eb01 rcb62bd5  
    2727    double q_max; 
    2828    /// Flag for whether or not to evalute a constant background while inverting 
    29     int has_bck; 
     29    int est_bck; 
    3030    /// Slit height in units of q [A-1] 
    3131    double slit_height; 
  • src/sas/sascalc/pr/invertor.py

    r45dffa69 rcb62bd5  
    121121         self.q_min, self.q_max, 
    122122         self.x, self.y, 
    123          self.err, self.has_bck, 
     123         self.err, self.est_bck, 
    124124         self.slit_height, self.slit_width) = state 
    125125 
     
    133133                 self.q_min, self.q_max, 
    134134                 self.x, self.y, 
    135                  self.err, self.has_bck, 
     135                 self.err, self.est_bck, 
    136136                 self.slit_height, self.slit_width, 
    137137                ) 
     
    175175        elif name == 'slit_width': 
    176176            return self.set_slit_width(value) 
    177         elif name == 'has_bck': 
     177        elif name == 'est_bck': 
    178178            if value == True: 
    179                 return self.set_has_bck(1) 
     179                return self.set_est_bck(1) 
    180180            elif value == False: 
    181                 return self.set_has_bck(0) 
     181                return self.set_est_bck(0) 
    182182            else: 
    183                 raise ValueError, "Invertor: has_bck can only be True or False" 
     183                raise ValueError, "Invertor: est_bck can only be True or False" 
    184184 
    185185        return Cinvertor.__setattr__(self, name, value) 
     
    220220        elif name == 'slit_width': 
    221221            return self.get_slit_width() 
    222         elif name == 'has_bck': 
    223             value = self.get_has_bck() 
     222        elif name == 'est_bck': 
     223            value = self.get_est_bck() 
    224224            if value == 1: 
    225225                return True 
     
    248248        invertor.y = self.y 
    249249        invertor.err = self.err 
    250         invertor.has_bck = self.has_bck 
     250        invertor.est_bck = self.est_bck 
     251        invertor.background = self.background 
    251252        invertor.slit_height = self.slit_height 
    252253        invertor.slit_width = self.slit_width 
     
    290291        """ 
    291292        # Reset the background value before proceeding 
    292         self.background = 0.0 
    293         return self.lstsq(nfunc, nr=nr) 
     293        # self.background = 0.0 
     294        if not self.est_bck: 
     295            self.y -= self.background 
     296        out, cov = self.lstsq(nfunc, nr=nr) 
     297        if not self.est_bck: 
     298            self.y += self.background 
     299        return out, cov 
    294300 
    295301    def iq(self, out, q): 
     
    454460 
    455461        # If we need to fit the background, add a term 
    456         if self.has_bck == True: 
     462        if self.est_bck == True: 
    457463            nfunc_0 = nfunc 
    458464            nfunc += 1 
     
    500506 
    501507        # Keep a copy of the last output 
    502         if self.has_bck == False: 
    503             self.background = 0 
     508        if self.est_bck == False: 
    504509            self.out = c 
    505510            self.cov = err 
     
    653658        file.write("#slit_width=%g\n" % self.slit_width) 
    654659        file.write("#background=%g\n" % self.background) 
    655         if self.has_bck == True: 
     660        if self.est_bck == True: 
    656661            file.write("#has_bck=1\n") 
    657662        else: 
     
    734739                        toks = line.split('=') 
    735740                        if int(toks[1]) == 1: 
    736                             self.has_bck = True 
     741                            self.est_bck = True 
    737742                        else: 
    738                             self.has_bck = False 
     743                            self.est_bck = False 
    739744 
    740745                    # Now read in the parameters 
  • src/sas/sasgui/perspectives/calculator/model_editor.py

    ra1b8fee r07ec714  
    643643        self.name_hsizer = None 
    644644        self.name_tcl = None 
     645        self.overwrite_cb = None 
    645646        self.desc_sizer = None 
    646647        self.desc_tcl = None 
     
    657658        self.warning = "" 
    658659        #This does not seem to be used anywhere so commenting out for now 
    659         #    -- PDB 2/26/17  
     660        #    -- PDB 2/26/17 
    660661        #self._description = "New Plugin Model" 
    661662        self.function_tcl = None 
     
    689690        #title name [string] 
    690691        name_txt = wx.StaticText(self, -1, 'Function Name : ') 
    691         overwrite_cb = wx.CheckBox(self, -1, "Overwrite existing plugin model of this name?", (10, 10)) 
    692         overwrite_cb.SetValue(False) 
    693         overwrite_cb.SetToolTipString("Overwrite it if already exists?") 
    694         wx.EVT_CHECKBOX(self, overwrite_cb.GetId(), self.on_over_cb) 
     692        self.overwrite_cb = wx.CheckBox(self, -1, "Overwrite existing plugin model of this name?", (10, 10)) 
     693        self.overwrite_cb.SetValue(False) 
     694        self.overwrite_cb.SetToolTipString("Overwrite it if already exists?") 
     695        wx.EVT_CHECKBOX(self, self.overwrite_cb.GetId(), self.on_over_cb) 
    695696        self.name_tcl = wx.TextCtrl(self, -1, size=(PANEL_WIDTH * 3 / 5, -1)) 
    696697        self.name_tcl.Bind(wx.EVT_TEXT_ENTER, self.on_change_name) 
     
    700701        self.name_tcl.SetToolTipString(hint_name) 
    701702        self.name_hsizer.AddMany([(self.name_tcl, 0, wx.LEFT | wx.TOP, 0), 
    702                                   (overwrite_cb, 0, wx.LEFT, 20)]) 
     703                                  (self.overwrite_cb, 0, wx.LEFT, 20)]) 
    703704        self.name_sizer.AddMany([(name_txt, 0, wx.LEFT | wx.TOP, 10), 
    704705                                 (self.name_hsizer, 0, 
     
    740741        self.param_sizer.AddMany([(param_txt, 0, wx.LEFT, 10), 
    741742                                  (self.param_tcl, 1, wx.EXPAND | wx.ALL, 10)]) 
    742          
     743 
    743744        # Parameters with polydispersity 
    744745        pd_param_txt = wx.StaticText(self, -1, 'Fit Parameters requiring ' + \ 
     
    755756        self.pd_param_tcl.setDisplayLineNumbers(True) 
    756757        self.pd_param_tcl.SetToolTipString(pd_param_tip) 
    757          
     758 
    758759        self.param_sizer.AddMany([(pd_param_txt, 0, wx.LEFT, 10), 
    759760                                  (self.pd_param_tcl, 1, wx.EXPAND | wx.ALL, 10)]) 
     
    995996            info = 'Error' 
    996997            color = 'red' 
     998            self.overwrite_cb.SetValue(True) 
     999            self.overwrite_name = True 
    9971000        else: 
    9981001            self._notes = result 
     
    10301033        if has_scipy: 
    10311034            lines.insert(0, 'import scipy') 
    1032          
    1033         # Think about 2D later         
     1035 
     1036        # Think about 2D later 
    10341037        #self.is_2d = func_str.count("#self.ndim = 2") 
    10351038        #line_2d = '' 
    10361039        #if self.is_2d: 
    10371040        #    line_2d = CUSTOM_2D_TEMP.split('\n') 
    1038          
    1039         # Also think about test later         
     1041 
     1042        # Also think about test later 
    10401043        #line_test = TEST_TEMPLATE.split('\n') 
    10411044        #local_params = '' 
     
    10431046        spaces4  = ' '*4 
    10441047        spaces13 = ' '*13 
    1045         spaces16 = ' '*16      
     1048        spaces16 = ' '*16 
    10461049        param_names = []    # to store parameter names 
    10471050        has_scipy = func_str.count("scipy.") 
     
    10551058            out_f.write(line + '\n') 
    10561059            if line.count('#name'): 
    1057                 out_f.write('name = "%s" \n' % name)                
     1060                out_f.write('name = "%s" \n' % name) 
    10581061            elif line.count('#title'): 
    1059                 out_f.write('title = "User model for %s"\n' % name)                
     1062                out_f.write('title = "User model for %s"\n' % name) 
    10601063            elif line.count('#description'): 
    1061                 out_f.write('description = "%s"\n' % desc_str)                
     1064                out_f.write('description = "%s"\n' % desc_str) 
    10621065            elif line.count('#parameters'): 
    10631066                out_f.write('parameters = [ \n') 
     
    10651068                    p_line = param_line.lstrip().rstrip() 
    10661069                    if p_line: 
    1067                         pname, pvalue = self.get_param_helper(p_line) 
     1070                        pname, pvalue, desc = self.get_param_helper(p_line) 
    10681071                        param_names.append(pname) 
    1069                         out_f.write("%s['%s', '', %s, [-numpy.inf, numpy.inf], '', ''],\n" % (spaces16, pname, pvalue)) 
     1072                        out_f.write("%s['%s', '', %s, [-numpy.inf, numpy.inf], '', '%s'],\n" % (spaces16, pname, pvalue, desc)) 
    10701073                for param_line in pd_param_str.split('\n'): 
    10711074                    p_line = param_line.lstrip().rstrip() 
    10721075                    if p_line: 
    1073                         pname, pvalue = self.get_param_helper(p_line) 
     1076                        pname, pvalue, desc = self.get_param_helper(p_line) 
    10741077                        param_names.append(pname) 
    1075                         out_f.write("%s['%s', '', %s, [-numpy.inf, numpy.inf], 'volume', ''],\n" % (spaces16, pname, pvalue)) 
     1078                        out_f.write("%s['%s', '', %s, [-numpy.inf, numpy.inf], 'volume', '%s'],\n" % (spaces16, pname, pvalue, desc)) 
    10761079                out_f.write('%s]\n' % spaces13) 
    1077              
     1080 
    10781081        # No form_volume or ER available in simple model editor 
    10791082        out_f.write('def form_volume(*arg): \n') 
     
    10821085        out_f.write('def ER(*arg): \n') 
    10831086        out_f.write('    return 1.0 \n') 
    1084          
     1087 
    10851088        # function to compute 
    10861089        out_f.write('\n') 
     
    10911094        for func_line in func_str.split('\n'): 
    10921095            out_f.write('%s%s\n' % (spaces4, func_line)) 
    1093          
     1096 
    10941097        Iqxy_string = 'return Iq(numpy.sqrt(x**2+y**2) ' 
    1095              
     1098 
    10961099        out_f.write('\n') 
    10971100        out_f.write('def Iqxy(x, y ') 
     
    11131116        items = line.split(";") 
    11141117        for item in items: 
    1115             name = item.split("=")[0].lstrip().rstrip() 
     1118            name = item.split("=")[0].strip() 
     1119            description = "" 
    11161120            try: 
    1117                 value = item.split("=")[1].lstrip().rstrip() 
     1121                value = item.split("=")[1].strip() 
     1122                if value.count("#"): 
     1123                    # If line ends in a comment, remove it before parsing float 
     1124                    index = value.index("#") 
     1125                    description = value[(index + 1):].strip() 
     1126                    value = value[:value.index("#")].strip() 
    11181127                float(value) 
    1119             except: 
     1128            except ValueError: 
    11201129                value = 1.0 # default 
    11211130 
    1122         return name, value 
     1131        return name, value, description 
    11231132 
    11241133    def set_function_helper(self, line): 
     
    12041213import numpy 
    12051214 
    1206 #name  
     1215#name 
    12071216 
    12081217#title 
     
    12101219#description 
    12111220 
    1212 #parameters  
     1221#parameters 
    12131222 
    12141223""" 
  • src/sas/sasgui/perspectives/calculator/pyconsole.py

    r7432acb r4627657  
    3737    Iqxy = model.evalDistribution([qx, qy]) 
    3838 
    39     result = """ 
    40     Iq(%s) = %s 
    41     Iqxy(%s, %s) = %s 
    42     """%(q, Iq, qx, qy, Iqxy) 
     39    # check the model's unit tests run 
     40    from sasmodels.model_test import run_one 
     41    result = run_one(path) 
    4342 
    4443    return result 
     
    8988        ok = wx.Button(self, wx.ID_OK, "OK") 
    9089 
    91         # Mysterious constraint layouts from  
     90        # Mysterious constraint layouts from 
    9291        # https://www.wxpython.org/docs/api/wx.lib.layoutf.Layoutf-class.html 
    9392        lc = layoutf.Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self,ok)) 
  • src/sas/sasgui/perspectives/fitting/fitting.py

    ra534432 r489f53a  
    257257        toks = os.path.splitext(label) 
    258258        path = os.path.join(models.find_plugins_dir(), toks[0]) 
     259        message = "Are you sure you want to delete the file {}?".format(path) 
     260        dlg = wx.MessageDialog(self.frame, message, '', wx.YES_NO | wx.ICON_QUESTION) 
     261        if not dlg.ShowModal() == wx.ID_YES: 
     262            return 
    259263        try: 
    260264            for ext in ['.py', '.pyc']: 
    261265                p_path = path + ext 
     266                if ext == '.pyc' and not os.path.isfile(path + ext): 
     267                    # If model is invalid, .pyc file may not exist as model has 
     268                    # never been compiled. Don't try and delete it 
     269                    continue 
    262270                os.remove(p_path) 
    263271            self.update_custom_combo() 
     
    361369                                   'Add a new model function') 
    362370        wx.EVT_MENU(owner, wx_id, self.make_new_model) 
    363          
     371 
    364372        wx_id = wx.NewId() 
    365373        self.edit_model_menu.Append(wx_id, 'Sum|Multi(p1, p2)', 
     
    383391          '(Re)Load all models present in user plugin_models folder') 
    384392        wx.EVT_MENU(owner, wx_id, self.load_plugin_models) 
    385                  
     393 
    386394    def set_edit_menu_helper(self, owner=None, menu=None): 
    387395        """ 
     
    17341742            @param unsmeared_error: data error, rescaled to unsmeared model 
    17351743        """ 
    1736              
    1737         number_finite = np.count_nonzero(np.isfinite(y))  
     1744 
     1745        number_finite = np.count_nonzero(np.isfinite(y)) 
    17381746        np.nan_to_num(y) 
    17391747        new_plot = self.create_theory_1D(x, y, page_id, model, data, state, 
     
    17941802            msg = "Computing Error: Model did not return any finite value." 
    17951803            wx.PostEvent(self.parent, StatusEvent(status = msg, info="error")) 
    1796         else:                  
     1804        else: 
    17971805            msg = "Computation  completed!" 
    17981806            if number_finite != y.size: 
     
    18241832        that can be plot. 
    18251833        """ 
    1826         number_finite = np.count_nonzero(np.isfinite(image))  
     1834        number_finite = np.count_nonzero(np.isfinite(image)) 
    18271835        np.nan_to_num(image) 
    18281836        new_plot = Data2D(image=image, err_image=data.err_data) 
     
    19271935                ## and may be the cause of other noted instabilities 
    19281936                ## 
    1929                 ##    -PDB August 12, 2014  
     1937                ##    -PDB August 12, 2014 
    19301938                while self.calc_2D.isrunning(): 
    19311939                    time.sleep(0.1) 
     
    19691977            if (self.calc_1D is not None) and self.calc_1D.isrunning(): 
    19701978                self.calc_1D.stop() 
    1971                 ## stop just raises the flag -- the thread is supposed to  
     1979                ## stop just raises the flag -- the thread is supposed to 
    19721980                ## then kill itself but cannot.  Paul Kienzle came up with 
    19731981                ## this fix to prevent threads from stepping on each other 
     
    19811989                ## a request to stop the computation. 
    19821990                ## It seems thus that the whole thread approach used here 
    1983                 ## May need rethinking   
     1991                ## May need rethinking 
    19841992                ## 
    19851993                ##    -PDB August 12, 2014 
     
    21462154            residuals.dxw = None 
    21472155            residuals.ytransform = 'y' 
    2148             # For latter scale changes  
     2156            # For latter scale changes 
    21492157            residuals.xaxis('\\rm{Q} ', 'A^{-1}') 
    21502158            residuals.yaxis('\\rm{Residuals} ', 'normalized') 
  • src/sas/sasgui/perspectives/fitting/models.py

    r146c669 rb682c6a  
    187187            try: 
    188188                model = load_custom_model(path) 
    189                 model.name = PLUGIN_NAME_BASE + model.name 
     189                if not model.name.count(PLUGIN_NAME_BASE): 
     190                    model.name = PLUGIN_NAME_BASE + model.name 
    190191                plugins[model.name] = model 
    191192            except Exception: 
     
    300301        for name, plug in self.stored_plugins.iteritems(): 
    301302            self.model_dictionary[name] = plug 
    302          
     303 
    303304        self._get_multifunc_models() 
    304305 
  • src/sas/sasgui/perspectives/pr/inversion_panel.py

    r7432acb rcb62bd5  
    7070        self.rg_ctl = None 
    7171        self.iq0_ctl = None 
    72         self.bck_chk = None 
     72        self.bck_value = None 
     73        self.bck_est_ctl = None 
     74        self.bck_man_ctl = None 
     75        self.est_bck = True 
     76        self.bck_input = None 
    7377        self.bck_ctl = None 
    7478 
     
    312316        # Read the panel's parameters 
    313317        flag, alpha, dmax, nfunc, qmin, \ 
    314         qmax, height, width = self._read_pars() 
     318        qmax, height, width, bck = self._read_pars() 
    315319 
    316320        state.nfunc = nfunc 
     
    326330 
    327331        # Background evaluation checkbox 
    328         state.estimate_bck = self.bck_chk.IsChecked() 
     332        state.estimate_bck = self.est_bck 
     333        state.bck_value = bck 
    329334 
    330335        # Estimates 
     
    371376        self.plot_data.SetValue(str(state.file)) 
    372377 
    373         # Background evaluation checkbox 
    374         self.bck_chk.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.est_bck = state.estimate_bck 
     385        self.bck_value = state.bck_value 
    375386 
    376387        # Estimates 
     
    431442                       wx.EXPAND | wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 15) 
    432443 
    433         self.bck_chk = wx.CheckBox(self, -1, "Estimate background level") 
    434         hint_msg = "Check box to let the fit estimate " 
    435         hint_msg += "the constant background level." 
    436         self.bck_chk.SetToolTipString(hint_msg) 
    437         self.bck_chk.Bind(wx.EVT_CHECKBOX, self._on_pars_changed) 
     444        radio_sizer = wx.GridBagSizer(5, 5) 
     445 
     446        self.bck_est_ctl = wx.RadioButton(self, -1, "Estimate background level", 
     447            name="estimate_bck", style=wx.RB_GROUP) 
     448        self.bck_man_ctl = wx.RadioButton(self, -1, "Input manual background level", 
     449            name="manual_bck") 
     450 
     451        self.bck_est_ctl.Bind(wx.EVT_RADIOBUTTON, self._on_bck_changed) 
     452        self.bck_man_ctl.Bind(wx.EVT_RADIOBUTTON, self._on_bck_changed) 
     453 
     454        radio_sizer.Add(self.bck_est_ctl, (0,0), (1,1), wx.LEFT | wx.EXPAND) 
     455        radio_sizer.Add(self.bck_man_ctl, (0,1), (1,1), wx.RIGHT | wx.EXPAND) 
     456 
    438457        iy += 1 
    439         pars_sizer.Add(self.bck_chk, (iy, 0), (1, 2), 
     458        pars_sizer.Add(radio_sizer, (iy, 0), (1, 2), 
    440459                       wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
     460 
     461        background_label = wx.StaticText(self, -1, "Background: ") 
     462        self.bck_input = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, 
     463            size=(60, 20), value="0.0") 
     464        self.bck_input.Disable() 
     465        self.bck_input.Bind(wx.EVT_TEXT, self._read_pars) 
     466        background_units = wx.StaticText(self, -1, "[A^(-1)]", size=(55, 20)) 
     467        iy += 1 
     468 
     469        background_sizer = wx.GridBagSizer(5, 5) 
     470 
     471        background_sizer.Add(background_label, (0, 0), (1,1), 
     472            wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 23) 
     473        background_sizer.Add(self.bck_input, (0, 1), (1,1), 
     474            wx.LEFT | wx.ADJUST_MINSIZE, 5) 
     475        background_sizer.Add(background_units, (0, 2), (1,1), 
     476            wx.LEFT | wx.ADJUST_MINSIZE, 5) 
     477        pars_sizer.Add(background_sizer, (iy, 0), (1, 2), 
     478            wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
     479 
    441480        boxsizer1.Add(pars_sizer, 0, wx.EXPAND) 
    442481        vbox.Add(boxsizer1, (iy_vb, 0), (1, 1), 
     
    764803        self._on_pars_changed() 
    765804 
     805    def _on_bck_changed(self, evt=None): 
     806        self.est_bck = self.bck_est_ctl.GetValue() 
     807        if self.est_bck: 
     808            self.bck_input.Disable() 
     809        else: 
     810            self.bck_input.Enable() 
     811 
    766812    def _on_pars_changed(self, evt=None): 
    767813        """ 
     
    770816        scenes. 
    771817        """ 
    772         flag, alpha, dmax, nfunc, qmin, qmax, height, width = self._read_pars() 
    773         has_bck = self.bck_chk.IsChecked() 
     818        flag, alpha, dmax, nfunc, qmin, qmax, height, width, bck = self._read_pars() 
    774819 
    775820        # If the pars are valid, estimate alpha 
     
    783828                                                      d_max=dmax, 
    784829                                                      q_min=qmin, q_max=qmax, 
    785                                                       bck=has_bck, 
     830                                                      est_bck=self.est_bck, 
     831                                                      bck_val=bck, 
    786832                                                      height=height, 
    787833                                                      width=width) 
     
    797843        height = 0 
    798844        width = 0 
     845        background = 0 
    799846        flag = True 
    800847        # Read slit height 
     
    890937            self.qmax_ctl.Refresh() 
    891938 
    892         return flag, alpha, dmax, nfunc, qmin, qmax, height, width 
     939        # Read background 
     940        if not self.est_bck: 
     941            try: 
     942                bck_str = self.bck_input.GetValue() 
     943                if len(bck_str.strip()) == 0: 
     944                    background = 0.0 
     945                else: 
     946                    background = float(bck_str) 
     947                    self.bck_input.SetBackgroundColour(wx.WHITE) 
     948            except ValueError: 
     949                background = 0.0 
     950                self.bck_input.SetBackgroundColour("pink") 
     951            self.bck_input.Refresh() 
     952 
     953        return flag, alpha, dmax, nfunc, qmin, qmax, height, width, background 
    893954 
    894955    def _on_explore(self, evt): 
     
    915976        # Push it to the manager 
    916977 
    917         flag, alpha, dmax, nfunc, qmin, qmax, height, width = self._read_pars() 
    918         has_bck = self.bck_chk.IsChecked() 
     978        flag, alpha, dmax, nfunc, qmin, qmax, height, width, bck = self._read_pars() 
    919979 
    920980        if flag: 
     
    928988                                                   d_max=dmax, 
    929989                                                   q_min=qmin, q_max=qmax, 
    930                                                    bck=has_bck, 
     990                                                   est_bck=self.est_bck, 
     991                                                   bck_val = bck, 
    931992                                                   height=height, 
    932993                                                   width=width) 
  • src/sas/sasgui/perspectives/pr/inversion_state.py

    r7432acb ra0e6b1b  
    3636           ["qmin", "qmin"], 
    3737           ["qmax", "qmax"], 
    38            ["estimate_bck", "estimate_bck"]] 
     38           ["estimate_bck", "estimate_bck"], 
     39           ["bck_value", "bck_value"]] 
    3940 
    4041## List of P(r) inversion outputs 
     
    6263        self.estimate_bck = False 
    6364        self.timestamp = time.time() 
     65        self.bck_value = 0.0 
    6466 
    6567        # Inversion parameters 
     
    109111        state += "Timestamp:    %s\n" % self.timestamp 
    110112        state += "Estimate bck: %s\n" % str(self.estimate_bck) 
     113        state += "Bck Value:    %s\n" % str(self.bck_value) 
    111114        state += "No. terms:    %s\n" % str(self.nfunc) 
    112115        state += "D_max:        %s\n" % str(self.d_max) 
     
    296299                            self.coefficients.append(float(c)) 
    297300                        except: 
    298                             # Bad data, skip. We will count the number of  
    299                             # coefficients at the very end and deal with  
     301                            # Bad data, skip. We will count the number of 
     302                            # coefficients at the very end and deal with 
    300303                            # inconsistencies then. 
    301304                            pass 
     
    329332                                cov_row.append(float(c)) 
    330333                            except: 
    331                                 # Bad data, skip. We will count the number of  
    332                                 # coefficients at the very end and deal with  
     334                                # Bad data, skip. We will count the number of 
     335                                # coefficients at the very end and deal with 
    333336                                # inconsistencies then. 
    334337                                pass 
     
    461464                tree = etree.parse(path, parser=etree.ETCompatXMLParser()) 
    462465                # Check the format version number 
    463                 # Specifying the namespace will take care of the file  
    464                 #format version  
     466                # Specifying the namespace will take care of the file 
     467                #format version 
    465468                root = tree.getroot() 
    466469 
  • src/sas/sasgui/perspectives/pr/media/pr_help.rst

    r1221196 r1abd19c  
    4949P(r) inversion requires that the background be perfectly subtracted.  This is 
    5050often difficult to do well and thus many data sets will include a background. 
    51 For those cases, the user should check the "estimate background" box and the 
    52 module will do its best to estimate it. 
     51For those cases, the user should check the "Estimate background level" option 
     52and the module will do its best to estimate it. If you know the background value 
     53for your data, select the "Input manual background level" option. Note that 
     54this value will be treated as having 0 error. 
    5355 
    5456The P(r) module is constantly computing in the background what the optimum 
  • src/sas/sasgui/perspectives/pr/pr.py

    ra1b8fee rcb62bd5  
    6868        self.q_min = None 
    6969        self.q_max = None 
    70         self.has_bck = False 
     70        self.est_bck = False 
     71        self.bck_val = 0 
    7172        self.slit_height = 0 
    7273        self.slit_width = 0 
     
    828829        self.control_panel.iq0 = pr.iq0(out) 
    829830        self.control_panel.bck = pr.background 
     831        self.control_panel.bck_input.SetValue("{:.2g}".format(pr.background)) 
    830832 
    831833        # Show I(q) fit 
     
    907909 
    908910    def setup_plot_inversion(self, alpha, nfunc, d_max, q_min=None, q_max=None, 
    909                              bck=False, height=0, width=0): 
     911                             est_bck=False, bck_val=0, height=0, width=0): 
    910912        """ 
    911913            Set up inversion from plotted data 
     
    916918        self.q_min = q_min 
    917919        self.q_max = q_max 
    918         self.has_bck = bck 
     920        self.est_bck = est_bck 
     921        self.bck_val = bck_val 
    919922        self.slit_height = height 
    920923        self.slit_width = width 
     
    930933    def estimate_plot_inversion(self, alpha, nfunc, d_max, 
    931934                                q_min=None, q_max=None, 
    932                                 bck=False, height=0, width=0): 
     935                                est_bck=False, bck_val=0, height=0, width=0): 
    933936        """ 
    934937            Estimate parameters from plotted data 
     
    939942        self.q_min = q_min 
    940943        self.q_max = q_max 
    941         self.has_bck = bck 
     944        self.est_bck = est_bck 
     945        self.bck_val = bck_val 
    942946        self.slit_height = height 
    943947        self.slit_width = width 
     
    973977        pr.x = self.current_plottable.x 
    974978        pr.y = self.current_plottable.y 
    975         pr.has_bck = self.has_bck 
     979        pr.est_bck = self.est_bck 
    976980        pr.slit_height = self.slit_height 
    977981        pr.slit_width = self.slit_width 
     982        pr.background = self.bck_val 
    978983 
    979984        # Keep track of the plot window title to ensure that 
     
    10191024        self.q_min = q_min 
    10201025        self.q_max = q_max 
    1021         self.has_bck = bck 
     1026        self.est_bck = bck 
    10221027        self.slit_height = height 
    10231028        self.slit_width = width 
     
    10421047        self.q_min = q_min 
    10431048        self.q_max = q_max 
    1044         self.has_bck = bck 
     1049        self.est_bck = bck 
    10451050        self.slit_height = height 
    10461051        self.slit_width = width 
     
    11151120            pr.y = y 
    11161121            pr.err = err 
    1117             pr.has_bck = self.has_bck 
     1122            pr.est_bck = self.est_bck 
    11181123            pr.slit_height = self.slit_height 
    11191124            pr.slit_width = self.slit_width 
  • test/pr_inversion/test/utest_invertor.py

    raaf5e49 rcb62bd5  
    6868            self.x_in[i] = 1.0*(i+1) 
    6969 
    70     def test_has_bck_flag(self): 
    71         """ 
    72             Tests the has_bck flag operations 
    73         """ 
    74         self.assertEqual(self.invertor.has_bck, False) 
    75         self.invertor.has_bck=True 
    76         self.assertEqual(self.invertor.has_bck, True) 
     70    def test_est_bck_flag(self): 
     71        """ 
     72            Tests the est_bck flag operations 
     73        """ 
     74        self.assertEqual(self.invertor.est_bck, False) 
     75        self.invertor.est_bck=True 
     76        self.assertEqual(self.invertor.est_bck, True) 
    7777        def doit_float(): 
    78             self.invertor.has_bck  = 2.0 
     78            self.invertor.est_bck  = 2.0 
    7979        def doit_str(): 
    80             self.invertor.has_bck  = 'a' 
     80            self.invertor.est_bck  = 'a' 
    8181 
    8282        self.assertRaises(ValueError, doit_float) 
  • docs/sphinx-docs/source/conf.py

    r959eb01 rce2819b  
    3939              'sphinx.ext.viewcode'] 
    4040 
     41#set mathjax path 
     42mathjax_path="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML" 
     43 
    4144# Add any paths that contain templates here, relative to this directory. 
    4245templates_path = ['_templates'] 
     
    6265version = '4.1' 
    6366# The full version, including alpha/beta/rc tags. 
    64 release = '4.1.0' 
     67release = '4.1.2' 
    6568 
    6669# The language for content autogenerated by Sphinx. Refer to documentation 
  • sasview/README.txt

    r9146ed9 r6394851  
    441- Features 
    55=========== 
     6    - New in Version 4.1.2 
     7      -------------------- 
     8      This point release is a bug-fix release addressing: 
     9 
     10       - Fixes #984: PDF Reports Generate Empty PDFs 
     11       - Fixes a path typo 
     12       - 64 bit and 32 bit Windows executables now available 
     13 
     14      It is recommended that all users upgrade to this version 
     15 
     16    - New in Version 4.1.1 
     17      -------------------- 
     18      This point release is a bug-fix release addressing: 
     19 
     20       - Fixes #948: Mathjax CDN is going away 
     21       - Fixes #938: Cannot read canSAS1D file output by SasView 
     22       - Fixes #960: Save project throws error if empty fit page 
     23       - Fixes #929: Problem deleting data in first fit page 
     24       - Fixes #918: Test folders not bundled with release 
     25       - Fixes an issue with the live discovery of plugin models 
     26       - Fixes an issue with the NXcanSAS data loader 
     27       - Updated tutorials for SasView 4.x.y 
     28 
    629    - New in Version 4.1.0 
    730      ------------------ 
  • sasview/__init__.py

    r463e7ffc rce2819b  
    1 __version__ = "4.1" 
     1__version__ = "4.1.2" 
    22__build__ = "GIT_COMMIT" 
    33 
  • sasview/local_config.py

    ra1b8fee rce2819b  
    4747'''This work benefited from the use of the SasView application, originally developed under NSF Award DMR-0520547. SasView also contains code developed with funding from the EU Horizon 2020 programme under the SINE2020 project Grant No 654000.''' 
    4848_acknowledgement_citation = \ 
    49 '''M. Doucet et al. SasView Version 4.1, Zenodo, 10.5281/zenodo.438138''' 
     49'''M. Doucet et al. SasView Version 4.1.2, Zenodo, 10.5281/zenodo.825675''' 
    5050 
    5151_acknowledgement =  \ 
  • sasview/sasview.spec

    re42c8e9d r945f45d  
    138138 'sasmodels.core', 
    139139 'pyopencl', 
    140  'tinycc' 
     140 'tinycc', 
     141 'xhtml2pdf' 
    141142] 
    142143 
  • sasview/setup_exe.py

    ra1b8fee rce2819b  
    179179test_1d_dir = os.path.join(path, "test\\1d_data") 
    180180test_2d_dir = os.path.join(path, "test\\2d_data") 
     181test_sesans_dir = os.path.join(path, "test\\sesans_data") 
     182test_convertible_dir = os.path.join(path, "test\\convertible_files") 
    181183test_save_dir = os.path.join(path, "test\\save_states") 
    182 test_upcoming_dir = os.path.join(path, "test\\upcoming_formats") 
     184test_coord_dir = os.path.join(path, "test\\coordinate_data") 
     185test_image_dir = os.path.join(path, "test\\image_data") 
     186test_other_dir = os.path.join(path, "test\\other_files") 
    183187 
    184188matplotlibdatadir = matplotlib.get_data_path() 
     
    273277# Copying the images directory to the distribution directory. 
    274278for f in findall(images_dir): 
    275     if not ".svn" in f: 
    276         data_files.append(("images", [f])) 
     279    data_files.append(("images", [f])) 
    277280 
    278281# Copying the HTML help docs 
    279282for f in findall(media_dir): 
    280     if not ".svn" in f: 
    281         data_files.append(("media", [f])) 
     283    data_files.append(("media", [f])) 
    282284 
    283285# Copying the sample data user data 
    284286for f in findall(test_1d_dir): 
    285     if not ".svn" in f: 
    286         data_files.append(("test\\1d_data", [f])) 
    287  
    288 # Copying the sample data user data 
     287    data_files.append(("test\\1d_data", [f])) 
    289288for f in findall(test_2d_dir): 
    290     if not ".svn" in f: 
    291         data_files.append(("test\\2d_data", [f])) 
    292  
    293 # Copying the sample data user data 
     289    data_files.append(("test\\2d_data", [f])) 
    294290for f in findall(test_save_dir): 
    295     if not ".svn" in f: 
    296         data_files.append(("test\\save_states", [f])) 
    297  
    298 # Copying the sample data user data 
    299 for f in findall(test_upcoming_dir): 
    300     if not ".svn" in f: 
    301         data_files.append(("test\\upcoming_formats", [f])) 
     291    data_files.append(("test\\save_states", [f])) 
     292for f in findall(test_sesans_dir): 
     293    data_files.append(("test\\sesans_data", [f])) 
     294for f in findall(test_convertible_dir): 
     295    data_files.append(("test\\convertible_files", [f])) 
     296for f in findall(test_coord_dir): 
     297    data_files.append(("test\\coordinate_data", [f])) 
     298for f in findall(test_image_dir): 
     299    data_files.append(("test\\image_data", [f])) 
     300for f in findall(test_other_dir): 
     301    data_files.append(("test\\other_files", [f])) 
    302302 
    303303# Copying opencl include files 
  • src/sas/sascalc/dataloader/readers/cansas_reader.py

    r7432acb r6a455cd3  
    158158                    # If the file does not match the schema, raise this error 
    159159                    invalid_xml = self.find_invalid_xml() 
    160                     invalid_xml = INVALID_XML.format(basename + extension) + invalid_xml 
    161                     self.errors.add(invalid_xml) 
     160                    if invalid_xml != "": 
     161                        invalid_xml = INVALID_XML.format(basename + extension) + invalid_xml 
     162                        self.errors.add(invalid_xml) 
    162163                    # Try again with an invalid CanSAS schema, that requires only a data set in each 
    163164                    base_name = xml_reader.__file__ 
     
    263264                # I and Q - 1D data 
    264265                elif tagname == 'I' and isinstance(self.current_dataset, plottable_1D): 
    265                     unit_list = unit.split("|") 
    266                     if len(unit_list) > 1: 
    267                         self.current_dataset.yaxis(unit_list[0].strip(), 
    268                                                    unit_list[1].strip()) 
    269                     else: 
    270                         self.current_dataset.yaxis("Intensity", unit) 
     266                    self.current_dataset.yaxis("Intensity", unit) 
    271267                    self.current_dataset.y = np.append(self.current_dataset.y, data_point) 
    272268                elif tagname == 'Idev' and isinstance(self.current_dataset, plottable_1D): 
    273269                    self.current_dataset.dy = np.append(self.current_dataset.dy, data_point) 
    274270                elif tagname == 'Q': 
    275                     unit_list = unit.split("|") 
    276                     if len(unit_list) > 1: 
    277                         self.current_dataset.xaxis(unit_list[0].strip(), 
    278                                                    unit_list[1].strip()) 
    279                     else: 
    280                         self.current_dataset.xaxis("Q", unit) 
     271                    self.current_dataset.xaxis("Q", unit) 
    281272                    self.current_dataset.x = np.append(self.current_dataset.x, data_point) 
    282273                elif tagname == 'Qdev': 
     
    292283                elif tagname == 'Sesans': 
    293284                    self.current_datainfo.isSesans = bool(data_point) 
     285                    self.current_dataset.xaxis(attr.get('x_axis'), 
     286                                                attr.get('x_unit')) 
     287                    self.current_dataset.yaxis(attr.get('y_axis'), 
     288                                                attr.get('y_unit')) 
    294289                elif tagname == 'yacceptance': 
    295290                    self.current_datainfo.sample.yacceptance = (data_point, unit) 
     
    785780                    value_unit = local_unit 
    786781            except KeyError: 
    787                 err_msg = "CanSAS reader: unexpected " 
    788                 err_msg += "\"{0}\" unit [{1}]; " 
    789                 err_msg = err_msg.format(tagname, local_unit) 
    790                 err_msg += "expecting [{0}]".format(default_unit) 
     782                # Do not throw an error for loading Sesans data in cansas xml 
     783                # This is a temporary fix. 
     784                if local_unit != "A" and local_unit != 'pol': 
     785                    err_msg = "CanSAS reader: unexpected " 
     786                    err_msg += "\"{0}\" unit [{1}]; " 
     787                    err_msg = err_msg.format(tagname, local_unit) 
     788                    err_msg += "expecting [{0}]".format(default_unit) 
    791789                value_unit = local_unit 
    792790            except: 
     
    10391037            node.append(point) 
    10401038            self.write_node(point, "Q", datainfo.x[i], 
    1041                             {'unit': datainfo._xaxis + " | " + datainfo._xunit}) 
     1039                            {'unit': datainfo.x_unit}) 
    10421040            if len(datainfo.y) >= i: 
    10431041                self.write_node(point, "I", datainfo.y[i], 
    1044                                 {'unit': datainfo._yaxis + " | " + datainfo._yunit}) 
     1042                                {'unit': datainfo.y_unit}) 
    10451043            if datainfo.dy is not None and len(datainfo.dy) > i: 
    10461044                self.write_node(point, "Idev", datainfo.dy[i], 
    1047                                 {'unit': datainfo._yaxis + " | " + datainfo._yunit}) 
     1045                                {'unit': datainfo.y_unit}) 
    10481046            if datainfo.dx is not None and len(datainfo.dx) > i: 
    10491047                self.write_node(point, "Qdev", datainfo.dx[i], 
    1050                                 {'unit': datainfo._xaxis + " | " + datainfo._xunit}) 
     1048                                {'unit': datainfo.x_unit}) 
    10511049            if datainfo.dxw is not None and len(datainfo.dxw) > i: 
    10521050                self.write_node(point, "dQw", datainfo.dxw[i], 
    1053                                 {'unit': datainfo._xaxis + " | " + datainfo._xunit}) 
     1051                                {'unit': datainfo.x_unit}) 
    10541052            if datainfo.dxl is not None and len(datainfo.dxl) > i: 
    10551053                self.write_node(point, "dQl", datainfo.dxl[i], 
    1056                                 {'unit': datainfo._xaxis + " | " + datainfo._xunit}) 
     1054                                {'unit': datainfo.x_unit}) 
    10571055        if datainfo.isSesans: 
    1058             sesans = self.create_element("Sesans") 
     1056            sesans_attrib = {'x_axis': datainfo._xaxis, 
     1057                             'y_axis': datainfo._yaxis, 
     1058                             'x_unit': datainfo.x_unit, 
     1059                             'y_unit': datainfo.y_unit} 
     1060            sesans = self.create_element("Sesans", attrib=sesans_attrib) 
    10591061            sesans.text = str(datainfo.isSesans) 
    1060             node.append(sesans) 
    1061             self.write_node(node, "yacceptance", datainfo.sample.yacceptance[0], 
     1062            entry_node.append(sesans) 
     1063            self.write_node(entry_node, "yacceptance", datainfo.sample.yacceptance[0], 
    10621064                             {'unit': datainfo.sample.yacceptance[1]}) 
    1063             self.write_node(node, "zacceptance", datainfo.sample.zacceptance[0], 
     1065            self.write_node(entry_node, "zacceptance", datainfo.sample.zacceptance[0], 
    10641066                             {'unit': datainfo.sample.zacceptance[1]}) 
    10651067 
  • src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py

    rc94280c r7c24685  
    126126 
    127127            if isinstance(value, h5py.Group): 
     128                parent_class = class_name 
    128129                self.parent_class = class_name 
    129130                parent_list.append(key) 
     
    136137                # Recursion step to access data within the group 
    137138                self.read_children(value, parent_list) 
     139                self.parent_class = parent_class 
    138140                self.add_intermediate() 
    139141                parent_list.remove(key) 
  • src/sas/sascalc/dataloader/readers/xml_reader.py

    r235f514 r6a455cd3  
    130130            first_error = schema.assertValid(self.xmldoc) 
    131131        except etree.DocumentInvalid as err: 
     132            # Suppress errors for <'any'> elements 
     133            if "##other" in str(err): 
     134                return first_error 
    132135            first_error = str(err) 
    133136        return first_error 
  • src/sas/sasgui/guiframe/config.py

    ra1b8fee rce2819b  
    4848'''This work benefited from the use of the SasView application, originally developed under NSF Award DMR-0520547. SasView also contains code developed with funding from the EU Horizon 2020 programme under the SINE2020 project Grant No 654000.''' 
    4949_acknowledgement_citation = \ 
    50 '''M. Doucet et al. SasView Version 4.1, Zenodo, 10.5281/zenodo.438138''' 
     50'''M. Doucet et al. SasView Version 4.1.2, Zenodo, 10.5281/zenodo.825675''' 
    5151 
    5252_acknowledgement =  \ 
  • src/sas/sasgui/guiframe/documentation_window.py

    r959eb01 r6a455cd3  
    7575            logger.error("Could not find Sphinx documentation at %s \ 
    7676            -- has it been built?", file_path) 
    77         elif WX_SUPPORTS_HTML2: 
    78             # Complete HTML/CSS support! 
    79             self.view = html.WebView.New(self) 
    80             self.view.LoadURL(url) 
    81             self.Show() 
     77        #Commenting following 5 lines, so default browser is forced 
     78        #This is due to CDN mathjax discontinuation of service, intenal help 
     79        #browser should be back with qt version 
     80        #Note added by Wojtek Potrzebowski, July 4th 2017 
     81        # elif WX_SUPPORTS_HTML2: 
     82        #     # Complete HTML/CSS support! 
     83        #     self.view = html.WebView.New(self) 
     84        #     self.view.LoadURL(url) 
     85        #     self.Show() 
    8286        else: 
    8387            logger.error("No html2 support, popping up a web browser") 
  • src/sas/sasgui/perspectives/fitting/fitpage.py

    red2276f r6a455cd3  
    12361236            wx.PostEvent(self.parent, new_event) 
    12371237            # update list of plugins if new plugin is available 
    1238             custom_model = CUSTOM_MODEL 
    12391238            mod_cat = self.categorybox.GetStringSelection() 
    1240             if mod_cat == custom_model: 
     1239            if mod_cat == CUSTOM_MODEL: 
     1240                temp_id = self.model.id 
    12411241                temp = self.parent.update_model_list() 
     1242                for v in self.parent.model_dictionary.values(): 
     1243                    if v.id == temp_id: 
     1244                        self.model = v() 
     1245                        break 
    12421246                if temp: 
    12431247                    self.model_list_box = temp 
  • src/sas/sasgui/perspectives/fitting/fitpanel.py

    r67b0a99 rd79feea  
    9292            # state must be cloned 
    9393            state = page.get_state().clone() 
    94             if data is not None or page.model is not None: 
     94            # data_list only populated with real data 
     95            # Fake object in data from page.get_data() if model is selected 
     96            if len(page.data_list) is not 0 and page.model is not None: 
    9597                new_doc = self._manager.state_reader.write_toXML(data, 
    9698                                                                 state, 
    9799                                                                 batch_state) 
     100                # Fit #2 through #n are append to first fit 
    98101                if doc is not None and hasattr(doc, "firstChild"): 
    99                     child = new_doc.firstChild.firstChild 
    100                     doc.firstChild.appendChild(child) 
     102                    # Only append if properly formed new_doc 
     103                    if new_doc is not None and hasattr(new_doc, "firstChild"): 
     104                        child = new_doc.firstChild.firstChild 
     105                        doc.firstChild.appendChild(child) 
     106                # First fit defines the main document 
    101107                else: 
    102108                    doc = new_doc 
     
    395401                temp_data = page.get_data() 
    396402                if temp_data is not None and temp_data.id in data: 
    397                     self.SetSelection(pos) 
    398                     self.on_close_page(event=None) 
    399                     temp = self.GetSelection() 
    400                     self.DeletePage(temp) 
     403                    self.close_page_with_data(temp_data) 
    401404            if self.sim_page is not None: 
    402405                if len(self.sim_page.model_list) == 0: 
     
    405408                    self.on_close_page(event=None) 
    406409                    temp = self.GetSelection() 
    407                     self.DeletePage(temp) 
     410                    self.DeletePage(pos) 
    408411                    self.sim_page = None 
    409412                    self.batch_on = False 
Note: See TracChangeset for help on using the changeset viewer.