Changeset d902cf0 in sasview for sansview/perspectives
- Timestamp:
- Apr 21, 2009 1:25:24 PM (16 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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 2501cf7
- Parents:
- 70cf5d3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitting.py
r513115c rd902cf0 167 167 self.graph=graph 168 168 for item in graph.plottables: 169 if hasattr(item,"is_data"):170 if item.is_data== False:171 return []172 173 169 if item.__class__.__name__ is "Data2D": 170 if hasattr(item,"is_data"): 171 if item.is_data: 172 return [["Select data for Fitting", \ 173 "Dialog with fitting parameters ", self._onSelect]] 174 else: 175 return [] 174 176 return [["Select data for Fitting",\ 175 177 "Dialog with fitting parameters ", self._onSelect]] 176 178 else: 177 178 179 if item.name==graph.selected_plottable : 179 if not hasattr(item, "group_id"): 180 return [] 181 return [["Select data for Fitting", \ 182 "Dialog with fitting parameters ", self._onSelect]] 180 if hasattr(item, "group_id"): 181 if hasattr(item,"is_data"): 182 if item.is_data: 183 return [["Select data for Fitting", \ 184 "Dialog with fitting parameters ", self._onSelect]] 185 else: 186 return [] 187 else: 188 return [["Select data for Fitting", \ 189 "Dialog with fitting parameters ", self._onSelect]] 183 190 return [] 184 191 … … 234 241 235 242 236 def copy_data(self, item, dy ):243 def copy_data(self, item, dy=None): 237 244 """ 238 245 receive a data 1D and the list of errors on dy … … 260 267 261 268 from sans.guiframe import dataFitting 262 263 269 data= dataFitting.Data1D(x=item.x, y=item.y, dy=dy, dxl=dxl, dxw=dxw) 264 270 … … 273 279 ## to save data 1D as cansas xml file 274 280 data.info= info 275 is_data=False276 if hasattr(item, "is_data"):277 is_data= item.is_data278 data.is_data = is_data279 281 ## If the data file does not tell us what the axes are, just assume... 280 282 data.xaxis(copy.deepcopy(item._xaxis),copy.deepcopy(item._xunit)) … … 583 585 584 586 if plottable.name == self.panel.graph.selected_plottable: 585 if not hasattr(plottable, "is_data")or \ 586 plottable.__class__.__name__=="Theory1D": 587 #if not hasattr(plottable, "is_data"): 588 589 if plottable.__class__.__name__=="Theory1D": 587 590 dy=numpy.zeros(len(plottable.y)) 588 591 if hasattr(plottable, "dy"): 589 592 dy= copy.deepcopy(plottable.dy) 593 590 594 item= self.copy_data(plottable, dy) 591 595 item.group_id += "data1D" … … 595 599 wx.PostEvent(self.parent, NewPlotEvent(plot=item, title=str(title))) 596 600 else: 597 item= copy.deepcopy(plottable) 601 item= self.copy_data(plottable, plottable.dy) 602 item.is_data=True 603 598 604 ## put the errors values back to the model if the errors were hiden 599 605 ## before sending them to the fit engine … … 602 608 dy= self.err_dy[item.name] 603 609 data= self.copy_data(item, dy) 610 data.is_data= item.is_data 604 611 else: 605 data= copy.deepcopy(item) 612 data= self.copy_data(item) 613 data.is_data= item.is_data 614 615 606 616 else: 607 617 if item.dy==None: 608 618 dy= numpy.zeros(len(item.y)) 609 619 data= self.copy_data(item, dy) 620 data.is_data=item.is_data 610 621 else: 611 data= copy.deepcopy(item) 622 data= self.copy_data(item) 623 data.is_data=item.is_data 624 612 625 else: 613 626 ## Data2D case … … 624 637 item= copy.deepcopy(plottable ) 625 638 data= copy.deepcopy(plottable ) 639 item.is_data=True 640 data.is_data=True 626 641 ## create anew page 627 642 if item.name == self.panel.graph.selected_plottable or\ … … 643 658 wx.PostEvent(self.parent, StatusEvent(status="Page was already Created")) 644 659 except: 645 wx.PostEvent(self.parent, StatusEvent(status="Creating Fit page: %s"\ 646 %sys.exc_value)) 647 return 660 raise 661 #wx.PostEvent(self.parent, StatusEvent(status="Creating Fit page: %s"\ 662 #%sys.exc_value)) 663 #return 648 664 def _updateFit(self): 649 665 """ … … 667 683 668 684 try: 685 if numpy.any(result.pvec ==None )or not numpy.all(numpy.isfinite(result.pvec) ): 686 msg= "Fitting did not converge!!!" 687 wx.PostEvent(self.parent, StatusEvent(status=msg,type="stop")) 688 return 669 689 for page, value in self.page_finder.iteritems(): 670 690 if page==cpage : … … 972 992 new_plot.id += "Model" 973 993 new_plot.is_data =False 974 # Pass the reset flag to let the plotting event handler 975 # know that we are replacing the whole plot 994 976 995 from DataLoader.data_info import Data1D 977 996 info= Data1D(x= new_plot.x, y=new_plot.y) … … 981 1000 info.yaxis( new_plot._yaxis, new_plot._yunit) 982 1001 new_plot.info = info 1002 # Pass the reset flag to let the plotting event handler 1003 # know that we are replacing the whole plot 983 1004 if title== None: 984 1005 title = "Analytical model 1D "
Note: See TracChangeset
for help on using the changeset viewer.