Changeset 60d6c23 in sasview
- Timestamp:
- Apr 13, 2009 4:28:17 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:
- 5fe5871c
- Parents:
- b86c920
- Location:
- sansview/perspectives/fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
r45ed4dad r60d6c23 380 380 return 381 381 382 382 383 def read_file(self, path): 383 384 """ -
sansview/perspectives/fitting/fitpage.py
r45bf0ede r60d6c23 536 536 self.qmax_x = float(self.qmax.GetValue()) 537 537 # return residuals within self.qmin_x and self.qmax_x 538 x,y,dy = [numpy.asarray(v) for v in (self.data.x,self.data.y,self.data.dy)] 538 x,y = [numpy.asarray(v) for v in (self.data.x,self.data.y)] 539 540 if self.data.dy==None: 541 dy= numpy.zeros(len(y)) 542 else: 543 dy= numpy.asarray(self.data.dy) 544 dy[dy==0]=1 539 545 if self.qmin_x==None and self.qmax_x==None: 540 546 fx =numpy.asarray([self.model.run(v) for v in x]) -
sansview/perspectives/fitting/fitting.py
r7c845cb r60d6c23 232 232 detector=None 233 233 source=None 234 info = None 235 id=None 234 236 dxl=None 235 237 dxw=None … … 242 244 if hasattr(item, "source"): 243 245 source =item.source 246 if hasattr(item ,"info"): 247 info= item.info 248 if hasattr(item,"id"): 249 id = item.id 244 250 from sans.guiframe import dataFitting 245 data= dataFitting.Data1D(x=item.x, y=item.y, dy=dy, dxl=dxl, dxw=dxw) 246 data.name=item.name 247 data.detector=detector 248 data.source= source 251 if item.__class__.__name__=="Data1D": 252 data= dataFitting.Data1D(x=item.x, y=item.y, dy=dy, dxl=dxl, dxw=dxw) 253 else: 254 data= dataFitting.Theory1D(x=item.x, y=item.y, dxl=dxl, dxw=dxw) 255 data.name = item.name 256 data.detector = detector 257 data.source = source 258 ## allow to highlight data when plotted 259 data.interactive = item.interactive 260 ## when 2 data have the same id override the 1 st plotted 261 data.id = id 262 ## info is a reference to output of dataloader that can be used 263 ## to save data 1D as cansas xml file 264 data.info= info 265 ## If the data file does not tell us what the axes are, just assume... 266 data.xaxis(item._xaxis,item._xunit) 267 data.yaxis(item._yaxis,item._yunit) 268 ##group_id specify on which panel to plot this data 269 data.group_id = item.group_id 249 270 return data 250 271 … … 518 539 new_model.parameterset[ param_name].set( param_value ) 519 540 520 521 541 #Do the single fit 522 542 self.fitter.set_model(new_model, self.fit_id, pars) 523 dy=[] 524 x=[] 525 y=[] 526 ## checking the validity of error 527 if metadata.__class__ in ["Data1D","Theory1D"]: 528 for i in range(len(metadata.dy)): 529 if metadata.dy[i] !=0: 530 dy.append(metadata.dy[i]) 531 x.append(metadata.x[i]) 532 y.append(metadata.y[i]) 533 if len(dy)>0: 534 metadata.dy=numpy.zeros(len(dy)) 535 metadata.dy=dy 536 metadata.y=numpy.zeros(len(y)) 537 metadata.y=y 538 metadata.x=numpy.zeros(len(x)) 539 metadata.x=x 540 543 541 544 self.fitter.set_data(data=metadata,Uid=self.fit_id, 542 545 smearer=smearer,qmin= qmin,qmax=qmax ) … … 544 547 self.fitter.select_problem_for_fit(Uid= self.fit_id, 545 548 value= value.get_scheduled()) 546 549 value.clear_model_param() 547 550 except: 548 551 msg= title +" error: %s" % sys.exc_value … … 878 881 if hasattr(data, "group_id"): 879 882 my_info.group_id= data.group_id 880 883 881 884 return my_info 882 885 … … 886 889 """ 887 890 try: 891 888 892 new_plot = Theory1D(x=x, y=y) 889 893 my_info = self._get_plotting_info( data) … … 894 898 new_plot.xaxis( my_info._xaxis, my_info._xunit) 895 899 new_plot.yaxis( my_info._yaxis, my_info._yunit) 896 900 if data!=None: 901 if new_plot.id == data.id: 902 new_plot.id += "Model" 903 897 904 # Pass the reset flag to let the plotting event handler 898 905 # know that we are replacing the whole plot
Note: See TracChangeset
for help on using the changeset viewer.