gnuplot scripts
This commit is contained in:
parent
423da0f3c1
commit
6443891d99
Fig_src/gnuplot/bin
cpresults.bashcpresults_sim_WScenario_m15_x_x_x_POLICY_1_1_var_WF2Ctrl.bashcpresults_sim_WScenario_m15_x_x_x_POLICY_2.bashcpresults_sim_WScenario_m15_x_x_x_POLICY_2_NN.bashcpresults_sim_WScenario_m15_x_x_x_POLICY_x_x.bashdata.awkdata2.bashdata2gz.bashdataInterval.awkdataP.bashdataPDGsum.bashdataPlossP.bashdataPsum.bashdataPsumGen.bashdataTVERROUT.bashdataVIAERR.bashdataYtl.awkdata_min_M1_suchthat_M2_lesseq_Thr_gz.bashdatabysolvergz.bashdatabysolversortedgz.bashdatabysolversortedreversegz.bashdatagz.bashepscolor2epsgrayscale.bashgenAll.bashgenAll_WP.bashgetMobiusResults_bradipo.bashget_track_data.bashgnuplot_figs.gpgnuplot_figs_cmp.gpgo.bashgocmp.bashpdf2pdfcrop.bash
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash
|
||||
|
||||
# copy pdf to from tikz to figs
|
||||
function main () {
|
||||
|
||||
|
||||
# the absolute project path where is all the stuff, three directories above the script:
|
||||
# 3 2 1 0
|
||||
# basedir/gnuplot/bin/<script>
|
||||
BASEDIR=$(scriptancestorpath 3)
|
||||
|
||||
# name of the basedir
|
||||
BASENAME=$(basename "${BASEDIR}")
|
||||
|
||||
# Fig_src
|
||||
FIG_SRC_DIR="${BASEDIR}"
|
||||
|
||||
FROM="${FIG_SRC_DIR}/mobius/STINGRAY_Comparison/Solver/./"
|
||||
|
||||
TO="${FIG_SRC_DIR}/gnuplot"
|
||||
|
||||
rsync -zarv --prune-empty-dirs --include "*/" --include="Results_results.csv" --exclude="*" "$FROM" "$TO"
|
||||
|
||||
# compress csv files
|
||||
find "${TO}" -path "${TO}/sim_vardelta_T00_*/*" -name "Results_results.csv" | xargs gzip -v
|
||||
|
||||
}
|
||||
|
||||
# get the i-th ancestor path of the script that calls this function (the currently running script)
|
||||
# i=0: for the path of the script,
|
||||
# i=1: for the directory where is the script,
|
||||
# i=2: for the directory including the directory corresponding to i=1,
|
||||
# etc...
|
||||
# $1: level of the ancestor path (from the end of the path)
|
||||
scriptancestorpath () {
|
||||
[[ $1 -lt 0 ]] && { echo "Ops! Input less than 0: $1"; exit 1; }
|
||||
local THEPATH="$(cd "$(dirname "$0")"; pwd)/$(basename "$0")"
|
||||
i=1
|
||||
while [[ $i -le ${1} && "${THEPATH}" != "/" ]]; do
|
||||
THEPATH="$(cd "$(dirname "$THEPATH")"; pwd)"
|
||||
let i=i+1
|
||||
done
|
||||
# echo "depth: $i"
|
||||
echo "${THEPATH}"
|
||||
}
|
||||
|
||||
|
||||
main "$@"
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash
|
||||
|
||||
# copy pdf to from tikz to figs
|
||||
function main () {
|
||||
|
||||
|
||||
# the absolute project path where is all the stuff, three directories above the script:
|
||||
# 3 2 1 0
|
||||
# basedir/gnuplot/bin/<script>
|
||||
BASEDIR=$(scriptancestorpath 3)
|
||||
|
||||
# name of the basedir
|
||||
BASENAME=$(basename "${BASEDIR}")
|
||||
|
||||
# Fig_src
|
||||
FIG_SRC_DIR="${BASEDIR}"
|
||||
|
||||
FROM="${FIG_SRC_DIR}/mobius/STINGRAY_Multipolicy/Solver/./"
|
||||
|
||||
TO="${FIG_SRC_DIR}/gnuplot"
|
||||
|
||||
# rsync -zarv --prune-empty-dirs --include "*/" --include="Results_results.csv" --exclude="*" "$FROM" "$TO"
|
||||
rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_1_1_var_WF2Ctrl/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
|
||||
#find "$TO" -path "${TO}/sim_vardelta_T00_T0w10_DPT0diff*_DPw*_POLICY_0/*" -name "Results_results.csv" | xargs gzip -v
|
||||
|
||||
}
|
||||
|
||||
# get the i-th ancestor path of the script that calls this function (the currently running script)
|
||||
# i=0: for the path of the script,
|
||||
# i=1: for the directory where is the script,
|
||||
# i=2: for the directory including the directory corresponding to i=1,
|
||||
# etc...
|
||||
# $1: level of the ancestor path (from the end of the path)
|
||||
scriptancestorpath () {
|
||||
[[ $1 -lt 0 ]] && { echo "Ops! Input less than 0: $1"; exit 1; }
|
||||
local THEPATH="$(cd "$(dirname "$0")"; pwd)/$(basename "$0")"
|
||||
i=1
|
||||
while [[ $i -le ${1} && "${THEPATH}" != "/" ]]; do
|
||||
THEPATH="$(cd "$(dirname "$THEPATH")"; pwd)"
|
||||
let i=i+1
|
||||
done
|
||||
# echo "depth: $i"
|
||||
echo "${THEPATH}"
|
||||
}
|
||||
|
||||
|
||||
main "$@"
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash
|
||||
|
||||
# copy pdf to from tikz to figs
|
||||
function main () {
|
||||
|
||||
|
||||
# the absolute project path where is all the stuff, three directories above the script:
|
||||
# 3 2 1 0
|
||||
# basedir/gnuplot/bin/<script>
|
||||
BASEDIR=$(scriptancestorpath 3)
|
||||
|
||||
# name of the basedir
|
||||
BASENAME=$(basename "${BASEDIR}")
|
||||
|
||||
# Fig_src
|
||||
FIG_SRC_DIR="${BASEDIR}"
|
||||
|
||||
FROM="${FIG_SRC_DIR}/mobius/STINGRAY_Multipolicy/Solver/./"
|
||||
|
||||
TO="${FIG_SRC_DIR}/gnuplot"
|
||||
|
||||
# rsync -zarv --prune-empty-dirs --include "*/" --include="Results_results.csv" --exclude="*" "$FROM" "$TO"
|
||||
rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_2_NN/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_NN_2/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_2_2/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_2_2_var_WF2Ctrl/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
|
||||
#find "$TO" -path "${TO}/sim_vardelta_T00_T0w10_DPT0diff*_DPw*_POLICY_0/*" -name "Results_results.csv" | xargs gzip -v
|
||||
|
||||
}
|
||||
|
||||
# get the i-th ancestor path of the script that calls this function (the currently running script)
|
||||
# i=0: for the path of the script,
|
||||
# i=1: for the directory where is the script,
|
||||
# i=2: for the directory including the directory corresponding to i=1,
|
||||
# etc...
|
||||
# $1: level of the ancestor path (from the end of the path)
|
||||
scriptancestorpath () {
|
||||
[[ $1 -lt 0 ]] && { echo "Ops! Input less than 0: $1"; exit 1; }
|
||||
local THEPATH="$(cd "$(dirname "$0")"; pwd)/$(basename "$0")"
|
||||
i=1
|
||||
while [[ $i -le ${1} && "${THEPATH}" != "/" ]]; do
|
||||
THEPATH="$(cd "$(dirname "$THEPATH")"; pwd)"
|
||||
let i=i+1
|
||||
done
|
||||
# echo "depth: $i"
|
||||
echo "${THEPATH}"
|
||||
}
|
||||
|
||||
|
||||
main "$@"
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash
|
||||
|
||||
# copy pdf to from tikz to figs
|
||||
function main () {
|
||||
|
||||
|
||||
# the absolute project path where is all the stuff, three directories above the script:
|
||||
# 3 2 1 0
|
||||
# basedir/gnuplot/bin/<script>
|
||||
BASEDIR=$(scriptancestorpath 3)
|
||||
|
||||
# name of the basedir
|
||||
BASENAME=$(basename "${BASEDIR}")
|
||||
|
||||
# Fig_src
|
||||
FIG_SRC_DIR="${BASEDIR}"
|
||||
|
||||
FROM="${FIG_SRC_DIR}/mobius/STINGRAY_Multipolicy/Solver/./"
|
||||
|
||||
TO="${FIG_SRC_DIR}/gnuplot"
|
||||
|
||||
# rsync -zarv --prune-empty-dirs --include "*/" --include="Results_results.csv" --exclude="*" "$FROM" "$TO"
|
||||
rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_2_NN/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
|
||||
#find "$TO" -path "${TO}/sim_vardelta_T00_T0w10_DPT0diff*_DPw*_POLICY_0/*" -name "Results_results.csv" | xargs gzip -v
|
||||
|
||||
}
|
||||
|
||||
# get the i-th ancestor path of the script that calls this function (the currently running script)
|
||||
# i=0: for the path of the script,
|
||||
# i=1: for the directory where is the script,
|
||||
# i=2: for the directory including the directory corresponding to i=1,
|
||||
# etc...
|
||||
# $1: level of the ancestor path (from the end of the path)
|
||||
scriptancestorpath () {
|
||||
[[ $1 -lt 0 ]] && { echo "Ops! Input less than 0: $1"; exit 1; }
|
||||
local THEPATH="$(cd "$(dirname "$0")"; pwd)/$(basename "$0")"
|
||||
i=1
|
||||
while [[ $i -le ${1} && "${THEPATH}" != "/" ]]; do
|
||||
THEPATH="$(cd "$(dirname "$THEPATH")"; pwd)"
|
||||
let i=i+1
|
||||
done
|
||||
# echo "depth: $i"
|
||||
echo "${THEPATH}"
|
||||
}
|
||||
|
||||
|
||||
main "$@"
|
|
@ -0,0 +1,61 @@
|
|||
#!/bin/bash
|
||||
|
||||
# copy pdf to from tikz to figs
|
||||
function main () {
|
||||
|
||||
|
||||
# the absolute project path where is all the stuff, three directories above the script:
|
||||
# 3 2 1 0
|
||||
# basedir/gnuplot/bin/<script>
|
||||
BASEDIR=$(scriptancestorpath 3)
|
||||
|
||||
# name of the basedir
|
||||
BASENAME=$(basename "${BASEDIR}")
|
||||
|
||||
# Fig_src
|
||||
FIG_SRC_DIR="${BASEDIR}"
|
||||
|
||||
FROM="${FIG_SRC_DIR}/mobius/STINGRAY_Multipolicy/Solver/./"
|
||||
|
||||
TO="${FIG_SRC_DIR}/gnuplot"
|
||||
|
||||
# rsync -zarv --prune-empty-dirs --include "*/" --include="Results_results.csv" --exclude="*" "$FROM" "$TO"
|
||||
rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_0_NN/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_2_NN/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_NN_0/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_NN_2/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_0_0/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_2_2/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_0_0_var_WF2Ctrl/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_2_2_var_WF2Ctrl/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
|
||||
# rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_1_NN/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
# rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_NN_1_var_DPmAgeMax/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
# rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_NN_1_var_DPepsilon2/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
# rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_NN_1_var_epsilon2/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
# rsync -zarv --prune-empty-dirs --include "sim_WScenario_m15_*_*_*_POLICY_1_1_var_WF2Ctrl/" --include="Results_results.csv.gz" --exclude="*" "$FROM" "$TO"
|
||||
|
||||
#find "$TO" -path "${TO}/sim_vardelta_T00_T0w10_DPT0diff*_DPw*_POLICY_0/*" -name "Results_results.csv" | xargs gzip -v
|
||||
|
||||
}
|
||||
|
||||
# get the i-th ancestor path of the script that calls this function (the currently running script)
|
||||
# i=0: for the path of the script,
|
||||
# i=1: for the directory where is the script,
|
||||
# i=2: for the directory including the directory corresponding to i=1,
|
||||
# etc...
|
||||
# $1: level of the ancestor path (from the end of the path)
|
||||
scriptancestorpath () {
|
||||
[[ $1 -lt 0 ]] && { echo "Ops! Input less than 0: $1"; exit 1; }
|
||||
local THEPATH="$(cd "$(dirname "$0")"; pwd)/$(basename "$0")"
|
||||
i=1
|
||||
while [[ $i -le ${1} && "${THEPATH}" != "/" ]]; do
|
||||
THEPATH="$(cd "$(dirname "$THEPATH")"; pwd)"
|
||||
let i=i+1
|
||||
done
|
||||
# echo "depth: $i"
|
||||
echo "${THEPATH}"
|
||||
}
|
||||
|
||||
|
||||
main "$@"
|
|
@ -0,0 +1,11 @@
|
|||
#!/sw/bin/awk -F, --exec
|
||||
|
||||
BEGIN{
|
||||
measure=ARGV[1]
|
||||
ARGV[1]=ARGV[2]
|
||||
ARGC=2
|
||||
}
|
||||
|
||||
/Mean/ && $3==measure {
|
||||
printf"%s %s %s %s\n",$3,$4,$6,$8 # Name,Start Time,Mean,Confidence Interval
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Paste results for two input measures into single output
|
||||
|
||||
## [ https://stackoverflow.com/questions/20163225/paste-files-from-list-of-paths-into-single-output-file ]
|
||||
#
|
||||
|
||||
MEASURE1="$1" # first measure, input
|
||||
MEASURE2="$2" # second measure, input
|
||||
CSVFILE="$3" # results file, input
|
||||
|
||||
LIST="${MEASURE1} ${CSVFILE} ${MEASURE2} ${CSVFILE}"
|
||||
|
||||
touch buffer.txt;
|
||||
echo "${LIST}" | xargs -n2 bash -c 'paste buffer.txt <(../bin/data.awk "$@") > output.txt; mv output.txt buffer.txt' FILLER; # Name,Start Time,Mean,Confidence Interval,Name,Start Time,Mean,Confidence Interval
|
||||
mv buffer.txt output.txt
|
||||
rm -f buffer.txt
|
||||
cat output.txt
|
||||
rm -f output.txt
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Paste results for two input measures into single output
|
||||
|
||||
## [ https://stackoverflow.com/questions/20163225/paste-files-from-list-of-paths-into-single-output-file ]
|
||||
#
|
||||
|
||||
MEASURE1="$1" # first measure, input
|
||||
MEASURE2="$2" # second measure, input
|
||||
GZFILE="$3" # results file, input
|
||||
|
||||
list1=$(gzip -dc "${GZFILE}" | awk -v measure="${MEASURE1}" -F, '/Mean/ && $3==measure { printf"%s %s %s %s\n",$3,$4,$6,$8 }')
|
||||
list2=$(gzip -dc "${GZFILE}" | awk -v measure="${MEASURE2}" -F, '/Mean/ && $3==measure { printf"%s %s %s %s\n",$3,$4,$6,$8 }')
|
||||
|
||||
paste <(echo "$list1") <(echo "$list2")
|
|
@ -0,0 +1,13 @@
|
|||
#!/sw/bin/awk -F, --exec
|
||||
|
||||
# p( a<=X<=b )
|
||||
|
||||
BEGIN{
|
||||
measure=ARGV[1]
|
||||
ARGV[1]=ARGV[2]
|
||||
ARGC=2
|
||||
}
|
||||
/Interval/ && $3==measure {
|
||||
printf"%s %s %s %s %s %s\n",$3,$6,$7,$9,$10,$11 # Name,a,b,Interval,Lower Confidence Level, Upper Confidence Level
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Paste results for each variable P_i into single output
|
||||
|
||||
## [ https://stackoverflow.com/questions/20163225/paste-files-from-list-of-paths-into-single-output-file ]
|
||||
#
|
||||
|
||||
n="$1" # number of measures P_i, input
|
||||
MEASUREBASE="P_" # measure P_ with index i
|
||||
CSVFILE="$2" # results file, input
|
||||
|
||||
for i in $(seq 1 $n); do
|
||||
LIST="${LIST} ${MEASUREBASE}${i} ${CSVFILE}"
|
||||
done
|
||||
|
||||
touch buffer.txt;
|
||||
echo "${LIST}" | xargs -n2 bash -c 'paste buffer.txt <(./bin/data.awk "$@") > output.txt; mv output.txt buffer.txt' FILLER; # Name,Start Time,Mean,Confidence Interval,Name,Start Time,Mean,Confidence Interval,...
|
||||
mv buffer.txt output.txt
|
||||
rm -f buffer.txt
|
||||
cat output.txt
|
||||
rm -f output.txt
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Paste results for each variable P_i into single output
|
||||
|
||||
## [ https://stackoverflow.com/questions/20163225/paste-files-from-list-of-paths-into-single-output-file ]
|
||||
#
|
||||
|
||||
n="$1" # number of measures P_DG_i, input
|
||||
MEASUREBASE="P_DG_" # measure P_DG_ with index i
|
||||
CSVFILE="$2" # results file, input
|
||||
|
||||
for i in $(seq 1 $n); do
|
||||
LIST="${LIST} ${MEASUREBASE}${i} ${CSVFILE}"
|
||||
done
|
||||
|
||||
touch buffer.txt;
|
||||
echo "${LIST}" | xargs -n2 bash -c 'paste buffer.txt <(./bin/data.awk "$@") > output.txt; mv output.txt buffer.txt' FILLER; # Name,Start Time,Mean,Confidence Interval,Name,Start Time,Mean,Confidence Interval,...
|
||||
mv buffer.txt output.txt
|
||||
rm -f buffer.txt
|
||||
cat output.txt | awk -v j=3 -v k=4 -v nn="$n" '{sum=0; for(i=0; i<nn; i++) sum+=$(i*k+j); printf"%s %s %s\n",$1,$2,sum}' # Name,Start Time,sum of Mean
|
||||
rm -f output.txt
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Paste into single output the results for the power loss combined with the values of P for each variable P_i
|
||||
|
||||
n="$1" # number of nodes, input
|
||||
MEASURE="P_LOSS" # measure for power loss
|
||||
CSVFILE="$2" # results file
|
||||
|
||||
paste <(./bin/data.awk "$MEASURE" "$CSVFILE") <(./bin/dataPsumGen.bash "$n" "$CSVFILE") # Name,Start Time,Mean,Confidence Interval, Name,Start Time,sum of Mean of P_i >0
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Paste sum of results for each variable P_i into single output
|
||||
|
||||
## [ https://stackoverflow.com/questions/20163225/paste-files-from-list-of-paths-into-single-output-file ]
|
||||
#
|
||||
|
||||
n="$1" # number of measures P_i, input
|
||||
MEASUREBASE="P_" # measure P_ with index i
|
||||
CSVFILE="$2" # results file, input
|
||||
|
||||
for i in $(seq 1 $n); do
|
||||
LIST="${LIST} ${MEASUREBASE}${i} ${CSVFILE}"
|
||||
done
|
||||
|
||||
touch buffer.txt;
|
||||
echo "${LIST}" | xargs -n2 bash -c 'paste buffer.txt <(./bin/data.awk "$@") > output.txt; mv output.txt buffer.txt' FILLER; # Name,Start Time,Mean,Confidence Interval,Name,Start Time,Mean,Confidence Interval,...
|
||||
mv buffer.txt output.txt
|
||||
rm -f buffer.txt
|
||||
cat output.txt | awk -v j=3 -v k=4 -v nn="$n" '{sum=0; for(i=0; i<nn; i++) sum+=$(i*k+j); printf"%s %s %s\n",$1,$2,sum}' # Name,Start Time,sum of Mean
|
||||
rm -f output.txt
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Paste sum of results corresponding to generators for each variable P_i into single output
|
||||
|
||||
## [ https://stackoverflow.com/questions/20163225/paste-files-from-list-of-paths-into-single-output-file ]
|
||||
#
|
||||
|
||||
n="$1" # number of measures P_i, input
|
||||
MEASUREBASE="P_" # measure P_ with index i
|
||||
CSVFILE="$2" # results file, input
|
||||
|
||||
for i in $(seq 1 $n); do
|
||||
LIST="${LIST} ${MEASUREBASE}${i} ${CSVFILE}"
|
||||
done
|
||||
|
||||
touch buffer.txt;
|
||||
echo "${LIST}" | xargs -n2 bash -c 'paste buffer.txt <(./bin/data.awk "$@") > output.txt; mv output.txt buffer.txt' FILLER; # Name,Start Time,Mean,Confidence Interval,Name,Start Time,Mean,Confidence Interval,...
|
||||
mv buffer.txt output.txt
|
||||
rm -f buffer.txt
|
||||
cat output.txt | awk -v j=3 -v k=4 -v nn="$n" '{sum=0; for(i=0; i<nn; i++) if($(i*k+j)>0){sum+=$(i*k+j)}; printf"%s %s %s\n",$1,$2,sum}' # Name,Start Time,sum of Mean
|
||||
rm -f output.txt
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Cat results for each variable TVERROUT_i into single output
|
||||
#
|
||||
|
||||
n="$1" # number of measures TVERROUT_i, equal to number of nodes, input
|
||||
MEASUREBASE="TVERROUT_" # measure TVERROUT_ with index i
|
||||
CSVFILE="$2" # results file
|
||||
|
||||
for i in $(seq 1 $n); do
|
||||
LIST="${LIST} ${MEASUREBASE}${i} ${CSVFILE}"
|
||||
done
|
||||
|
||||
echo "${LIST}" | xargs -n2 bash -c './bin/dataInterval.awk "$@"' FILLER;
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Cat results for each variable VIAERR_i into single output
|
||||
#
|
||||
|
||||
n="$1" # number of measures P_i, input
|
||||
MEASUREBASE="VIAERR_" # measure P_ with index i
|
||||
CSVFILE="$2" # results file, input
|
||||
|
||||
for i in $(seq 1 $n); do
|
||||
LIST="${LIST} ${MEASUREBASE}${i} ${CSVFILE}"
|
||||
done
|
||||
|
||||
echo "${LIST}" | xargs -n2 bash -c './bin/dataYtl.awk "$@"' FILLER;
|
|
@ -0,0 +1,12 @@
|
|||
#!/sw/bin/awk -F, --exec
|
||||
|
||||
BEGIN{
|
||||
measure=ARGV[1]
|
||||
ARGV[1]=ARGV[2]
|
||||
ARGC=2
|
||||
}
|
||||
|
||||
/Mean/ && $3==measure {
|
||||
printf"%s %s %s %s %s\n",$3,$4,$5,$6,$8 # Name,Start Time,End Time,Mean,Confidence Interval
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
# get minimum value matching measure1 for a compressed input file
|
||||
# such that measure2 is less than or equal to Threshold value
|
||||
# for each solver listed in input after 4-th argument
|
||||
MEASURE1="$1"
|
||||
MEASURE2="$2"
|
||||
THRESHOLD="$3"
|
||||
GZFILENAME="$4"
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
SOLVERS="$*"
|
||||
|
||||
SOLVERIND=0;
|
||||
for SOLVER in $SOLVERS; do
|
||||
let "SOLVERIND=SOLVERIND+1"
|
||||
GZFILE="../${SOLVER}/${GZFILENAME}"
|
||||
list1=$(gzip -dc "${GZFILE}" | awk -v measure="${MEASURE1}" -F, '/Mean/ && $3==measure { e=$1; gsub(/Experiment /,"",e); printf("%d %s %s %s %s\n",e,$3,$4,$6,$8) }')
|
||||
list2=$(gzip -dc "${GZFILE}" | awk -v measure="${MEASURE2}" -F, '/Mean/ && $3==measure { e=$1; gsub(/Experiment /,"",e); printf("%d %s %s %s %s\n",e,$3,$4,$6,$8) }')
|
||||
# Experiment number,Name,Start Time,Mean,Confidence Interval
|
||||
sortedlist=$(paste <(echo "$list1") <(echo "$list2") | sort -g -k4,4 -k1,1)
|
||||
# echo "$sortedlist"
|
||||
echo "$sortedlist" | awk -v thr="${THRESHOLD}" -v ind=${SOLVERIND} -v solver="${SOLVER}" 'BEGIN{printf"%s %s", ind, solver} $9<=thr {printf" %s %s %s %s %s", $1, $4, $5, $9, $10; exit}END{printf"\n"}'
|
||||
# index (from 1),SOLVER,Experiment number,Mean Measure1,Confidence Interval Measure1,Mean Measure2,Confidence Interval Measure2
|
||||
# 1 sim_vardelta_T00_T0w10_DPT0diff10_DPw1_POLICY_2 22 5.4737232667E02 5.5140766248E00 3.7390350877E-05 2.7056667576E-06
|
||||
done
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
# get values matching measure for a compressed input file
|
||||
# for each solver print list of values
|
||||
MEASURE="$1"
|
||||
GZFILENAME="$2"
|
||||
shift
|
||||
shift
|
||||
SOLVERS="$*"
|
||||
|
||||
SOLVERIND=0;
|
||||
for SOLVER in $SOLVERS; do
|
||||
let "SOLVERIND=SOLVERIND+1"
|
||||
GZFILE="../${SOLVER}/${GZFILENAME}"
|
||||
gzip -dc "${GZFILE}" | awk -v measure="${MEASURE}" -F, '/Mean/ && $3==measure { e=$1; gsub(/Experiment /,"",e); printf("%d %s %s %s %s\n",e,$3,$4,$6,$8) }' | awk -v ind=${SOLVERIND} -v solver="${SOLVER}" 'BEGIN{printf"%s %s", ind, solver}{printf" %s %s %s", $1, $4, $5}END{printf"\n"}'
|
||||
# Experiment number,Name,Start Time,Mean,Confidence Interval
|
||||
# index (from 1),SOLVER,Experiment number,Mean,Confidence Interval, ...,Experiment number,Mean,Confidence Interval
|
||||
done
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
# get values matching measure for a compressed input file
|
||||
# and print sorted list of values
|
||||
# for each solver listed in input after 2-th argument
|
||||
MEASURE="$1"
|
||||
GZFILENAME="$2"
|
||||
shift
|
||||
shift
|
||||
SOLVERS="$*"
|
||||
|
||||
SOLVERIND=0;
|
||||
for SOLVER in $SOLVERS; do
|
||||
let "SOLVERIND=SOLVERIND+1"
|
||||
GZFILE="../${SOLVER}/${GZFILENAME}"
|
||||
gzip -dc "${GZFILE}" | awk -v measure="${MEASURE}" -F, '/Mean/ && $3==measure { e=$1; gsub(/Experiment /,"",e); printf("%d %s %s %s %s\n",e,$3,$4,$6,$8) }' | sort -g -k 4,4 -k1,1 | awk -v ind=${SOLVERIND} -v solver="${SOLVER}" 'BEGIN{printf"%s %s", ind, solver}{printf" %s %s %s", $1, $4, $5}END{printf"\n"}'
|
||||
# Experiment number,Name,Start Time,Mean,Confidence Interval
|
||||
# index (from 1),SOLVER,Experiment number,Mean,Confidence Interval, ...,Experiment number,Mean,Confidence Interval
|
||||
done
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
# get values matching measure for a compressed input file
|
||||
# and print reverse sorted list of values
|
||||
# for each solver listed in input after 2-th argument
|
||||
MEASURE="$1"
|
||||
GZFILENAME="$2"
|
||||
shift
|
||||
shift
|
||||
SOLVERS="$*"
|
||||
|
||||
SOLVERIND=0;
|
||||
for SOLVER in $SOLVERS; do
|
||||
let "SOLVERIND=SOLVERIND+1"
|
||||
GZFILE="../${SOLVER}/${GZFILENAME}"
|
||||
gzip -dc "${GZFILE}" | awk -v measure="${MEASURE}" -F, '/Mean/ && $3==measure { e=$1; gsub(/Experiment /,"",e); printf("%d %s %s %s %s\n",e,$3,$4,$6,$8) }' | sort -r -g -k 4,4 -k1,1 | awk -v ind=${SOLVERIND} -v solver="${SOLVER}" 'BEGIN{printf"%s %s", ind, solver}{printf" %s %s %s", $1, $4, $5}END{printf"\n"}'
|
||||
# Experiment number,Name,Start Time,Mean,Confidence Interval
|
||||
# index (from 1),SOLVER,Experiment number,Mean,Confidence Interval, ...,Experiment number,Mean,Confidence Interval
|
||||
done
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
# get values matching measure for a compressed input file
|
||||
MEASURE="$1"
|
||||
GZFILE="$2"
|
||||
|
||||
gzip -dc "${GZFILE}" | awk -v measure="${MEASURE}" -F, '/Mean/ && $3==measure { printf"%s %s %s %s\n",$3,$4,$6,$8 }'
|
||||
# Name,Start Time,Mean,Confidence Interval
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
# It converts the first argument into a grayscale eps
|
||||
|
||||
if [ "$(echo $1|awk -F . '{print $NF}')" = "eps" ]; then
|
||||
gs -sOutputFile=$(basename $1 .eps)"grayscale.pdf" \
|
||||
-sDEVICE=pdfwrite -sColorConversionStrategy=Gray \
|
||||
-dProcessColorModel=/DeviceGray -dCompatibilityLevel=1.4 \
|
||||
-dNOPAUSE -dBATCH -dEPSCrop $1;
|
||||
pdfcrop $(basename $1 .eps)"grayscale.pdf";
|
||||
pdftops -eps $(basename $1 .eps)"grayscale-crop.pdf" $(basename $1 .eps)"_grayscale.eps";
|
||||
rm $(basename $1 .eps)"grayscale.pdf";
|
||||
rm $(basename $1 .eps)"grayscale-crop.pdf";
|
||||
else
|
||||
echo "Not an EPS file";
|
||||
fi
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
# gen data and plots for each dir starting with MS in current dir
|
||||
|
||||
MYDIR="$PWD"
|
||||
|
||||
for i in `ls -1d *|grep -v bin` ; do
|
||||
|
||||
echo ""
|
||||
echo "cd ${MYDIR}/${i}"
|
||||
echo ""
|
||||
cd "${MYDIR}/${i}"
|
||||
|
||||
./bin/go.bash
|
||||
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "cd $MYDIR"
|
||||
echo ""
|
||||
cd $MYDIR
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
# gen data and plots for each dir starting with MS in current dir
|
||||
|
||||
MYDIR="$PWD"
|
||||
|
||||
for i in `ls -1d *|grep WP` ; do
|
||||
|
||||
echo ""
|
||||
echo "cd ${MYDIR}/${i}"
|
||||
echo ""
|
||||
cd "${MYDIR}/${i}"
|
||||
|
||||
./bin/go.bash
|
||||
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "cd $MYDIR"
|
||||
echo ""
|
||||
cd $MYDIR
|
|
@ -0,0 +1,210 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# import mobius results files from remote host
|
||||
|
||||
function main () {
|
||||
|
||||
|
||||
# the absolute project path where is all the stuff, three directories above the script:
|
||||
# 3 2 1 0
|
||||
# basedir/gnuplot/bin/<script>
|
||||
BASEDIR=$(scriptancestorpath 3)
|
||||
# check if basedir contains Fig_src/gnuplot/bin
|
||||
checkmergedpaths "${BASEDIR}" "gnuplot/bin"
|
||||
|
||||
# name of the basedir
|
||||
BASENAME=$(basename "${BASEDIR}")
|
||||
|
||||
# Fig_src
|
||||
FIG_SRC_DIR="${BASEDIR}"
|
||||
|
||||
# list of project name (different project names for different lines) and (space separed) solver name patterns from which the files are imported
|
||||
# PROJECTPATTERNLIST="projectname1 solvernamepattern1a solvernamepattern1b
|
||||
# projectname1 solvernamepattern2
|
||||
# ...
|
||||
# projectname4 solvernamepattern4a solvernamepattern4b solvernamepattern4c"
|
||||
#
|
||||
# e.g.:
|
||||
# PROJECTPATTERNLIST="EPS_MultiRegion_LP MS_*_kDPmax1p2_* MS_*varIndex
|
||||
# EPS_trunk MS_EPSREG_simpleG2S2L3_varCNETfailRepRate"
|
||||
#
|
||||
PROJECTPATTERNLIST="
|
||||
#parallelWorkingStations_TwoApps_cs ms_vark_n100_delta10 ms_vark_n1000_delta10
|
||||
#STINGRAY_Availability sim_vardelta_T0m15_T0w*_DPT0diff*_DPw*
|
||||
STINGRAY_Availability sim_vardelta_T0m15_T0w*_DPT0diff*_DPw*
|
||||
"
|
||||
|
||||
# list space separed patterns of file names to imports
|
||||
#FILES_PATTERN="Results_Experiment_*.txt Results_results.csv Results_results.txt"
|
||||
FILES_PATTERN="Results_results.csv Results_results.txt"
|
||||
|
||||
# where are the projects on remote host
|
||||
REMOTE_MOBIUS_PROJECT="\${HOME}/mobius-project"
|
||||
|
||||
# imported files are restored on local host in ${OUTDIR}/Solver/<solvername>/
|
||||
OUTDIR="${FIG_SRC_DIR}/mobius"
|
||||
|
||||
MYDIR="$PWD"
|
||||
|
||||
# remote host
|
||||
REMOTE_HOST="bradipo.isti.cnr.it"
|
||||
REMOTE_USER="silvano"
|
||||
|
||||
|
||||
#CPIO="cpio -oaV --verbose -H ustar "
|
||||
CPIO="cpio -oaV --verbose "
|
||||
GZIP="gzip -c "
|
||||
GUNZIP="gunzip -c "
|
||||
SSH="/usr/bin/ssh "
|
||||
|
||||
E_BADARGS=1
|
||||
|
||||
while getopts ":nh" opt; do
|
||||
case $opt in
|
||||
n)
|
||||
if [ "${OPTARG:0:1}" == "-" ]; then
|
||||
echo "Invalid parameter \"${OPTARG}\" provided for agurment \"-${opt}!\""
|
||||
hflag=1
|
||||
else
|
||||
# echo "-n was triggered! Parameter: $OPTARG" >&2
|
||||
nflag=1
|
||||
fi
|
||||
;;
|
||||
h)
|
||||
if [ "${OPTARG:0:1}" == "-" ]; then
|
||||
echo "Invalid parameter \"${OPTARG}\" provided for agurment \"-${opt}!\""
|
||||
hflag=1
|
||||
else
|
||||
# echo "-h was triggered! Parameter: $OPTARG" >&2
|
||||
hflag=1
|
||||
fi
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
hflag=1
|
||||
E_BADARGS=65
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
hflag=1
|
||||
E_BADARGS=65
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$hflag" ]; then
|
||||
echo -e "Usage: `basename $0` [-n]"
|
||||
echo -e "Option -n: are imported only the (matching patterns) files that have a more recent last modification time than last time this script has been executed."
|
||||
exit $E_BADARGS
|
||||
fi
|
||||
|
||||
mkdir "${OUTDIR}"
|
||||
|
||||
IFS=$' '
|
||||
FINDNAMES=""
|
||||
for i in ${FILES_PATTERN}; do
|
||||
if [ "${FINDNAMES}" == "" ]; then
|
||||
|
||||
FINDNAMES="-name \"${i}\" "
|
||||
else
|
||||
FINDNAMES="${FINDNAMES} -o -name \"${i}\" "
|
||||
fi
|
||||
done
|
||||
|
||||
# remove comments
|
||||
PROJECTPATTERNLIST=$(echo "${PROJECTPATTERNLIST}" | awk '!/^[ ]*#.*/ {printf "%s\n", $0}')
|
||||
|
||||
IFS=$'\n'
|
||||
for i in ${PROJECTPATTERNLIST}; do
|
||||
PROJECT=$(echo ${i} | awk '{print $1}')
|
||||
PATTERN=$(echo ${i} | awk '{for(i=2;i<=NF;i++)printf"\"%s\"\n",$i}')
|
||||
|
||||
SOLVER="./${PROJECT}/Solver"
|
||||
|
||||
# get -path
|
||||
FINDPATHS=""
|
||||
for j in ${PATTERN}; do
|
||||
j=${j#\"} # remove starting "
|
||||
j=${j%\"} # remove ending "
|
||||
PATHPATTERN="${SOLVER}/${j}/*"
|
||||
if [ "${FINDPATHS}" == "" ]; then
|
||||
FINDPATHS="-path \"${PATHPATTERN}\" "
|
||||
else
|
||||
FINDPATHS="${FINDPATHS} -o -path \"${PATHPATTERN}\" "
|
||||
fi
|
||||
done
|
||||
|
||||
OUTFILENAME="archive_${PROJECT}.cpio.gz"
|
||||
OUTFILE="${OUTDIR}/${OUTFILENAME}"
|
||||
|
||||
LASTTIMEFLAG="${REMOTE_MOBIUS_PROJECT}/${SOLVER}/._LASTIMPORTFLAG"
|
||||
FINDNEWER=""
|
||||
if [ "$nflag" == "1" ]; then
|
||||
echo -e "Importing only files modified after last execution."
|
||||
FINDNEWER="-newer ${LASTTIMEFLAG}"
|
||||
fi
|
||||
|
||||
cd "${MYDIR}"
|
||||
|
||||
echo ""
|
||||
echo "Obtaining: ${PROJECT} with pattern ${PATTERN} ..."
|
||||
REMOTECMD="cd \"${REMOTE_MOBIUS_PROJECT}\" && find ./ ${FINDNEWER} \\( ${FINDPATHS} \\) \\( ${FINDNAMES} \\) -print | ${CPIO} | ${GZIP}; touch \"${LASTTIMEFLAG}\" "
|
||||
echo "${REMOTECMD}"
|
||||
echo "${REMOTECMD}" | eval ${SSH} -v -l "${REMOTE_USER}" "${REMOTE_HOST}" bash -s | cat > "${OUTFILE}"
|
||||
|
||||
# important note about alternative commands to transfer data from remote host:
|
||||
# the following transfer data commands corrupt the .gz file, due to the first "cd" command in the REMOTECMD variable:
|
||||
# /usr/bin/ssh -l "${REMOTE_USER}" "${REMOTE_HOST}" "${REMOTECMD}" > "${OUTFILE}"
|
||||
# /usr/bin/ssh -l "${REMOTE_USER}" "${REMOTE_HOST}" bash -c "${REMOTECMD}" > "${OUTFILE}"
|
||||
|
||||
cd "${OUTDIR}"
|
||||
|
||||
# on local host
|
||||
echo ""
|
||||
echo "Restoring files from ${OUTFILE}..."
|
||||
UNAME="$(uname -n)"
|
||||
if [ "${UNAME}" == "cicala.local" ]; then
|
||||
eval "${GUNZIP} ${OUTFILENAME}" | cpio -u -i -d
|
||||
else
|
||||
eval "${GUNZIP} ${OUTFILENAME}" | cpio -u -i -d
|
||||
fi
|
||||
done
|
||||
|
||||
cd "${MYDIR}"
|
||||
|
||||
echo ""
|
||||
echo "Done!"
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
# get the i-th ancestor path of the script that calls this function (the currently running script)
|
||||
# i=0: for the path of the script,
|
||||
# i=1: for the directory where is the script,
|
||||
# i=2: for the directory including the directory corresponding to i=1,
|
||||
# etc...
|
||||
# $1: level of the ancestor path (from the end of the path)
|
||||
scriptancestorpath () {
|
||||
[[ $1 -lt 0 ]] && { echo "Ops! Input less than 0: $1"; exit 1; }
|
||||
local THEPATH="$(cd "$(dirname "$0")"; pwd)/$(basename "$0")"
|
||||
i=1
|
||||
while [[ $i -le ${1} && "${THEPATH}" != "/" ]]; do
|
||||
THEPATH="$(cd "$(dirname "$THEPATH")"; pwd)"
|
||||
let i=i+1
|
||||
done
|
||||
# echo "depth: $i"
|
||||
echo "${THEPATH}"
|
||||
}
|
||||
|
||||
# check if the $1/$2 exists
|
||||
# $1: path of directory
|
||||
# $2: path of directory or file
|
||||
checkmergedpaths() {
|
||||
if [[ ! -e "${1}/${2}" ]]; then
|
||||
echo "Ops! Element not found: ${1}/${2}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
# run this script from directory SOLVERNAME
|
||||
|
||||
PROJECTNAME="STINGRAY_Multipolicy"
|
||||
SOLVERNAME="sim_WScenario_m15_1_10_1_POLICY_0_NN"
|
||||
SERVERNAME="bradipo"
|
||||
|
||||
SOLVER="${HOME}/MobiusProject/${PROJECTNAME}/Solver/${SOLVERNAME}"
|
||||
#cd "${SOLVER}"
|
||||
#########################
|
||||
|
||||
# get T0
|
||||
MEASURE="VT0"
|
||||
AFILE="Results_Exp1_N100_s187704482_cicala.local_ascii.csv"
|
||||
COL=1
|
||||
awk -v name="${MEASURE}" -v nofm=289 -f ../../awk/mean.awk <(gzip -dc Results_results.csv.gz) <(gzip -dc ${AFILE}) > track_${MEASURE}.txt
|
||||
cat "./track_${MEASURE}.txt" | awk -v c="${COL}" '{print $c }' > track_${MEASURE}_c30.txt
|
||||
|
||||
# get T_18
|
||||
MEASURE="VT_18"
|
||||
AFILE="Results_Exp1_N100_s187704482_cicala.local_ascii.csv"
|
||||
COL=1
|
||||
awk -v name="${MEASURE}" -v nofm=289 -f ../../awk/mean.awk <(gzip -dc Results_results.csv.gz) <(gzip -dc ${AFILE}) > track_${MEASURE}.txt
|
||||
cat "./track_${MEASURE}.txt" | awk -v c="${COL}" '{print $c}' > track_${MEASURE}_c30.txt
|
||||
|
||||
# get VDP
|
||||
MEASURE="VDP"
|
||||
AFILE="Results_Exp1_N100_s187704482_cicala.local_ascii.csv"
|
||||
COL=1
|
||||
awk -v name="${MEASURE}" -v nofm=289 -f ../../awk/mean.awk <(gzip -dc Results_results.csv.gz) <(gzip -dc ${AFILE}) > track_${MEASURE}.txt
|
||||
cat "./track_${MEASURE}.txt" | awk -v c="${COL}" '{print $c}' > track_${MEASURE}_c30.txt
|
|
@ -0,0 +1,218 @@
|
|||
################################################
|
||||
# plot the measure (Mean or Variance) as a function of time (on x axis)
|
||||
# generate plot for aqua terminal
|
||||
aqua=1
|
||||
# generate plot for table terminal (print out a multicolumn ASCII table of X Y {Z} R values)
|
||||
table=1
|
||||
# generate plot for tikz: standalone output
|
||||
tikzsa=1
|
||||
|
||||
# transparence for filledcurves (confidence interval)
|
||||
filltransparence=0.3
|
||||
|
||||
# gnuplot data file separator
|
||||
set datafile separator whitespace
|
||||
|
||||
# Enable the use of macros
|
||||
set macros
|
||||
|
||||
# unitary cost of energy
|
||||
costE=1
|
||||
|
||||
# unitary cost of having a switch unavailable
|
||||
costU=10
|
||||
|
||||
# cost of having at least a frozen switch at some point during the day
|
||||
costF=2000
|
||||
|
||||
# number of values for Deltam (DPm max age)
|
||||
ndeltam=5
|
||||
|
||||
# number of values for Tthr
|
||||
ndeltat=6
|
||||
|
||||
# number of values for T epsilon1
|
||||
nepsilon1=7
|
||||
|
||||
# number of values for T epsilon2
|
||||
nepsilon2=7
|
||||
|
||||
# number of values for DPepsilon1
|
||||
ndpepsilon1=7
|
||||
|
||||
# number of values for DPepsilon2
|
||||
ndpepsilon2=7
|
||||
|
||||
# time of analysis (min)
|
||||
t=1440
|
||||
|
||||
# number of swithces
|
||||
n=19
|
||||
|
||||
# energy consumed for time unit
|
||||
energyfortimeunit=7.4/60.0
|
||||
|
||||
# get name of current dir
|
||||
cmd="mypath=$(pwd | sed -e 's/_/-/g'); echo ${mypath##*/} "
|
||||
currdir=system(cmd)
|
||||
|
||||
# bin path
|
||||
bin="../bin/"
|
||||
|
||||
dir="./"
|
||||
csvfile="Results_results.csv"
|
||||
csvgzfile="Results_results.csv.gz"
|
||||
# data file path for scenario name
|
||||
datapath(name)=sprintf("../%s/%s",name,csvgzfile)
|
||||
|
||||
# dir path for data of scenario name
|
||||
dirdatapath(name)=sprintf("../%s/",name)
|
||||
|
||||
# print to check info
|
||||
print "data file csv: " . csvfile
|
||||
print "current directory: " . currdir
|
||||
|
||||
# get the i-th element of a list s of values separed by sep
|
||||
wordsep(s,i,sep)=system("echo ".s." |awk '{split($0,v,\"'".sep."'\");print v[".i."]}'")
|
||||
|
||||
# remove ext from input
|
||||
remext(s)=system("echo \"" . tikzfilesa . " \" | awk -F'.' '{NF-=1}1' OFS='.'")
|
||||
|
||||
# modulus function
|
||||
mod(x,y) = (x-floor(x/y)*y)
|
||||
# round function
|
||||
round(x)=floor(x +0.5)
|
||||
# round minutes function, x sec (ending +1 is needed to fix the label for 4800=01:20, otherwise it is labeled with 01:19)
|
||||
roundmin(x)=floor(x/60.0 +0.5)*60+1
|
||||
# input function of xticlabels to skip labels based on a step
|
||||
hhmmlabels(i,step,norm)=(mod(column(0),step)==0)?strftime("%002tH:%002tM",roundmin(column(i)*norm)):NaN
|
||||
#
|
||||
# old function where 24:00 is printed as 0:0
|
||||
# hhmmlabels(i,step,norm)=(mod(column(0),step)==0)?sprintf("%002d:%002d",tm_hour(column(i)*norm),tm_min(column(i)*norm)):NaN
|
||||
|
||||
# get global column index of the j-th entry of the i-th block, where each block groups k columns
|
||||
gcolind(i,j,k)=(i-1)*k+j
|
||||
|
||||
# get global column index of the j-th entry of the i-th block (passed by name), where each block groups k columns, nodeind(name)+1 is the index of the i-th block
|
||||
gcolindbyNodeName(name,j,k)=nodeind(name)*k+j
|
||||
|
||||
# convert string to number
|
||||
ston(i)=i+0
|
||||
|
||||
|
||||
reset
|
||||
|
||||
# Delay
|
||||
fig="01"
|
||||
measuretype="Active_Power"
|
||||
study="RangeStudy-Exp4_N32"
|
||||
title="Expected Unavailability for Day (min/day) vs Energy Consumption"
|
||||
|
||||
scenarios="sim_vardelta_T00_T0w1_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T00_T0w1_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T00_T0w1_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T00_T0w1_DPT0diff10_DPw10_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff10_DPw10_POLICY_0" # space separed list of scenarios to compare
|
||||
measurets="'\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
|
||||
serieinds="1" # list of the indexes corresponding to the scenarios to plot
|
||||
m=words(scenarios) # scenarios
|
||||
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
|
||||
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
|
||||
|
||||
# check input params
|
||||
if(words(measurets)>words(scenarios)) {
|
||||
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
|
||||
exit
|
||||
}
|
||||
|
||||
# check input params
|
||||
if(words(serieinds)>words(scenarios)) {
|
||||
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
|
||||
exit
|
||||
}
|
||||
|
||||
data(i)=datapath(word(scenarios,i))
|
||||
serieind(i)=word(serieinds,ston(i))
|
||||
lstyle(i)=ston(word(lstyles,ston(i)))
|
||||
|
||||
# styles
|
||||
set pointsize 1.5
|
||||
set style data lines
|
||||
lstyle(i)=ston(word(lstyles1,ston(i)))
|
||||
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
|
||||
lstyle2(i)=ston(word(lstyles2,ston(i)))
|
||||
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
|
||||
#set style line 1 lt lstyle(1) lw 1 pt 1
|
||||
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
|
||||
|
||||
measure="WUnavailability"
|
||||
measurelabel="\\(P\\)"
|
||||
measurey=measurelabel . " W"
|
||||
measure2="YUsedEnergy"
|
||||
measurelabel2="\\(\\mu_E\\)"
|
||||
measurey2=measurelabel2 . " (kWh)"
|
||||
measuret(i)=sprintf("%s, %s", measurelabel, word(measurets,ston(i)))
|
||||
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
|
||||
|
||||
tabfile=fig."-measure-".measuretype."-".study.".tab"
|
||||
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
|
||||
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
|
||||
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
|
||||
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
|
||||
|
||||
unset title
|
||||
set xlabel "Time"
|
||||
set ylabel measurey offset -1
|
||||
#set y2label measurey2
|
||||
#set format x "%2.1f"
|
||||
#set format y "%3.2f"
|
||||
set xtics nomirror
|
||||
#set xtics add ("0.2" 0.2)
|
||||
set ytics nomirror
|
||||
#set y2tics
|
||||
#set xrange [0:5]
|
||||
#set yrange [0:400]
|
||||
#set y2range [0:2200]
|
||||
#set y2tics add ("2200" 2200)
|
||||
set border 3
|
||||
#set key bottom left
|
||||
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
|
||||
unset logscale x
|
||||
unset logscale y
|
||||
|
||||
set term tikz
|
||||
set output tikzfile
|
||||
|
||||
#set label "$V_{B48}$" at 180,0.83
|
||||
#set arrow from 204,0.828 to 245,0.85
|
||||
|
||||
# plot for each scenario
|
||||
plot "< ../bin/data.awk Vt_PAv_DG_5 ../RangeStudy/Results_case33bw_2times_Exp4_N32_s31415_7c9ad127d859_results.csv" using 2:3 with line title "\\(PAv_{DG_5}\\)", \
|
||||
"< ../bin/data.awk Vt_P_62 ../RangeStudy/Results_case33bw_2times_Exp4_N32_s31415_7c9ad127d859_results.csv" using 2:3 with line title "\\(P_{62}\\)", \
|
||||
"< ../bin/data.awk Vt_UnsuppliedDemandAbs_62 ../RangeStudy/Results_case33bw_2times_Exp4_N32_s31415_7c9ad127d859_results.csv" using 2:3 with line title "\\(UnsuppliedDemand_{62}\\)", \
|
||||
0
|
||||
|
||||
#plot for[i=1:m:1] "<" .bin. "/datagz.bash " . measure . " " . data(i) using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
|
||||
# for[i=1:m:1] "<" .bin. "/datagz.bash " . measure2 . " " . data(i) using ($0):3 with lp ls i+m title measuret2(i) axes x1y2
|
||||
|
||||
if( tikzsa ) {
|
||||
set term tikz standalone
|
||||
set output tikzfilesa
|
||||
replot
|
||||
unset output
|
||||
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
|
||||
system(cmd)
|
||||
}
|
||||
|
||||
if( aqua ) {
|
||||
set output
|
||||
set term aqua fig
|
||||
replot
|
||||
}
|
||||
|
||||
if( table ) {
|
||||
set format x "% g"
|
||||
set format y "%g"
|
||||
set table tabfile
|
||||
replot
|
||||
unset table
|
||||
}
|
||||
|
||||
reset
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
gnuplot ../bin/gnuplot_figs.gp
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
gnuplot ../bin/gnuplot_figs_cmp.gp
|
|
@ -0,0 +1,78 @@
|
|||
#!/bin/bash
|
||||
# It crops and converts the pdf file into pdf file,
|
||||
|
||||
# HIRES="%%HiResBoundingBox"
|
||||
# HIRES="%%BoundingBox"
|
||||
|
||||
E_BADARGS=1
|
||||
while getopts ":rh" opt; do
|
||||
case $opt in
|
||||
r)
|
||||
if [ "${OPTARG:0:1}" = "-" ]; then
|
||||
echo "Invalid parameter \"${OPTARG}\" provided for agurment \"-${opt}!\""
|
||||
hflag=1
|
||||
else
|
||||
# echo "-n was triggered! Parameter: $OPTARG" >&2
|
||||
rflag=1
|
||||
fi
|
||||
;;
|
||||
h)
|
||||
if [ "${OPTARG:0:1}" = "-" ]; then
|
||||
echo "Invalid parameter \"${OPTARG}\" provided for agurment \"-${opt}!\""
|
||||
hflag=1
|
||||
else
|
||||
# echo "-h was triggered! Parameter: $OPTARG" >&2
|
||||
hflag=1
|
||||
fi
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
hflag=1
|
||||
E_BADARGS=65
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
hflag=1
|
||||
E_BADARGS=65
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
function help {
|
||||
echo -e "Usage: \t$0 [-r] <basefilename.pdf>"
|
||||
echo -e "This script generates the zero-margin cropped version of the input pdf file with suffix -crop."
|
||||
echo -e "Option -r: if this option is specified, the input file is replaced by the cropped version."
|
||||
}
|
||||
|
||||
if [ "$#" -lt 1 ] || [ "$hflag" ]; then
|
||||
help
|
||||
exit $E_BADARGS
|
||||
fi
|
||||
|
||||
EXT=$(echo "${1##*.}" | awk '{print tolower($0)}')
|
||||
if [ "${EXT}" != "pdf" ]; then
|
||||
echo "Ops! No pdf file!"
|
||||
help
|
||||
exit $E_BADARGS
|
||||
fi
|
||||
|
||||
basename=$(basename ${1} .pdf)
|
||||
dirname=$(dirname ${1})
|
||||
|
||||
echo "Cropping $1 ..."
|
||||
if [ "$rflag" == "1" ]; then
|
||||
pdfcrop -hires "${dirname}/${basename}.pdf" "${dirname}/${basename}-crop.pdf"
|
||||
echo "${dirname}/${basename}-crop.pdf -> ${dirname}/${basename}.pdf"
|
||||
mv -f "${dirname}/${basename}-crop.pdf" "${dirname}/${basename}.pdf"
|
||||
else
|
||||
pdfcrop -hires "${dirname}/${basename}.pdf" "${dirname}/${basename}-crop.pdf"
|
||||
fi
|
||||
# BBOX=$(gs -dSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox $(basename ${a} .pdf)".pdf" 2>&1 | awk '$1 ~ /'${HIRES}'/ {printf "%s %s %s %s", $2, $3, $4, $5}' )
|
||||
# gs -sOutputFile=$(basename ${a} .pdf)"-crop.pdf" \
|
||||
# -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \
|
||||
# -dNOPAUSE -dBATCH \
|
||||
# -c "[/CropBox [${BBOX}] /PAGES pdfmark" \
|
||||
# -f $(basename ${a} .pdf)".pdf"
|
||||
|
Loading…
Reference in New Issue