-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgen_3Dplot.sh
More file actions
executable file
·63 lines (58 loc) · 1.93 KB
/
gen_3Dplot.sh
File metadata and controls
executable file
·63 lines (58 loc) · 1.93 KB
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
#!/bin/bash
num_args=$#
if [ "$num_args" -eq "0" ]; then
echo "#----------------------------------------------------"
echo "Creates a customized 3D-plot from the input parameters."
echo "#Parameters needed:"
echo " #1: Path to the results to be plottet"
echo " #2: Column from results to be on the x-grid"
echo " #3: Column from results to be on the y-grid"
echo " #4: Column from results to be on the z-grid"
echo " #5: Path with name of the plot"
fi
cp build/plot_template.m temp_plot_gen.m
###CURVE###
PATH_CURVE=$1
PATH_RESULT=${PATH_CURVE%/*}
COL_X=$2
COL_Y=$3
COL_Z=$4
#--------------------------
sed -i "/#Input Files#/a input_file=\"../../../${PATH_CURVE}\";" temp_plot_gen.m
#--------------------------
sed -i "/#Axis Options#/a x_axis=${COL_X};" temp_plot_gen.m
sed -i "/#Axis Options#/a y_axis=${COL_Y};" temp_plot_gen.m
sed -i "/#Axis Options#/a z_axis=${COL_Z};" temp_plot_gen.m
#--------------------------
sed -i "/#Data Save#/a rff=fopen(input_file); \\
fgetl(rff); \\
while(-1 ~= (line=fgetl(rff))) \\
val=str2num(line); \\
data(line_i++,:)=val; \\
end \\
fclose(rff); \\
" temp_plot_gen.m
#--------------------------
sed -i "/#Plotting Curve#/a tri=delaunay(data(:,x_axis),data(:,y_axis)); \\
trisurf(tri, data(:,x_axis), data(:,y_axis), data(:,z_axis)); \\
set(gca, 'XScale', 'log', 'YScale', 'log'); \\
view(-55,-15); \\
" temp_plot_gen.m
#--------------------------
sed -i "/#Set Labels#/a xlabel(\"\");\\
ylabel(\"\");\\
zlabel(\"\");\\
" temp_plot_gen.m
#--------------------------
OUT_PATH=$5
OUT_NAME=${OUT_PATH##*/}
sed -i "/#Output Name#/a output_name=\"${OUT_NAME}\";" temp_plot_gen.m
#--------------------------
sed -i "/#Save Output#/a print(strcat(\"\",output_name,\"_faceted\"), '-depsc'); \\
shading interp \\
print(strcat(\"\",output_name,\"_interp\"), '-depsc'); \\
close all\\
" temp_plot_gen.m
mv temp_plot_gen.m ${OUT_PATH}_genfile.m
#octave temp_plot_gen.m
#rm temp_plot_gen.m