Changeset 69363c7 in sasview for src/sas/sasgui/perspectives/fitting/fitting.py
- Timestamp:
- Sep 22, 2017 8:29:48 AM (7 years ago)
- 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:
- ab0b93f
- Parents:
- 1386b2f (diff), d76c43a (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. - git-author:
- Paul Kienzle <pkienzle@…> (09/22/17 08:28:48)
- git-committer:
- Paul Kienzle <pkienzle@…> (09/22/17 08:29:48)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/fitting.py
r277257f r69363c7 262 262 toks = os.path.splitext(label) 263 263 path = os.path.join(models.find_plugins_dir(), toks[0]) 264 message = "Are you sure you want to delete the file {}?".format(path) 265 dlg = wx.MessageDialog(self.frame, message, '', wx.YES_NO | wx.ICON_QUESTION) 266 if not dlg.ShowModal() == wx.ID_YES: 267 return 264 268 try: 265 269 for ext in ['.py', '.pyc']: 266 270 p_path = path + ext 271 if ext == '.pyc' and not os.path.isfile(path + ext): 272 # If model is invalid, .pyc file may not exist as model has 273 # never been compiled. Don't try and delete it 274 continue 267 275 os.remove(p_path) 268 276 self.update_custom_combo() … … 360 368 if model and new_model != model: 361 369 page._on_select_model(keep_pars=True) 370 if hasattr(page, 'structurebox'): 371 selected_name = page.structurebox.GetStringSelection() 372 373 page.structurebox.Clear() 374 page.initialize_combox() 375 376 index = page.structurebox.FindString(selected_name) 377 if index == -1: 378 index = 0 379 page.structurebox.SetSelection(index) 380 page._on_select_model() 362 381 except Exception: 363 382 logger.error("update_custom_combo: %s", sys.exc_value) … … 1329 1348 1330 1349 is_data2d = issubclass(data.__class__, Data2D) 1331 # check consistency of arrays1350 # Check consistency of arrays 1332 1351 if not is_data2d: 1333 1352 if len(res.theory) == len(res.index[res.index]) and \ … … 1340 1359 new_theory[res.index == False] = np.nan 1341 1360 correct_result = True 1342 # get all fittable parameters of the current model1361 # Get all fittable parameters of the current model 1343 1362 param_list = model.getParamList() 1344 1363 for param in model.getDispParamList(): 1345 if not model.is_fittable(param) and \ 1364 if '.' in param and param in param_list: 1365 # Ensure polydispersity results are displayed 1366 p1, p2 = param.split('.') 1367 if not model.is_fittable(p1) and not (p2 == 'width' and param in res.param_list)\ 1368 and param in param_list: 1369 param_list.remove(param) 1370 elif not model.is_fittable(param) and \ 1346 1371 param in param_list: 1347 1372 param_list.remove(param) … … 1364 1389 batch_outputs["Chi2"].append(ERROR) 1365 1390 for param in param_list: 1366 # save value of fixed parameters1391 # Save value of fixed parameters 1367 1392 if param not in res.param_list: 1368 1393 batch_outputs[str(param)].append(ERROR) 1369 1394 else: 1370 # save only fitted values1395 # Save only fitted values 1371 1396 batch_outputs[param].append(ERROR) 1372 1397 batch_inputs["error on %s" % str(param)].append(ERROR) … … 1744 1769 @param unsmeared_error: data error, rescaled to unsmeared model 1745 1770 """ 1746 1771 <<<<<<< HEAD 1772 1773 ======= 1774 >>>>>>> master 1747 1775 number_finite = np.count_nonzero(np.isfinite(y)) 1748 1776 np.nan_to_num(y) … … 1750 1778 data_description=model.name, 1751 1779 data_id=str(page_id) + " " + data.name) 1780 plots_to_update = [] # List of plottables that have changed since last calculation 1781 # Create the new theories 1752 1782 if unsmeared_model is not None: 1753 self.create_theory_1D(x, unsmeared_model, page_id, model, data, state, 1783 unsmeared_model_plot = self.create_theory_1D(x, unsmeared_model, 1784 page_id, model, data, state, 1754 1785 data_description=model.name + " unsmeared", 1755 1786 data_id=str(page_id) + " " + data.name + " unsmeared") 1787 plots_to_update.append(unsmeared_model_plot) 1756 1788 1757 1789 if unsmeared_data is not None and unsmeared_error is not None: 1758 self.create_theory_1D(x, unsmeared_data, page_id, model, data, state, 1790 unsmeared_data_plot = self.create_theory_1D(x, unsmeared_data, 1791 page_id, model, data, state, 1759 1792 data_description="Data unsmeared", 1760 1793 data_id="Data " + data.name + " unsmeared", 1761 1794 dy=unsmeared_error) 1762 # Comment this out until we can get P*S models with correctly populated parameters 1763 #if sq_model is not None and pq_model is not None: 1764 # self.create_theory_1D(x, sq_model, page_id, model, data, state, 1765 # data_description=model.name + " S(q)", 1766 # data_id=str(page_id) + " " + data.name + " S(q)") 1767 # self.create_theory_1D(x, pq_model, page_id, model, data, state, 1768 # data_description=model.name + " P(q)", 1769 # data_id=str(page_id) + " " + data.name + " P(q)") 1795 plots_to_update.append(unsmeared_data_plot) 1796 if sq_model is not None and pq_model is not None: 1797 sq_id = str(page_id) + " " + data.name + " S(q)" 1798 sq_plot = self.create_theory_1D(x, sq_model, page_id, model, data, state, 1799 data_description=model.name + " S(q)", 1800 data_id=sq_id) 1801 plots_to_update.append(sq_plot) 1802 pq_id = str(page_id) + " " + data.name + " P(q)" 1803 pq_plot = self.create_theory_1D(x, pq_model, page_id, model, data, state, 1804 data_description=model.name + " P(q)", 1805 data_id=pq_id) 1806 plots_to_update.append(pq_plot) 1807 # Update the P(Q), S(Q) and unsmeared theory plots if they exist 1808 wx.PostEvent(self.parent, NewPlotEvent(plots=plots_to_update, 1809 action='update')) 1770 1810 1771 1811 current_pg = self.fit_panel.get_page_by_id(page_id)
Note: See TracChangeset
for help on using the changeset viewer.