Ignore:
File:
1 edited

Legend:

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

    r0900627 r2d9526d  
    13261326 
    13271327                is_data2d = issubclass(data.__class__, Data2D) 
    1328                 # Check consistency of arrays 
     1328                #check consistency of arrays 
    13291329                if not is_data2d: 
    13301330                    if len(res.theory) == len(res.index[res.index]) and \ 
     
    13371337                    new_theory[res.index == False] = np.nan 
    13381338                    correct_result = True 
    1339                 # Get all fittable parameters of the current model 
     1339                #get all fittable parameters of the current model 
    13401340                param_list = model.getParamList() 
    13411341                for param in model.getDispParamList(): 
    1342                     if '.' in param and param in param_list: 
    1343                         # Ensure polydispersity results are displayed 
    1344                         p1, p2 = param.split('.') 
    1345                         if not model.is_fittable(p1) and not (p2 == 'width' and param in res.param_list)\ 
    1346                             and param in param_list: 
    1347                             param_list.remove(param) 
    1348                     elif not model.is_fittable(param) and \ 
     1342                    if not model.is_fittable(param) and \ 
    13491343                        param in param_list: 
    13501344                        param_list.remove(param) 
     
    13671361                    batch_outputs["Chi2"].append(ERROR) 
    13681362                    for param in param_list: 
    1369                         # Save value of  fixed parameters 
     1363                        # save value of  fixed parameters 
    13701364                        if param not in res.param_list: 
    13711365                            batch_outputs[str(param)].append(ERROR) 
    13721366                        else: 
    1373                             # Save only fitted values 
     1367                            #save only fitted values 
    13741368                            batch_outputs[param].append(ERROR) 
    13751369                            batch_inputs["error on %s" % str(param)].append(ERROR) 
     
    17481742            @param unsmeared_error: data error, rescaled to unsmeared model 
    17491743        """ 
    1750  
    17511744        number_finite = np.count_nonzero(np.isfinite(y)) 
    17521745        np.nan_to_num(y) 
     
    17541747                                         data_description=model.name, 
    17551748                                         data_id=str(page_id) + " " + data.name) 
     1749        plots_to_update = [] # List of plottables that have changed since last calculation 
     1750        # Create the new theories 
    17561751        if unsmeared_model is not None: 
    1757             self.create_theory_1D(x, unsmeared_model, page_id, model, data, state, 
     1752            unsmeared_model_plot = self.create_theory_1D(x, unsmeared_model,  
     1753                                  page_id, model, data, state, 
    17581754                                  data_description=model.name + " unsmeared", 
    17591755                                  data_id=str(page_id) + " " + data.name + " unsmeared") 
     1756            plots_to_update.append(unsmeared_model_plot) 
    17601757 
    17611758            if unsmeared_data is not None and unsmeared_error is not None: 
    1762                 self.create_theory_1D(x, unsmeared_data, page_id, model, data, state, 
     1759                unsmeared_data_plot = self.create_theory_1D(x, unsmeared_data,  
     1760                                      page_id, model, data, state, 
    17631761                                      data_description="Data unsmeared", 
    17641762                                      data_id="Data  " + data.name + " unsmeared", 
    17651763                                      dy=unsmeared_error) 
    1766         # Comment this out until we can get P*S models with correctly populated parameters 
    1767         #if sq_model is not None and pq_model is not None: 
    1768         #    self.create_theory_1D(x, sq_model, page_id, model, data, state, 
    1769         #                          data_description=model.name + " S(q)", 
    1770         #                          data_id=str(page_id) + " " + data.name + " S(q)") 
    1771         #    self.create_theory_1D(x, pq_model, page_id, model, data, state, 
    1772         #                          data_description=model.name + " P(q)", 
    1773         #                          data_id=str(page_id) + " " + data.name + " P(q)") 
     1764                plots_to_update.append(unsmeared_data_plot) 
     1765        if sq_model is not None and pq_model is not None: 
     1766            sq_id = str(page_id) + " " + data.name + " S(q)" 
     1767            sq_plot = self.create_theory_1D(x, sq_model, page_id, model, data, state, 
     1768                                  data_description=model.name + " S(q)", 
     1769                                  data_id=sq_id) 
     1770            plots_to_update.append(sq_plot) 
     1771            pq_id = str(page_id) + " " + data.name + " P(q)" 
     1772            pq_plot = self.create_theory_1D(x, pq_model, page_id, model, data, state, 
     1773                                  data_description=model.name + " P(q)", 
     1774                                  data_id=pq_id) 
     1775            plots_to_update.append(pq_plot) 
     1776        # Update the P(Q), S(Q) and unsmeared theory plots if they exist 
     1777        wx.PostEvent(self.parent, NewPlotEvent(plots=plots_to_update,  
     1778                                              action='update')) 
    17741779 
    17751780        current_pg = self.fit_panel.get_page_by_id(page_id) 
Note: See TracChangeset for help on using the changeset viewer.