-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfascia_wszystkie.sh
executable file
·68 lines (52 loc) · 1.68 KB
/
fascia_wszystkie.sh
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
#!/bin/bash
set -e
NETWORK_DIR="sieci"
TEMPLATE_DIRS=(graphs_n3_1 graphs_n4_2 graphs_n5_3 graphs_n6_6)
NUMRANDOMS=100
RANDITERS=10
strip() {
sed -E 's/^[^0-9\.e\+]*//g'
}
norm_name () {
tmp=$(echo "$1" | tr '.' '_' | tr '/' '_')
echo "${tmp%_graph}"
}
mode="meanRandom" # albo expER
target_file="fascia_results_${mode}.csv"
echo "siec;kandydat;max_iteracji;iteracje;wynik;motyw" > "$target_file"
# Obliczenia dla sieci wejściowych
for netfilename in $(ls "$NETWORK_DIR" | grep graph); do
echo "Network: $netfilename"
# Zrób plik wynikowy
netname=$(norm_name "$netfilename") # nazwa do csv
network="$NETWORK_DIR/$netfilename" # pełna ścieżka
# Sieci losowe
bin/ensemble $network $NUMRANDOMS
for tmpdir in ${TEMPLATE_DIRS[*]}; do
for template in $(ls "motif/$tmpdir" | grep graph); do
# Zapisz nazwę motywu
prefix=$(norm_name "$tmpdir/$template")
templatepath="motif/$tmpdir/$template"
echo -n "${netname};" >> "$target_file"
echo -n "${prefix};" >> "$target_file"
rm -f losowe.csv
for i in random_graphs/*; do
echo -en "\r$i"
bin/fascia -g "$i" -t $templatepath -i "$RANDITERS" |\
grep -v 'Single' |\
grep -E '[0-9]' |\
strip >>\
losowe.csv
done
# Średnia dla sieci podobnych
echo "\nTemplate: ${templatepath}"
NETITERS=$(python3 niter.py $network $templatepath $mode)
echo "Max. iteracji: $NETITERS"
echo -n "${NETITERS};" >> "$target_file"
bin/fascia -g $network -t $templatepath -i "$NETITERS" |\
grep --line-buffered Single |\
stdbuf -oL sed 's/Single //g' |\
python3 srednia_fascii.py >> "$target_file"
done
done
done