Changeset c807957 in sasview for src/sas/sasgui/perspectives/fitting
- Timestamp:
- Oct 5, 2016 11:28:25 AM (8 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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 804fefa
- Parents:
- c65a265
- Location:
- src/sas/sasgui/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/fitting.py
r7673ecd rc807957 313 313 """ 314 314 event_id = event.GetId() 315 self.update_custom_combo() 315 self.update_custom_combo() 316 316 317 317 def update_custom_combo(self): … … 342 342 page.formfactorbox.SetLabel(current_val) 343 343 except: 344 pass 345 344 logging.error("update_custom_combo: %s", sys.exc_value) 346 345 347 346 def set_edit_menu(self, owner): … … 1666 1665 wx.PostEvent(self.parent, StatusEvent(status=msg, type="update")) 1667 1666 1667 def create_theory_1D(self, x, y, page_id, model, data, state, 1668 data_description, data_id): 1669 """ 1670 Create a theory object associate with an existing Data1D 1671 and add it to the data manager. 1672 @param x: x-values of the data 1673 @param y: y_values of the data 1674 @param page_id: fit page ID 1675 @param model: model used for fitting 1676 @param data: Data1D object to create the theory for 1677 @param state: model state 1678 @param data_description: title to use in the data manager 1679 @param data_id: unique data ID 1680 """ 1681 new_plot = Data1D(x=x, y=y) 1682 new_plot.is_data = False 1683 new_plot.dy = numpy.zeros(len(y)) 1684 new_plot.symbol = GUIFRAME_ID.CURVE_SYMBOL_NUM 1685 _yaxis, _yunit = data.get_yaxis() 1686 _xaxis, _xunit = data.get_xaxis() 1687 new_plot.title = data.name 1688 1689 new_plot.group_id = data.group_id 1690 if new_plot.group_id == None: 1691 new_plot.group_id = data.group_id 1692 new_plot.id = data_id 1693 # Find if this theory was already plotted and replace that plot given 1694 # the same id 1695 self.page_finder[page_id].get_theory_data(fid=data.id) 1696 1697 if data.is_data: 1698 data_name = str(data.name) 1699 else: 1700 data_name = str(model.__class__.__name__) 1701 1702 new_plot.name = data_description + " [" + data_name + "]" 1703 new_plot.xaxis(_xaxis, _xunit) 1704 new_plot.yaxis(_yaxis, _yunit) 1705 self.page_finder[page_id].set_theory_data(data=new_plot, 1706 fid=data.id) 1707 self.parent.update_theory(data_id=data.id, theory=new_plot, 1708 state=state) 1709 return new_plot 1710 1668 1711 def _complete1D(self, x, y, page_id, elapsed, index, model, 1669 1712 weight=None, fid=None, 1670 1713 toggle_mode_on=False, state=None, 1671 1714 data=None, update_chisqr=True, 1672 source='model', plot_result=True): 1673 """ 1674 Complete plotting 1D data 1715 source='model', plot_result=True, unsmeared_model=None): 1716 """ 1717 Complete plotting 1D data 1718 @param unsmeared_model: fit model, without smearing 1675 1719 """ 1676 1720 try: 1677 1721 numpy.nan_to_num(y) 1678 1679 new_plot = Data1D(x=x, y=y) 1680 new_plot.is_data = False 1681 new_plot.dy = numpy.zeros(len(y)) 1682 new_plot.symbol = GUIFRAME_ID.CURVE_SYMBOL_NUM 1683 _yaxis, _yunit = data.get_yaxis() 1684 _xaxis, _xunit = data.get_xaxis() 1685 new_plot.title = data.name 1686 1687 new_plot.group_id = data.group_id 1688 if new_plot.group_id == None: 1689 new_plot.group_id = data.group_id 1690 new_plot.id = str(page_id) + " " + data.name 1691 #if new_plot.id in self.color_dict: 1692 # new_plot.custom_color = self.color_dict[new_plot.id] 1693 #find if this theory was already plotted and replace that plot given 1694 #the same id 1695 self.page_finder[page_id].get_theory_data(fid=data.id) 1696 1697 if data.is_data: 1698 data_name = str(data.name) 1699 else: 1700 data_name = str(model.__class__.__name__) 1701 1702 new_plot.name = model.name + " [" + data_name + "]" 1703 new_plot.xaxis(_xaxis, _xunit) 1704 new_plot.yaxis(_yaxis, _yunit) 1705 self.page_finder[page_id].set_theory_data(data=new_plot, 1706 fid=data.id) 1707 self.parent.update_theory(data_id=data.id, theory=new_plot, 1708 state=state) 1722 new_plot = self.create_theory_1D(x, y, page_id, model, data, state, 1723 data_description=model.name, 1724 data_id=str(page_id) + " " + data.name) 1725 if unsmeared_model is not None: 1726 self.create_theory_1D(x, unsmeared_model, page_id, model, data, state, 1727 data_description=model.name + " unsmeared", 1728 data_id=str(page_id) + " " + data.name + " unsmeared") 1729 1709 1730 current_pg = self.fit_panel.get_page_by_id(page_id) 1710 1731 title = new_plot.title -
src/sas/sasgui/perspectives/fitting/model_thread.py
r934ce649 rc807957 166 166 index = (self.qmin <= self.data.x) & (self.data.x <= self.qmax) 167 167 168 # If we use a smearer, also return the unsmeared model 169 output_unsmeared = None 168 170 ##smearer the ouput of the plot 169 171 if self.smearer is not None: … … 171 173 self.qmax) 172 174 mask = self.data.x[first_bin:last_bin+1] 173 output[first_bin:last_bin+1] = self.model.evalDistribution(mask) 174 output = self.smearer(output, first_bin, last_bin) 175 output_unsmeared = numpy.zeros((len(self.data.x))) 176 output_unsmeared[first_bin:last_bin+1] = self.model.evalDistribution(mask) 177 output = self.smearer(output_unsmeared, first_bin, last_bin) 178 output_unsmeared = output_unsmeared[index] 175 179 else: 176 180 output[index] = self.model.evalDistribution(self.data.x[index]) … … 187 191 data=self.data, 188 192 update_chisqr=self.update_chisqr, 189 source=self.source) 193 source=self.source, 194 unsmeared_model=output_unsmeared) 190 195 191 196 def results(self):
Note: See TracChangeset
for help on using the changeset viewer.