plot1d
index
/home/oxygen3/CHA/epics/extensions/lang/python/plot1d.py

Plot1d provides python user with a flexible multiline plot package through using the high quality plot package 'matplotlib'. It also provide simple analysis features like polynomial fitting and statistic calculation.

Usage:
	source /APSshare/setup_apsshare
	plot1d.py

 
Modules Used
       
AppShell
pylab
matplotlib
math
multiarray
string
sys
os
Tkinter
Pmw

 
Classes
       
AppShell.AppShell(_Pmw.Pmw_1_2.lib.PmwBase.MegaWidget)
plot1d

 
class plot1d(AppShell.AppShell)
    
Method resolution order:
plot1d
AppShell.AppShell

Methods defined here:
CBalloff(self)
CBalloff(self) - unselect all check buttons for Y vectors
CBallon(self)
CBallon(self) - select all check buttons for Y vectors
Print(self)
Print(self) - save plot to plot1d.png and send to PS printer
addMoreMenuBar(self)
addMoreMenuBar(self) - create menubar user interface
closeall(self)
closeall(self) - close all plot windows
closeup(self)
closeup(self) - close window and exit the plot1d program
closewin(self, event)
closewin(self,event) - right mouse button to close plot window
columndata(self)
columndata(self) - extract x,y vectors from column oriented text array
createButtons(self)
createButtons(self) - create command area buttons
createCB(self)
createCB(self) - update CheckButtons to reflect the defined y vectors
createFields(self)
createFields(self) - create modifiable control fields for plot
createInterface(self)
createInterface(self) - plot1d object creation
displayFile(self)
displayFile(self) - display picked text file
doneLeg(self)
doneLeg(self) - close setup legend dialog
errDone(self)
errDone(self) - close error bar dialog
errRun(self)
errRun(self) - plot error bar for selected curve
errorbarDialog(self)
errorbarDialog(self) - dialog to setup errorbar plot
fittingDone(self)
fittingDone(self) - close fitting dialog
fittingHelp(self)
fittingHelp(self) - help on fitting dialog
fittingNumDialog(self)
fittingNumDialog(self) - dialog to enter curve # for fitting
fittingRun(self)
fittingRun(self) - accept power and curve # to do polynomial fit
getCB(self)
getCB(self) - get the state of all checked buttons
getlegend(self)
getlegend(self) - dialog to set legends for plot at most 85
getlegpos(self)
getlegpos(self) - get and set new legposition
getsymbolClose(self)
getsymbolClose(self) - close symbol dialog
getsymbols(self)
getsymbols(self) - get and set new symbols
helpinfo(self)
helpinfo(self) - display plot1d_help.txt with scrolled text
histDialog(self)
histogramDialog(self) - dialog to setup histogram plot
histDone(self)
histDone(self) - close histogram dialog
histRun(self)
histRun(self) - do histogram plot for selected curve
initfields(self, x, y)
initfields(self,x,y) - initialize X,Y ranges fields from x,y vectors
message(self, nm=None, info=None)
message(self) - display message info
otherfit(self)
otherfit(self) - pop up Least Square fit dialog
otherxfit(self)
otherxfit(self) - try fit with different X range
pickFile(self)
pickFile(self) - dialog to pick a text data file
pickLegpos(self)
pickLegpos(self) - dialog to pick legend position
pickMDA(self)
pickMDA(self) - dialog to pick MDA file and load 1D array into memory
plotcurves(self)
plotcurves(self) - plot all selected curves in a figure
plotsubplot(self)
plotsubplot(self) - plot selected curves in a subplot figure (at most 9 allowed)
printer(self)
printer(self) - dialog to set up printer
rowdata(self)
rowdata(self) - extract x,y vectors from row oriented text array
setlegpos(self)
setlegpos(self) - dialog to set legend position
setsymbols(self)
setsymbols(self) - dialog to modify and set new symbols
settitle(self)
settitle(self) - update the title of plot figure
setupXrange(self, title=None)
setupXrange(self) - dialog to reset X axis data range
setupXrangeDone(self)
setupXrangeDone(self) - close X range dialog
setupXrangeReset(self)
setupXrangeReset(self) - set X range value
setupXrangeRun(self)
setupXrangeRun(self) - accept and setup X range
setxcid(self)
setxcid(self) - reset data as column array
setxlabel(self)
setxlabel(self) - update the xlabel of plot figure
setxlimit(self)
setxlimit(self) - set and update xlim for plot figure
setxrid(self)
setxrid(self) - reset data as row array
setylabel(self)
setylabel(self) - update the ylabel of plot figure
setylimit(self)
setxlimit(self) - set and update xlim for plot figure
startup(self)
startup(self) - initialize variables at object plot1d creation
statisticAll(self)
statisticAll(self) - calculate statistic for all curves
statisticCalc(self)
statisticCalc(self) - statistic calculation
statisticDialog(self)
statisticDialog(self) - statistic calculation
statisticDone(self)
statisticDone(self) - close statistic dialog
statisticNext(self)
statisticNext(self) - statistic calculation for next curve
statisticPrev(self)
statisticPrev(self) - statistic calculation for previous curve
toggleGrid(self)
toggleGrid(self) - set grid line on or off
toggleLeg(self)
toggleLeg(self) - get default legend position
toggleSty(self)
toggleSty(self) - set line style on or off
toggleSym(self)
toggleSym(self) - set symbols on or off

Data and other attributes defined here:
appname = 'plot1d Python Program'
frameHeight = 500
frameWidth = 500
usecommandarea = 1

Methods inherited from AppShell.AppShell:
__init__(self, **kw)
appInit(self)
balloon(self)
bind(self, child, balloonHelpMsg, statusHelpMsg=None)
busyEnd(self)
busyStart(self, newcursor=None)
buttonAdd(self, buttonName, helpMessage=None, statusMessage=None, **kw)
buttonBox(self)
createMenuBar(self)
initializeTk(self, root)
interior(self)
main(self)
messageBar(self)
run(self)
showAbout(self)
toggleBalloon(self)
updateProgress(self, newValue=0, newMax=0)

Data and other attributes inherited from AppShell.AppShell:
appversion = '1.0'
balloonhelp = 1
busyCursor = 'watch'
contactemail = '[email protected]'
contactname = 'Ben-chin K Cha'
contactphone = '(630) 252-8653'
copyright = 'ANL-APS-AOD-BCDA, All Rights Reserved.'
padx = 5
pady = 5

 
Functions
       
arange(...)
arange(start, stop=None, step=1, typecode=None)
 
 Just like range() except it returns an array whose type can be
specified by the keyword argument typecode.
array(...)
array(sequence, typecode=None, copy=1, savespace=0) will return a new array formed from the given (potentially nested) sequence with type given by typecode.  If no typecode is given, then the type will be determined as the minimum type required to hold the objects in sequence.  If copy is zero and sequence is already an array, a reference will be returned.  If savespace is nonzero, the new array will maintain its precision in operations.
arrayrange = arange(...)
arange(start, stop=None, step=1, typecode=None)
 
 Just like range() except it returns an array whose type can be
specified by the keyword argument typecode.
choose(...)
choose(a, (b1,b2,...))
cross_correlate(...)
cross_correlate(a,v, mode=0)
empty(...)
empty((d1,...,dn),typecode='l',savespace=0) will return a new array
of shape (d1,...,dn) and given type with all its entries uninitialized.  If savespace is
nonzero, the array will be a spacesaver array.  This can be faster than zeros.
fromstring(...)
fromstring(string, typecode='l', count=-1) returns a new 1d array initialized from the raw binary data in string.  If count is positive, the new array will have count elements, otherwise it's size is determined by the size of string.
maketrans(...)
maketrans(frm, to) -> string
 
Return a translation table (a string of 256 bytes long)
suitable for use in string.translate.  The strings frm and to
must be of the same length.
minmax(y)
minmax(y) - return minimum, maximum of 2D array y
reshape(...)
reshape(a, (d1, d2, ..., dn)).  Change the shape of a to be an n-dimensional array with dimensions given by d1...dn.  Note: the size specified for the new array must be exactly equal to the size of the  old one or an error will occur.
searchsorted = binarysearch(...)
binarysearch(a,v)
subplot_i(t, s, id, xlog, ylog)
subplot_i(t,s,id,xlog,ylog) - create subplot as linear or log scale
where
        t    - X axis value
        s    - Y variable
        id   - specify the 3 digits sequence number(RC#) of the subplot
               (at most 9 subplots allowd in a figure)
               R specify the subplot row number
               C specify the the subplot column number
               # specify the sequence number < 10
        xlog - specify X axis scale (0 linear scale, 1 logarithm scale)
        ylog - specify Y axis scale (0 linear scale, 1 logarithm scale)
take(...)
take(a, indices, axis=0).  Selects the elements in indices from array a along the given axis.
zeros(...)
zeros((d1,...,dn),typecode='l',savespace=0) will return a new array of shape (d1,...,dn) and type typecode with all it's entries initialized to zero.  If savespace is nonzero the array will be a spacesaver array.