-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate
executable file
·135 lines (122 loc) · 2.6 KB
/
generate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
print_status_msg() {
echo -e "[generate] "$1;
}
print_msg() {
echo -e $1
}
run_analysis() {
print_status_msg "Running analysis on data sets"
cd scripts
./pipeline.py ../data_sets
./createHtmlDocs.py
cd ..
}
clean_results() {
print_status_msg "Cleaning results"
cd scripts
./pipeline.py clean
cd ..
}
compile_report() {
print_status_msg "Generating report"
cd report
pdflatex report
bibtex report
pdflatex report
pdflatex report
pdflatex report
cd ..
}
clean_report() {
print_status_msg "Cleaning report folder"
cd report
rm *.aux
rm *.log
rm report.out
rm report.bbl
rm report.blg
rm report.toc
rm report.pdf
cd ..
}
create_misc_latex() {
print_status_msg "Running the createLatex script for subfigures etc"
cd scripts
./createLatex.py
cd ..
}
view_report() {
if ! [[ "$1" == "yes" ]]; then
print_msg "Would you like to display the report (y/n)?"
read dispans
case "$dispans" in
y|yes);;
*)
exit 0
;;
esac
fi
if ! [ -e report/report.pdf ]; then
print_msg "The report does not exist, compile it first!"
exit 1
fi
print_status_msg "Displaying report"
# Choose pdf viewer depending on OS
osname=`uname`
if [[ "$osname" == "Linux" ]]; then
evince report/report.pdf&
elif [[ "$osname" == "Darwin" ]]; then
open report/report.pdf
fi
}
print_help() {
print_msg "Script to generate analysis results and compile the report"
print_msg ""
print_msg "Usage:"
print_msg "generate option"
print_msg ""
print_msg "Options:"
print_msg "all\t\t Runs analysis and compiles the report."
print_msg "report\t\t Compiles the report only."
print_msg "analysis\t Runs the analysis only."
print_msg "viewreport\t Displays the report using a PDF viewer."
print_msg "clean\t\t Removes the folder 'results' containing all anaylsis results as well as cleaning the 'report' folder from all files created by Latex."
print_msg ""
}
# Handle the script's options
case "$1" in
all)
run_analysis
create_misc_latex
compile_report
print_status_msg "Done"
view_report
;;
report)
# Can only generate report if results exists
if [ ! -d results/ ]; then
print_status_msg "Results are missing! Run analysis before compiling report!"
exit
fi
create_misc_latex
compile_report
print_status_msg "Done"
view_report
;;
analysis)
run_analysis
print_status_msg "Done"
;;
viewreport)
view_report yes
;;
clean)
clean_results
clean_report
print_status_msg "Done"
;;
--help|*)
print_help
;;
esac