Changeset 804fefa in sasview
- Timestamp:
- Oct 5, 2016 11:03:32 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:
- 6a0c75d1
- Parents:
- c807957
- Location:
- src/sas/sasgui/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/fitting.py
rc807957 r804fefa 1666 1666 1667 1667 def create_theory_1D(self, x, y, page_id, model, data, state, 1668 data_description, data_id ):1668 data_description, data_id, dy=None): 1669 1669 """ 1670 1670 Create a theory object associate with an existing Data1D … … 1680 1680 """ 1681 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 1682 new_plot.is_data = dy is not None 1683 new_plot.interactive = True 1684 new_plot.dy = dy 1685 new_plot.dx = None 1686 new_plot.dxl = None 1687 new_plot.dxw = None 1688 # If this is a theory curve, pick the proper symbol to make it a curve 1689 if not new_plot.is_data: 1690 new_plot.symbol = GUIFRAME_ID.CURVE_SYMBOL_NUM 1685 1691 _yaxis, _yunit = data.get_yaxis() 1686 1692 _xaxis, _xunit = data.get_xaxis() 1687 1693 new_plot.title = data.name 1688 1689 1694 new_plot.group_id = data.group_id 1690 1695 if new_plot.group_id == None: … … 1713 1718 toggle_mode_on=False, state=None, 1714 1719 data=None, update_chisqr=True, 1715 source='model', plot_result=True, unsmeared_model=None): 1720 source='model', plot_result=True, 1721 unsmeared_model=None, unsmeared_data=None, 1722 unsmeared_error=None): 1716 1723 """ 1717 1724 Complete plotting 1D data 1718 1725 @param unsmeared_model: fit model, without smearing 1726 @param unsmeared_data: data, rescaled to unsmeared model 1719 1727 """ 1720 1728 try: … … 1724 1732 data_id=str(page_id) + " " + data.name) 1725 1733 if unsmeared_model is not None: 1734 logging.error(str(unsmeared_error)) 1726 1735 self.create_theory_1D(x, unsmeared_model, page_id, model, data, state, 1727 1736 data_description=model.name + " unsmeared", 1728 1737 data_id=str(page_id) + " " + data.name + " unsmeared") 1738 1739 self.create_theory_1D(x, unsmeared_data, page_id, model, data, state, 1740 data_description="Data unsmeared", 1741 data_id="Data " + data.name + " unsmeared", 1742 dy=unsmeared_error) 1729 1743 1730 1744 current_pg = self.fit_panel.get_page_by_id(page_id) -
src/sas/sasgui/perspectives/fitting/model_thread.py
rc807957 r804fefa 167 167 168 168 # If we use a smearer, also return the unsmeared model 169 output_unsmeared = None 169 unsmeared_output = None 170 unsmeared_data = None 171 unsmeared_error = None 170 172 ##smearer the ouput of the plot 171 173 if self.smearer is not None: … … 173 175 self.qmax) 174 176 mask = self.data.x[first_bin:last_bin+1] 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] 177 unsmeared_output = numpy.zeros((len(self.data.x))) 178 unsmeared_output[first_bin:last_bin+1] = self.model.evalDistribution(mask) 179 output = self.smearer(unsmeared_output, first_bin, last_bin) 180 181 # Rescale data to unsmeared model 182 unsmeared_data = numpy.zeros((len(self.data.x))) 183 unsmeared_error = numpy.zeros((len(self.data.x))) 184 unsmeared_data[first_bin:last_bin+1] = self.data.y[first_bin:last_bin+1]\ 185 * unsmeared_output[first_bin:last_bin+1]\ 186 / output[first_bin:last_bin+1] 187 unsmeared_error[first_bin:last_bin+1] = self.data.dy[first_bin:last_bin+1]\ 188 * unsmeared_output[first_bin:last_bin+1]\ 189 / output[first_bin:last_bin+1] 190 unsmeared_output=unsmeared_output[index] 191 unsmeared_data=unsmeared_data[index] 192 unsmeared_error=unsmeared_error 179 193 else: 180 194 output[index] = self.model.evalDistribution(self.data.x[index]) … … 192 206 update_chisqr=self.update_chisqr, 193 207 source=self.source, 194 unsmeared_model=output_unsmeared) 208 unsmeared_model=unsmeared_output, 209 unsmeared_data=unsmeared_data, 210 unsmeared_error=unsmeared_error) 195 211 196 212 def results(self):
Note: See TracChangeset
for help on using the changeset viewer.