Changeset b6972a0f in sasview
- Timestamp:
- May 29, 2008 2:41:04 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:
- ab6098f
- Parents:
- 05da1f89
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guitools/PlotPanel.py
r05da1f89 rb6972a0f 20 20 from plottables import Graph 21 21 #(FuncFitEvent, EVT_FUNC_FIT) = wx.lib.newevent.NewEvent() 22 import math,pylab 22 import math,pylab,re 23 23 24 def show_tree(obj,d=0): 24 25 """Handy function for displaying a tree of graph objects""" … … 26 27 if 'get_children' in dir(obj): 27 28 for a in obj.get_children(): show_tree(a,d+1) 29 30 def convertUnit(pow,unit): 31 """ 32 Displays the unit with the proper convertion 33 @param pow: the user set the power of the unit 34 @param unit: the unit of the data 35 """ 36 toks=re.match("^", unit) 37 if not toks==None: 38 unitValue= re.split("{",unit) 39 unitPower= re.split("}",unitValue[1]) 40 power= int(unitPower[0])*pow 41 word= unitValue[0]+"{"+str(power)+"}" 42 if power==1: 43 tempUnit=re.split("\^",unitValue[0]) 44 unit=tempUnit[0] 45 else: 46 unit = word 47 #print"this is unit",unit 48 return unit 28 49 def _rescale(lo,hi,step,pt=None,bal=None,scale='linear'): 29 50 """ … … 487 508 self.set_xscale("linear") 488 509 name, units = item.get_xaxis() 489 self.graph.xaxis("%s" % name, "%s^{-1}" % units) 510 self.graph.xaxis("%s" % name, "%s" % units) 511 490 512 491 513 if ( self.xLabel=="x^(2)" ): … … 493 515 self.set_xscale('linear') 494 516 name, units = item.get_xaxis() 495 self.graph.xaxis("%s^{2}" % name, "%s^{-2}" % units) 517 units=convertUnit(2,units) 518 self.graph.xaxis("%s^{2}" % name, "%s" % units) 519 496 520 497 521 if (self.xLabel=="log10(x)" ): … … 499 523 self.set_xscale("log") 500 524 name, units = item.get_xaxis() 501 self.graph.xaxis("\log_{10}\ \ (%s)" % name, "%s^{-1}" % units) 525 self.graph.xaxis("\log_{10}\ \ (%s)" % name, "%s" % units) 526 502 527 503 528 if ( self.yLabel=="ln(y)" ): … … 505 530 self.set_yscale("linear") 506 531 name, units = item.get_yaxis() 507 self.graph.yaxis("log\ \ %s" % name, "%s^{-1}" % units) 532 self.graph.yaxis("log\ \ %s" % name, "%s" % units) 533 508 534 509 535 if ( self.yLabel=="y" ): … … 511 537 self.set_yscale("linear") 512 538 name, units = item.get_yaxis() 513 self.graph.yaxis("%s" % name, "%s^{-1}" % units) 539 self.graph.yaxis("%s" % name, "%s" % units) 540 514 541 515 542 if ( self.yLabel=="log10(y)" ): … … 517 544 self.set_yscale("log") 518 545 name, units = item.get_yaxis() 519 self.graph.yaxis("\log_{10}\ \ (%s)" % name, "%s^{-1}" % units) 546 self.graph.yaxis("\log_{10}\ \ (%s)" % name, "%s" % units) 547 520 548 521 549 if ( self.yLabel=="y^(2)" ): … … 523 551 self.set_yscale("linear") 524 552 name, units = item.get_yaxis() 525 self.graph.yaxis("%s^{2}" % name, "%s^{-2}" % units) 553 units=convertUnit(2,units) 554 self.graph.yaxis("%s^{2}" % name, "%s" % units) 555 526 556 527 557 if ( self.yLabel =="1/y"): … … 529 559 self.set_yscale("linear") 530 560 name, units = item.get_yaxis() 531 self.graph.yaxis("1/%s" % name, "\ \%s" % units) 561 units=convertUnit(-1,units) 562 self.graph.yaxis("1/%s" % name, "%s" % units) 532 563 533 564 if ( self.yLabel =="1/sqrt(y)" ): … … 535 566 self.set_yscale("linear") 536 567 name, units = item.get_yaxis() 568 units=convertUnit(-1,units) 537 569 self.graph.yaxis("1/\sqrt{%s}" %name, "%s" % units) 538 570 … … 542 574 yname, yunits = item.get_yaxis() 543 575 xname, xunits = item.get_xaxis() 544 self.graph.yaxis("log\ (%s \ \ %s)" % (yname,xname), "%s^{-1}%s^{-1}" % (yunits,xunits)) 576 self.graph.yaxis("log\ (%s \ \ %s)" % (yname,xname), "%s%s" % (yunits,xunits)) 577 545 578 546 579 if ( self.yLabel =="ln(y*x^(2))"): … … 549 582 yname, yunits = item.get_yaxis() 550 583 xname, xunits = item.get_xaxis() 551 self.graph.yaxis("Log (%s \ \ %s^{2})" % (yname,xname), "%s^{-1}%s^{-2}" % (yunits,xunits)) 584 xunits = convertUnit(2,xunits) 585 self.graph.yaxis("Log (%s \ \ %s)" % (yname,xname), "%s%s" % (yunits,xunits)) 586 552 587 553 588 if ( self.yLabel =="ln(y*x^(4))"): … … 556 591 yname, yunits = item.get_yaxis() 557 592 xname, xunits = item.get_xaxis() 558 self.graph.yaxis("Log (%s \ \ %s^{4})" % (yname,xname), "%s^{-1}%s^{-4}" % (yunits,xunits)) 559 593 xunits = convertUnit(4,xunits) 594 self.graph.yaxis("Log (%s \ \ %s)" % (yname,xname), "%s%s" % (yunits,xunits)) 595 560 596 if ( self.viewModel == "Guinier lny vs x^(2)"): 561 597 … … 563 599 self.set_xscale('linear') 564 600 name, units = item.get_xaxis() 565 self.graph.xaxis("%s^{2}" % name, "%s^{-2}" % units) 601 units = convertUnit(2,units) 602 self.graph.xaxis("%s^{2}" % name, "%s" % units) 603 566 604 567 605 item.transformY(transform.toLogX,transform.errToLogX ) 568 606 self.set_yscale("linear") 569 607 name, units = item.get_yaxis() 570 self.graph.yaxis("$Log %s$" % name, "%s^{-1}" % units) 608 self.graph.yaxis("$Log %s$" % name, "%s" % units) 609 571 610 572 611 item.transformView() 573 612 574 #item.name = self.yLabel+" vs " +self.xLabel613 575 614 self.resetFitView() 576 615 self.prevXtrans = self.xLabel … … 579 618 self.subplot.figure.canvas.draw_idle() 580 619 620 621 581 622 def onFitDisplay(self, tempx,tempy,xminView,xmaxView,xmin,xmax,func): 582 623 """
Note: See TracChangeset
for help on using the changeset viewer.