- Timestamp:
- Apr 7, 2008 6:31:09 PM (17 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:
- 8742751
- Parents:
- fcaada5
- Location:
- guitools
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
guitools/PropertyDialog.py
re2914b1 r5789654 26 26 iy += 1 27 27 ix = 1 28 self.xvalue = wx.ComboBox(panel, -1 , size=(60, -1))28 self.xvalue = wx.ComboBox(panel, -1) 29 29 sizer.Add(self.xvalue,(iy,ix)) 30 30 ix +=2 31 self.yvalue = wx.ComboBox(panel, -1 , size=(60, -1))31 self.yvalue = wx.ComboBox(panel, -1) 32 32 sizer.Add( self.yvalue,(iy, ix)) 33 33 ix +=2 … … 53 53 self.yvalue.Insert("Log(y)",1) 54 54 self.yvalue.Insert("y^(2)",2) 55 self.yvalue.Insert("1/y",3) 56 self.yvalue.Insert("1/sqrt(y)",4) 57 self.yvalue.Insert("Log(y*x)",5) 58 self.yvalue.Insert("Log(y*x^(2))",6) 55 59 56 60 panel.SetSizer(sizer) -
guitools/fitDialog.py
r1bde57a r5789654 89 89 # new data for the fit 90 90 self.file_data1 = Theory1D(x=[], y=[], dy=None) 91 self.file_data1.name = " y= exp(A + bx**2)"91 self.file_data1.name = "Fit" 92 92 93 93 def _onFit(self ,event): … … 95 95 print "we are on fit" 96 96 temp =[] 97 tempdx =[]98 tempdy =[]99 97 xmin = self._checkVal(self.tcXmin.GetValue()) 100 98 xmax = self._checkVal(self.tcXmax.GetValue()) 101 #x= self.plottable.view.x 102 x=self.plottable.returnXvalueOfView() 103 print "x value :" ,x 99 100 #store the values of View in x,y, dx,dy 101 x,y,dx,dy=self.plottable.returnValuesOfView() 102 104 103 if x != []: 105 104 if xmin !=None and xmax != None: … … 107 106 if x[j]>xmin and x[j]<xmax: 108 107 temp.append(self.model.run(x[j])) 109 #tempdx.append(math.sqrt(x[j]))108 110 109 for y_i in temp: 111 110 tempdy.append(math.sqrt(y_i)) … … 114 113 for x_i in x: 115 114 temp.append(self.model.run(x_i)) 116 tempdx.append(math.sqrt(x_i)) 117 for y_i in temp: 118 tempdy.append(math.sqrt(y_i)) 115 119 116 self.tcXmin.SetValue(str(min(x))) 120 117 self.tcXmax.SetValue(str(max(x))) … … 124 121 self.file_data1.x =x 125 122 self.file_data1.y =temp 126 #self.file_data1.dx=tempdx123 127 124 self.file_data1.dx=None 128 #self.file_data1.dy=tempdy129 125 self.file_data1.dy=None 130 126 self.file_data1.reset_view() 131 127 132 128 # Display the fittings values … … 136 132 cstB = fittings.Parameter(self.model, 'B', default_B) 137 133 chisqr, out, cov = fittings.sansfit(self.model, 138 [cstA, cstB], self.plottable.view.x, 139 self.plottable.view.y, self.plottable.view.dy,xmin,xmax) 140 # Create new data plottable with result 134 [cstA, cstB],x, y,dy,min(x),max(x)) 141 135 142 self.file_data1.y = [] 143 #for x_i in self.file_data1.x: 144 for x_i in self.file_data1.x: 145 self.file_data1.y.append(self.model.run(x_i)) 146 147 self.push_data(self.file_data1) 136 137 #Check that cov and out are iterable before displaying them 148 138 if cov ==None: 149 139 errA =str(0.0) … … 158 148 cstA=str(out[0]) 159 149 cstB=str(out[1]) 150 151 self.model.setParam('A', float(cstA)) 152 self.model.setParam('B', float(cstB)) 153 # Create new data plottable with result 154 self.file_data1.y = [] 155 156 for x_i in x: 157 self.file_data1.y.append(self.model.run(x_i)) 158 #Send the data to display to the PlotPanel 159 self.file_data1.reset_view() 160 self.push_data(self.file_data1) 161 # Display the fitting value on the Fit Dialog 160 162 self._onsetValues(cstA, cstB, errA,errB,str(chisqr)) 161 163 -
guitools/plottables.py
rf63f5ff r5789654 174 174 if plottable in self.plottables: 175 175 del self.plottables[plottable] 176 if self.color > 0: 177 self.color = self.color -1 178 else: 179 self.color =0 176 180 177 181 def reset(self): … … 312 316 self._yaxis = name 313 317 self._yunit = units 318 def get_xaxis(self): 319 return self._xaxis, self._xunit 320 def get_yaxis(self): 321 return self._yaxis, self._yunit 314 322 315 323 @classmethod … … 336 344 def __init__(self): 337 345 self.view = View() 346 self._xaxis = "" 347 self._xunit = "" 348 self._yaxis = "" 349 self._yunit = "" 350 338 351 def set_View(self,x,y): 339 352 """ Load View """ … … 345 358 """ Reload view with new value to plot""" 346 359 self.view = self.View(self.x, self.y, self.dx, self.dy) 347 print "the value of view x",self.view.x 348 print "the value of view y",self.view.y 360 349 361 350 362 … … 379 391 self.view.transform_y(func, errfunc, self.y, self.dy) 380 392 381 def return XvalueOfView(self):393 def returnValuesOfView(self): 382 394 return self.view.returnXview() 383 395 … … 449 461 450 462 def returnXview(self): 451 return self.x 463 return self.x,self.y,self.dx,self.dy 464 452 465 453 466 class Data1D(Plottable): … … 468 481 self.dx = dx 469 482 self.dy = dy 470 483 self.xaxis( 'q', 'A') 484 self.yaxis( 'intensity', 'cm') 471 485 self.view = self.View(self.x, self.y, self.dx, self.dy) 472 486 … … 497 511 The title is the name that will show up on the legend. 498 512 """ 513 self.name= "theo" 499 514 self.x = x 500 515 self.y = y 501 516 self.dy = dy 502 #Alina:added517 503 518 self.view = self.View(self.x, self.y, None, self.dy) 504 519 def render(self,plot,**kw): … … 508 523 def changed(self): 509 524 return False 510 525 @classmethod 526 def labels(cls, collection): 527 """Build a label mostly unique within a collection""" 528 map = {} 529 for item in collection: 530 #map[item] = label(item, collection) 531 map[item] = r"$\rm{%s}$" % item.name 532 return map 533 511 534 512 535 -
guitools/requirements.txt
rfcaada5 r5789654 3 3 1- [DONE] After fitting, the fit panel is not updated with the output values of the fit. 4 4 5 2- Do this:5 2- [DONE] Do this: 6 6 a) load the file line_in_x2_y.txt 7 7 b) fit a straight line, close the Fit Dialog … … 9 9 You will see an exception that should be fixed. 10 10 11 3- [DONE] Load the file line_in_x2_y.txt in miniView. Select x^2 and y for the scales. Fit it.11 3- [DONE] Load the file line_in_x2_y.txt in miniView. Select x^2 and y for the scales. Fit it. 12 12 a) The fit range is wrong, it's not update for the X^2 view. 13 13 b) the fit result is wrong 14 14 c) Even if you update the range, the fit and the plots are wrong. 15 15 16 4- At the python command prompt, try:16 4- [DONE]At the python command prompt, try: 17 17 from sans.guitools.PlotPanel import PlotPanel 18 18 … … 21 21 Guitools should not depend on your miniView code. 22 22 23 5- Each time you open and close the Fit Dialog, a new label "Theory1D" is created in the23 5- [QUESTION] Each time you open and close the Fit Dialog, a new label "Theory1D" is created in the 24 24 legend. There should always be only one, for the _last_ fit, and the name should be "Fit". 25 [alina] is it fine if I delete the fit line from the graph 26 and remove it when I close the Fit Dialog window? 25 27 26 6- Do this:28 6-[QUESTION ] Do this: 27 29 a) Load the file 'line_in_logy_x.txt' 28 30 b) Fit a straight line 29 31 c) The fit shown does not start from the first point and it's not a straight line. 32 [ALINA] then for transformation to log Do I have to transform x to log and set x linear? 30 33 31 34 - NOTES that might help for bugs … … 34 37 the axis is in log will NOT be a straight line 35 38 3- Make sure that you are filling the View of the fit result correctly. 36 39 [ALINA] not using the log of matplotlib anymore but the axis are never in the log scale by the value are in log10 x 37 40 38 41 - NEEDED IMPROVEMENTS 39 1- After loading a new file or changing the scale using the "Properties" menu, remove any previously displayed fit from the graph.42 1-[DONE] After loading a new file or changing the scale using the "Properties" menu, remove any previously displayed fit from the graph. 40 43 41 44 2- There are additional y scales we need: y, y^2, log(y), 1/y, 1/sqrt(y), log(y * x), log(y * x^2)
Note: See TracChangeset
for help on using the changeset viewer.