I have multiple data files which all look like this:
core instance1 instance2 ...
1 34 32 ...
2 32 32 ...
3 25 43 ...
.. ...
The all represent different measurements of the same experiment. Therefore,
i'd like to create a errorlines where all this data is combined to get the
average, minX and maxX. To automate this I wrote the script below. But Im
getting into a swamp of complex recursive functions which only perform
simple tasks. So I guess my question is, can this be done more efficiently?
Thanks!
Regards,
Alfons
### configuration ###
filenames = "dve div2"
fileset = "1 2 3 4"
function = "speedup"
cols = "11 12 13"
num_cols = 13
### plot code ###
mem=0
id(x) = x
first(x) = $1==1 ? mem=x : mem
time(x) = filename eq DVE ? (x/($1)) : x
speedup(x) = first(x)/time(x)
#comb=product("a b", "c d")
#print comb #yields: a_c a_d b_c b_d
#print w(word(com,2), 2) #yields: d
concat_ar(x,ar,i,s1,s2) = x . s1 . word(ar,i+1) .(i<words(ar)-1 ? s2.
concat_ar(x,ar,i+1,s1,s2) : "")
product1(ar1,ar2,i) = concat_ar(word(ar1,i+1), ar2, 0, "_", " ")
.(i<words(ar1)-1 ? " ". product1(ar1,ar2,i+1) : "")
product(x, y) = product1(x,y,0)
w(x,n) = n==1 ? x[1:strstrt(x,"_")-1] : w(x[strstrt(x,"_")+1:*], n-1)
#print join("dve", "1 2 3") #yields: < join 1 2 | join - 3
fn(name,index) = (filename=name). "-". index .".dat"
join1(n,ar,i) = words(ar)==1 ? fn(name,ar) : i+2 == words(ar) ? \
'< join '. fn(n, word(ar,i+1)) ." ". fn(n, word(ar,i+2)) : \
join1(n,ar,i+1) ." | join - ". fn(n, word(ar,i+1))
join(n,ar)=join1(n,ar,0)
cols_tot(i) = i <= (words(fileset)-1)*num_cols+1 ? column(i) +
cols_tot(i+num_cols) : column(i)
cols_avg(i) = cols_tot(i) / words(fileset)
cols_max(i) = i <= (words(fileset)-1)*num_cols+1 ?
(column(i)>(rec=cols_max(i+num_cols)) ? column(i) : rec ) : column(i)
cols_min(i) = i <= (words(fileset)-1)*num_cols+1 ?
(column(i)<(rec=cols_min(i+num_cols)) ? column(i) : rec ) : column(i)
plot [.8:16] for [tuple in product(filenames, cols)] \
join(name=w(tuple,1), fileset) \
using 1:(@function(cols_avg(w(tuple,2)))): \
(@function(cols_min(w(tuple,2)))): \
(@function(cols_max(w(tuple,2)))) \
title column(w(tuple,2)) \
with errorlines;
--
View this message in context: http://old.nabble.com/GNUplot-script-for-graphs-from-multiple-data-files-tp27690178p27690178.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|