# display all backgrounds:
def display_bg_colors '{
global float array DIAG_PLOT[100][3]
for (ii=0 ; ii< 75 ; ii++){
DIAG_PLOT[ii][0]= ii
DIAG_PLOT[ii][1]= sin(ii/10)
}
for (ii=0 ; ii <175 ; ii ++ ) {
plot_cntl("erase")
plot_cntl(sprintf("colors=%d:16:9:3:2:12",ii))
array_plot(DIAG_PLOT[:][0], DIAG_PLOT[:][1])
plot_cntl("erase")
plot_cntl(sprintf("colors=%d:16:9:3:2:12",ii))
array_plot(DIAG_PLOT[:][0], DIAG_PLOT[:][1])
print ii
sleep(0.05)
}
}'
# 0 - background (normally white or black)
# 1 - foreground (normally black or white)
# 2 - blue
# 3 - red
# 4 - green
# 5 - yellow
# 6 - cyan
# 7 - magenta
# 8 - white
# 9 - black
#
# Other colors may be available depending on the particular device. You don't have to assign values to all colors.
#
# 10 pale green
# 11 green
# 12 blue (== 2)
# 13 kaki ?
# 14 lila
# 15 violet
# 16 gris bleu clair
# 17 gris
# 18 blue (legerement darker than 2)
# 19 lila
# 20 dark violet
# 21 very dark blue
# 22 light blue
# 23 violet (lighter than 15)
# 24
# 25 orange
# 26 cyan (=6)
# 27 bordeaux
# 28 bordeaux ~
# 29 orange pale
# 30 dark yellow
# 31 marron/orange
# 32 beige
# 33 green = 4
# 34 dark green
# 35 dark kaki
# 36 dark green
# 37 green (darker than 4)
# 38 kaki
# 39 verdatre
# 40
# 44 cacadoie
# 45 dark petrol
# 46 taupe
# 47 beige taupe clair
# 48
# 49 orange spec
# 50 pink =7
# 51 prune
# 52 orange
# 53 vieux rose
# 54 violet
# 55 violet
# 56 rose pale
# 57 rose
# 58 rouge
# 59
# 60
# 61 orange
# 62
# 63
# 64 marron
# 65 beige fonce
# 66 gris rose
# 67 cyan
# 68 cyan
# 69 cyan
# 70 rose
# 71 violet
# 72 beige
# 73 yellow =5
# 74 vert pomme
# 75 ->175 : noir->blanc
#
# plot_cntl("erase"); plot_cntl("colors=165:72:2:9:25") ; array_plot(DIAG_PLOT[:][0], DIAG_PLOT[:][1])
#
# # init plotting device
# plot_cntl("filter1,open") # select filter1 (default)
# plot_cntl("erase") #
# plot_cntl("lines") #
# plot_range("auto","auto","auto","auto") #
# plot_cntl("colors=49:16:9:3:2:7:8:9:5:4:2") # couleurs SPEC.
# plot_cntl("colors=49:16:9:3:2:7:8:9:5:4:2") # couleurs SPEC.
# plot_cntl("colors=<labels_bg>:<curve_bg>:<labels>:<rulers>:<curve1>[:<curve2> etc.]")
# array_plot(a [, b, ...]) - Plots the data in the array a.
# Depending on whether a is a row-wise or column-wise array,
# the first column or first row elements are used for x.
# Subsequent elements (up to a maximum of 64) are plotted
# along the y axis. If preceded by a call of
# plot_cntl("addpoint") and the ranges have not changed, only
# the last point in the array is drawn. If preceded by a call
# of plot_cntl("addline") the current plot will not be erased,
# and the plot ranges will not be changed. The plotting area
# is not automatically erased by a call of data_plot()-use
# plot_cntl("erase") for that. The axis ranges are set using
# the plot_range() function. See plot_cntl() for other
# options that affect drawing the plot.
# if (PLOT_MODE&1)
# plot_cntl("erase")
# # The splot macro draws a screen or high-res plot of the data points
# # from a scan. The screen plot should work even if the terminal
# # has no cursor addressing, as the plot_move()
# # functions become no-ops and the internal plotting code will
# # draw a lp-type plot.
#
# # [array] [x_col] [y_col] [no pts]
# # Uses global: X_L Y_L T_L PLOT_MODE BG YMIN splot_col
# def splot '{
# if (PLOT_MODE&128) {
# plot_cntl(sprintf("colors=%s",splot_col))
# plot_cntl("open")
# }
# plot_defaults($#,"$1","$2","$3","$4")
#
# plot_cntl("erase")
# plot_cntl(PLOT_MODE&8? "xexact":"-xexact")
# plot_cntl(PLOT_MODE&32? "ylog":"-ylog")
# plot_cntl(PLOT_MODE&256? "-dots":"dots")
# plot_cntl(PLOT_MODE&512? "-lines":"lines")
# plot_cntl(PLOT_MODE&1024? "-ebars":"ebars")
# plot_range("auto","auto",YMIN,"auto")
# if (pl_type && BG)
# do_bg(SCAN_D, pl_x, pl_y, NPTS)
# plot_move(0,1,pl_t)
# plot_move(0,2,pl_yl)
# plot_move(0,-1,sprintf("%.8s", pl_xl))
#
#
# sdata_plot(@pl_a,pl_x,pl_y,pl_n)
# plot_move(-50,0,sdata_res_s1(@pl_a,pl_x,pl_y,pl_n,pl_type))
# plot_move(-50,1,sdata_res_s2(@pl_a,pl_x,pl_y,pl_n,pl_type))
# plot_move(0,3)
# }'
# data_plot(g, s, n, e0, e1 [, e2 ...]) - Plots the current data in
# group g starting at point s and plotting n points. Element
# e0 is used for x. Elements given by the subsequent
# arguments (up to a maximum of 64) are plotted along the y
# axis. If n is zero, only the points from s to the last
# point added using data_nput() or data_put() are plotted. If
# proceeded by a call of plot_cntl("addpoint") and the ranges
# have not changed, only point s+n-1is drawn. If proceed by a
# call of plot_cntl("addline") the current plot will not be
# erased, and the plot ranges will not be changed. The
# plotting area is not automatically erased by a call of
# data_plot()-use plot_cntl("erase") for that. The axis
# ranges are set using the plot_range() function. See
# plot_cntl() for other options that affect drawing the plot.
#
# data_plot(g, s, n, "all") - As above, but uses element zero for x
# and the remaining elements (up to a maximum of 64) for y
# values. The number of elements is set with the data_grp()
# function.
#
# data_fit(pars, g, s, n, edata, epars [, ...]) - Performs a linear
# fit of the data in element edata to the terms in the
# elements specified by epars. The fitted parameters are
# returned in the array pars supplied by the user. The
# function returns the chi-squared value of the fit, if the
# fit was successful. A -1 is returned if there are
# insufficient arguments or the covariance matrix is singular.
# The fit algorithm is along the same lines as the lfit()
# routine in Numerical Recipes (W.H. Press, et al., Cambridge
# University Press, 1986, page 512).
#
# plot_cntl(s) - Selects built-in plotting features. The argument
# s is a string of comma- or space-delimited options. See the
# plot_cntl help file for descriptions of the many options.
#
# plot_move(x, y [, s [, c]]) - Moves the current position to
# column x and row y, where column 0, row 0 is the upper left
# corner of the screen. If the third argument s is present,
# it is written as a label at the given position. If using
# color high-resolution graphics, the fourth argument, if
# present, is the color to use to draw the label. (See the
# colors help file.) The background color for the entire
# label will be the background color at the starting position.
# If graphics mode is not on, plot_move() works just as
# tty_move().
#
#
# plot_range(xmin, xmax, ymin, ymax) - Sets the ranges of the
# internally generated plots. If any of the arguments is the
# string "auto", the corresponding range limit is determined
# automatically from the data at the time the plot is drawn.
# If any of the arguments is the string "extend", the
# corresponding range limit is only changed if the current
# data decrease the minimum or increase the maximum. Returns
# true.
# Choices (add values together for single mode):
# 0 = No plots
# 1 = Updated screen plot
# 2 = Final screen plot
# 4 = LP plot
# 8 = Force x-axis min and max to scan min and max
# 16 = Force y-axis minimum to zero
# 32 = Use logarithmic y axis
# 64 = Use background subtraction analysis (barely supported feature)
# 128 = Use highres graphics
# 256 = Don't draw highres dots
# 512 = Don't draw highres lines
# 1024 = Don't draw error bars
# 2048 = Plot all elements of data group
# 1155 = 1024 + 128 + 2 + 1
# 3.CYRIL> setplot
#
# 1) Do real-time screen plots during scans (YES)?
# 2) Do screen plot after scan (YES)?
# 8) Range x axis with scan min and max (NO)?
# 16) Force y-axis minimum to zero (NO)?
# 32) Use logarithmic y-axis (NO)?
# 64) Do background subtraction for plots (NO)?
# 128) Use high resolution plotting device (YES)?
# What kind of high-res graphics terminal (x11)?
# 256) Draw big dots (YES)?
# 512) Connect with lines (YES)?
# 1024) Draw error bars (NO)?
# Sum of selections is 1155 (0x483).
def fill_array '{
local ii
global POINTCOUNTS
POINTCOUNTS = 120
global float array ARR_PLOT[POINTCOUNTS][2]
for (ii=0; ii<POINTCOUNTS; ii++){
ARR_PLOT[ii][0] = ii
ARR_PLOT[ii][1] = sin(6*ii/POINTCOUNTS)
}
global float array min_time_arr[POINTCOUNTS]
}'
def ppp '{
fill_array
min_time_arr[:]= 0.527
plot_cntl("open,colors=18:17:29:13:14:2:3")
plot_range("auto","auto","auto","auto")
plot_cntl("lines")
plot_cntl("erase")
plot_cntl("-ylog")
plot_cntl("dots")
plot_cntl("-ebars")
array_plot(ARR_PLOT[:][0], ARR_PLOT[:][1], min_time_arr,min_time_arr-1)
}'
def plottage '{
fill_array
# plotting setup.
plot_cntl("filter2,open,erase,lines,-ebars")
plot_range("auto","auto","auto","auto")
plot_cntl("filter2,colors=18:17:29:13:14:25")
for (ii=0 ; ii< POINTCOUNTS; ii++){
array_plot(ARR_PLOT[:ii][0], ARR_PLOT[:ii][1] )
sleep(3 / POINTCOUNTS)
}
plot_cntl("filter1,open")
print "...Plotted"
}'
def colors_samples '{
global float array DIAG_PLOT[75][3]
local key ii jj
global PLOTCOLOR[]
for (ii=0 ; ii< 75 ; ii++){
DIAG_PLOT[ii][0]= ii
DIAG_PLOT[ii][1]= sin(ii/10)
}
plot_cntl("filter1,open")
plot_range("auto","auto","auto","auto")
plot_cntl("filter1,lines")
global COLOR_SAMPLES[]
COLOR_SAMPLES[0]="filter1,colors=17:15:45:0:25"
COLOR_SAMPLES[0]["name"]="vv"
COLOR_SAMPLES[1]="filter1,colors=49:16:9:3:2:7:8:9:5:4:2"
COLOR_SAMPLES[1]["name"]="spec"
COLOR_SAMPLES[2]="filter1,colors=28:20:73:144:31"
COLOR_SAMPLES[2]["name"]="old"
COLOR_SAMPLES[3]="filter1,colors=29:20:20:144:134"
COLOR_SAMPLES[3]["name"]="esrf orange"
COLOR_SAMPLES[4]="filter1,colors=22:20:20:144:61"
COLOR_SAMPLES[4]["name"]="blue_orange"
# COLOR_SAMPLES[2]="filter1,"
# COLOR_SAMPLES[2]["name"]=""
ii = 0
while (1) {
while ((key=input(-1))=="") {}
key=substr(key,1,1)
if (key=="q"||key=="Q"){
break
}
print COLOR_SAMPLES[ii]["name"]
for (jj=0; jj<2 ; jj++){
plot_cntl("filter1,erase")
plot_cntl(COLOR_SAMPLES[ii])
array_plot(DIAG_PLOT[:][0], DIAG_PLOT[:][1])
}
ii += 1
if (ii >= ass_arr_nb_key( COLOR_SAMPLES)/2){
ii = 0
}
}
}'
# ESRF
# orange3 25
# orange0 29
# jaune 30
# vert 36 42
# cyan
# magenta 51
# blue_75
# blue_50
# bleu centreal 20
# grey_244 160
# grey_212 150
# grey_186 134
# display all curves colors:
def colors_chooser '{
global float array DIAG_PLOT[75][3]
local key
global PLOTCOLOR[]
for (ii=0 ; ii< 75 ; ii++){
DIAG_PLOT[ii][0]= ii
DIAG_PLOT[ii][1]= sin(ii/10)
}
plot_cntl("filter1,open")
plot_range("auto","auto","auto","auto")
plot_cntl("filter1,lines")
printf("colors: (b)order=%3d (k)urve_bg=%3d (l)abels=%3d (r)ulers=%3d (c)urve=%3d (q)uit ", \
PLOTCOLOR["border_bg"], PLOTCOLOR["curve_bg"], PLOTCOLOR["labels"], PLOTCOLOR["rulers"], PLOTCOLOR["curve"] )
for (jj=0; jj<2 ; jj++){
plot_cntl("filter1,erase")
# plot_cntl("colors= <border_bg> : <curve_bg> : <labels> : <rulers> : <curve1> [: <curve2> etc.]")
plot_cntl(sprintf("filter1,colors=%d:%d:%d:%d:%d", \
PLOTCOLOR["border_bg"], PLOTCOLOR["curve_bg"], PLOTCOLOR["labels"], PLOTCOLOR["rulers"], PLOTCOLOR["curve"] ))
array_plot(DIAG_PLOT[:][0], DIAG_PLOT[:][1])
}
while (1) {
while ((key=input(-1))=="") {}
key=substr(key,1,1)
if (key=="q"||key=="Q"){
break
}
else if (key=="b") {
PLOTCOLOR["border_bg"] += 1
}
else if (key=="B") {
PLOTCOLOR["border_bg"] -= 1
}
else if (key=="k") {
PLOTCOLOR["curve_bg"] += 1
}
else if (key=="K") {
PLOTCOLOR["curve_bg"] -= 1
}
else if (key=="l") {
PLOTCOLOR["labels"] += 1
}
else if (key=="L") {
PLOTCOLOR["labels"] -= 1
}
else if (key=="r") {
PLOTCOLOR["rulers"] += 1
}
else if (key=="R") {
PLOTCOLOR["rulers"] -= 1
}
else if (key=="c") {
PLOTCOLOR["curve"] += 1
}
else if (key=="C") {
PLOTCOLOR["curve"] -= 1
}
for (jj=0; jj<2 ; jj++){
plot_cntl("filter1,erase")
# plot_cntl("colors= <border_bg> : <curve_bg> : <labels> : <rulers> : <curve>")
plot_cntl(sprintf("filter1,colors=%d:%d:%d:%d:%d", \
PLOTCOLOR["border_bg"], PLOTCOLOR["curve_bg"], PLOTCOLOR["labels"], PLOTCOLOR["rulers"], PLOTCOLOR["curve"] ))
array_plot(DIAG_PLOT[:][0], DIAG_PLOT[:][1])
}
printf("\r")
printf("filter1,colors=%d:%d:%d:%d:%d ", \
PLOTCOLOR["border_bg"], PLOTCOLOR["curve_bg"], PLOTCOLOR["labels"], PLOTCOLOR["rulers"], PLOTCOLOR["curve"] )
printf(" change : (b)order=%3d (k)urve_bg=%3d (l)abels=%3d (r)ulers=%3d (c)urve=%3d (q)uit ", \
PLOTCOLOR["border_bg"], PLOTCOLOR["curve_bg"], PLOTCOLOR["labels"], PLOTCOLOR["rulers"], PLOTCOLOR["curve"] )
}
}'
# display all backgrounds colors:
def display_bg_colors '{
global float array DIAG_PLOT[100][3]
for (ii=0 ; ii< 100 ; ii++){
DIAG_PLOT[ii][0]= ii
DIAG_PLOT[ii][1]= sin(ii/10)
}
# select
plot_cntl("filter2,open")
plot_cntl("erase")
plot_cntl("lines")
plot_range("auto","auto","auto","auto")
plot_cntl("-ebars")
for (ii=0 ; ii <175 ; ii ++ ) {
for (jj=0; jj<2 ; jj++){
plot_cntl("erase")
# plot_cntl("colors= <border_bg> : <curve_bg> : <labels> : <rulers> : <curve>")
plot_cntl(sprintf("colors=%d:16:9:3:2",ii))
array_plot(DIAG_PLOT[:][0], DIAG_PLOT[:][1])
}
print ii
getval(1)
}
plot_cntl("filter1,open")
}'
|