Newer
Older
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
#!/bin/bash
#git clone --depth 1 https://eicweb.phy.anl.gov/EIC/datasets.git
export DAWN_PS_PREVIEWER="ls"
OUT_FILE=".DAWN_1.history"
function print_the_help {
echo "USAGE: ${0} [-s <skip_events>] -d <dawn_run_dir> "
echo " OPTIONS: "
echo " -x targeted x coordinate position"
echo " -y targeted x coordinate position"
echo " -z targeted x coordinate position"
echo " --theta viewing angle"
echo " --phi viewing angle"
echo " -m,--mag magnification"
echo " -d,--dawn-dir <dawn_run_dir> Directory with the .DAWN files and a generate script "
exit
}
function yes_or_no {
while true; do
read -p "$* [y/n]: " yn
case $yn in
[Yy]*) return 0 ;;
[Nn]*) echo "No entered" ; return 1 ;;
esac
done
}
if [[ $# -eq 0 ]] ; then
print_the_help
exit
fi
SKIP_EVENTS=0
DETECTOR_ONLY=0
FILE_TAG="view"
DAWN_RUN_DIR="."
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
;;
-x)
echo "updating x coordinate to ${2}"
sed -i '5d' ${DAWN_RUN_DIR}/${OUT_FILE}
sed -i '5i'${2} ${DAWN_RUN_DIR}/${OUT_FILE}
shift # past argument
shift # past value
;;
-y)
echo "updating y coordinate to ${2}"
sed -i '6d' ${DAWN_RUN_DIR}/${OUT_FILE}
sed -i '6i'${2} ${DAWN_RUN_DIR}/${OUT_FILE}
shift # past argument
shift # past value
;;
-z)
echo "updating z coordinate to ${2}"
sed -i '7d' ${DAWN_RUN_DIR}/${OUT_FILE}
sed -i '7i'${2} ${DAWN_RUN_DIR}/${OUT_FILE}
shift # past argument
shift # past value
;;
--theta)
echo "updating theta angle to ${2}"
sed -i '3d' ${DAWN_RUN_DIR}/${OUT_FILE}
sed -i '3i'${2} ${DAWN_RUN_DIR}/${OUT_FILE}
shift # past argument
shift # past value
;;
--phi)
echo "updating phi angle to ${2}"
sed -i '2d' ${DAWN_RUN_DIR}/${OUT_FILE}
sed -i '2i'${2} ${DAWN_RUN_DIR}/${OUT_FILE}
shift # past argument
shift # past value
;;
--mag)
echo "updating magnification to ${2}"
sed -i '8d' ${DAWN_RUN_DIR}/${OUT_FILE}
sed -i '8i'${2} ${DAWN_RUN_DIR}/${OUT_FILE}
shift # past argument
shift # past value
;;
-i|--input)
OUT_FILE="$2"
shift # past argument
shift # past value
;;
-o|--ouput-dir)
OUTPUT_DIR="$2"
shift # past argument
shift # past value
;;
-D|--detector-only)
DETECTOR_ONLY=1
shift # past argument
#shift # past value
;;
-d|--dawn-dir)
DAWN_RUN_DIR=$2
shift # past argument
shift # past value
;;
-t|--tag)
FILE_TAG=$2
shift # past argument
shift # past value
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters