Changeset 8cebf9b in sasview
- Timestamp:
- Apr 2, 2008 9:34:34 AM (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:
- 2da23bc
- Parents:
- e2914b1
- Location:
- guitools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
guitools/PlotPanel.py
re2914b1 r8cebf9b 364 364 def _onEVT_FUNC_PROPERTY(self): 365 365 """ 366 Receive the scale from myDialog and set the scale 366 Receive the x and y transformation from myDialog,Transforms x and y in View 367 and set the scale 367 368 """ 368 369 list =[] … … 372 373 if self.prevXtrans == "x^(2)": 373 374 item.transform_x( self.fromX2, self.errFuncfromX2 ) 374 #elif self.prevXtrans == "Log(x)" 375 #item.transform_x( self.fromLogXY,self.errFuncfromX2 ) 376 print "Values of x",item.x[0:5] 377 print "Values of view x",item.view.x[0:5] 375 376 item.transform_x( self.toX, self.errFunctoX ) 378 377 self.set_xscale("linear") 379 378 self.graph.xaxis('\\rm{q} ', 'A^{-1}') 380 379 381 380 if ( self.xscales=="x^(2)" ): 382 #if self.prevXtrans == "Log(x)":383 #item.transform_x( self.fromLogXY, self.errFunc )384 381 if self.prevXtrans != "x^(2)": 385 382 item.transform_x( self.toX2, self.errFuncToX2 ) 386 print "Values of x",item.x[0:5] 387 print "Values of view x^(2)",item.view.x[0:5] 383 item.transform_x( self.toX, self.errFunctoX ) 388 384 self.set_xscale('linear') 389 385 self.graph.xaxis('\\rm{q^{2}} ', 'A^{-2}') 390 386 391 387 if (self.xscales=="Log(x)" ): 392 if self.prevXtrans == "x^(2)": 393 item.transform_x( self.fromX2, self.errFuncfromX2 ) 394 #elif self.prevXtrans == "Log(x)": 395 #item.transform_x( self.toLogXY, self.errFunc ) 396 #self.set_xscale("linear") 397 self.set_xscale('log') 398 self.graph.xaxis('\\rm{log(q)} ', 'A^{-1}') 388 #if self.prevXtrans == "x^(2)": 389 # item.transform_x( self.fromX2, self.errFuncfromX2 ) 390 391 # item.transform_x( self.toX, self.errFuncToLogX ) 392 self.set_xscale("log") 393 self.graph.xaxis('\\rm{q} ', 'A^{-1}') 399 394 400 395 if ( self.yscales=="y" ): 401 396 if self.prevYtrans == "y^(2)": 402 397 item.transform_y( self.toX2, self.errFuncToX2 ) 403 #elif self.prevXtrans == "Log(y)" 404 #item.transform_y( self.fromLogXY.errFunc ) 398 item.transform_x( self.toX, self.errFunctoX ) 405 399 self.set_yscale("linear") 406 400 self.graph.yaxis("\\rm{Intensity} ","cm^{-1}") … … 409 403 if self.prevYtrans == "y^(2)": 410 404 item.transform_y( self.fromX2, self.errFuncfromX2 ) 411 #elif self.prevYtrans != "Log(y)": 412 #item.transform_y( self.toLogXY, self.errFunc ) 413 #self.set_yscale("linear") 405 item.transform_x( self.toX, self.errFuncToLogX) 414 406 self.set_yscale("log") 415 407 self.graph.yaxis("\\rm{Intensity} ","cm^{-1}") 416 408 417 409 if ( self.yscales=="y^(2)" ): 418 #if self.prevYtrans == "Log(y)":419 #item.transform_y( self.fromLogXY, self.errFunc )420 410 if self.prevYtrans != "y^(2)": 421 item.transform_y( self.toX2, self.errFuncToX2 ) 411 item.transform_y( self.toX2, self.errFuncToX2 ) 412 item.transform_x( self.toX, self.errFunctoX ) 422 413 self.set_yscale("linear") 423 414 self.graph.yaxis("\\rm{Intensity^{2}} ","cm^{-2}") … … 429 420 self.graph.render(self) 430 421 self.subplot.figure.canvas.draw_idle() 431 422 def errFunctoX(self,x,dx=None): 423 """ 424 calculate error of x**2 425 @param x: float value 426 @param dx: float value 427 """ 428 if dx >=x: 429 return 0.9*x 430 return dx 432 431 def errFuncToX2(self,x,dx=None): 433 432 """ … … 437 436 """ 438 437 if not dx == None: 439 return 2*x*dx 438 err = 2*x*dx 439 if err >= x: 440 err = 0.9*x 441 return err 440 442 else: 441 r aise ValueError, "Can't calculate the error"443 return 0.0 442 444 def errFuncfromX2(self,x,dx=None): 443 445 """ … … 447 449 """ 448 450 if (x > 0) and (dx != None): 449 err= dx/2*math.sqrt(x) 450 451 err = dx/(2*math.sqrt(x)) 452 if err >= x: 453 err = 0.9*x 454 return err 455 elif x==0.0: 456 err = 0.9*x 457 return err 451 458 else: 452 raise ValueError, "Can't calculate the error" 459 return 0.0 460 453 461 def errFuncToLogX(self,x,dx=None): 454 462 """ … … 457 465 @param dx: float value 458 466 """ 459 if (x !=0) and ( dx != None):467 if (x != 0) and ( dx != None): 460 468 err= dx/x 461 469 if err >= x: … … 463 471 return err 464 472 elif x==0: 465 raise ValueError, "On calculate error: Can't divide by zero" 473 err = 0.9*x 474 return err 466 475 else: 467 r aise ValueError, "Can't calculate the error"476 return 0 468 477 469 478 def errFuncfromLogXY(self,x,dx=None): … … 478 487 err = 0.9*x 479 488 return err 489 elif x == 0 : 490 err = 0.9*x 491 return err 492 elif dx == None: 493 return 0 480 494 else: 481 495 raise ValueError, "Can't calculate the error" -
guitools/plottables.py
re2914b1 r8cebf9b 337 337 self.view = View() 338 338 def set_View(self,x,y): 339 """ Load View """ 339 340 self.x= x 340 341 self.y = y 341 342 342 self.reset_view() 343 343 344 344 def reset_view(self): 345 """ Reload view with new value to plot""" 345 346 self.view = self.View(self.x, self.y, self.dx, self.dy) 346 347
Note: See TracChangeset
for help on using the changeset viewer.