-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·67 lines (48 loc) · 1.72 KB
/
run.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
#!/bin/bash
# A simple bash script to generate output from stationary.py
# usage:
# ./run.sh <filename> <bool for whether to round or not> <stest> <p-value>
if [ "$1" == "" ]; then
echo "Gotta specify a file!"
exit
fi
rstring=""
if [ "$2" != "" ]; then
rstring="-r "$2
fi
sstring=""
if [ "$3" != "" ]; then
sstring="-s "$3
fi
pstring=""
if [ "$4" != "" ]; then
pstring="-p "$4
fi
echo "Running " $1
#./change_format.py $1 cfile
rm -f output/*
echo ./stationary.py -f $1 $rstring $sstring $pstring -t 1
./stationary.py -f $1 $rstring $sstring $pstring -t 1
#set -x
startval=$(cat output/startval)
# original file minus linear term, and add the typical cycle
asy -f pdf plot.asy -u "filenames=\"output/data.in\"; xlabel=\"time\"; ylabel=\"signal\"; sscale=\"linlin\" ; start=$startval"
mv plot.pdf data.pdf
if [ "$startval" -ge "0" ]; then
# autocorrelation
asy -f pdf plot.asy -u "filenames=\"output/data.ac\"; xlabel=\"lag\"; ylabel=\"correlation\"; sscale=\"linlin\" ; x95=true"
mv plot.pdf data_ac.pdf
# FFT of autocorrelation
asy -f pdf plot.asy -u "filenames=\"output/data.fac\"; xlabel=\"lag\"; ylabel=\"correlation\"; sscale=\"loglog\""
mv plot.pdf data_fac.pdf
nperiods=$(cat output/nperiods)
if [ $nperiods != "0" ]; then
# find all the typical run files, turn newlines into commas,
# remove last comma.
TYPS=$(ls -1 output/data.ytyp* | egrep 'data.ytyp' | tr '\n' ','| sed s'/.$//' )
asy -f pdf plot.asy -u "filenames=\"${TYPS}\"; xlabel=\"time\"; ylabel=\"signal\"; sscale=\"linlin\"" &> /dev/null
mv plot.pdf data_typ.pdf
fi
asy -f pdf plot.asy -u "filenames=\"output/data.np\"; xlabel=\"time\"; ylabel=\"signal\"; sscale=\"linlin\""
mv plot.pdf data_np.pdf
fi