Jpp  18.4.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JAcousticsToolkit.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 script=${0##*/}
3 
4 # ------------------------------------------------------------------------------------------
5 #
6 # Toolkit for acoustics scripts.
7 #
8 # ------------------------------------------------------------------------------------------
9 
10 if [ -z $JPP_DIR ]; then
11  echo "Variable JPP_DIR undefined."
12  exit
13 fi
14 
15 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
16 
17 if do_usage $*; then
18  usage "source $script"\
19  "\nToolkit for acoustics scripts."
20 fi
21 
22 #
23 # Acoustics keys for input files.
24 #
25 ACOUSTICS_KEYS=(
26  sound_velocity
27  waveform
28  mechanics
29  acoustics_trigger_parameters
30  acoustics_fit_parameters
31  disable)
32 
33 
34 #
35 # Acoustics keys for auxiliary files.
36 #
37 ACOUSTICS_AUXS=(
38  tripod
39  hydrophone
40  transmitter)
41 
42 
43 #
44 # Method to add tripod data from given file into associative array.
45 #
46 # \param 1 file name
47 # \param 2 associative array
48 #
49 function get_tripods+()
50 {
51  set_local_variable __FILE__ $1
52  set_local_variable __ARRAY__ $2
53 
54  while read __line__; do
55 
56  if [[ -n "$__line__" && "$__line__" != \#* ]]; then
57 
58  echo $__line__ | read __id__ __x__ __y__ __z__
59 
60  eval ${__ARRAY__}\[${__id__}\]=\"$__x__ $__y__ $__z__\"
61  fi
62 
63  done < $__FILE__
64 }
65 
66 
67 #
68 # Method to write tripod data from given file into associative array.
69 #
70 # \param 1 file name
71 # \param 2 associative array
72 #
73 function get_tripods()
74 {
75  eval $2=\(\)
76 
77  get_tripods+ $1 $2
78 }
79 
80 
81 #
82 # Method to add transmitter data from given file into associative array.
83 #
84 # \param 1 file name
85 # \param 2 associative array
86 #
87 function get_transmitters+()
88 {
89  set_local_variable __FILE__ $1
90  set_local_variable __ARRAY__ $2
91 
92  while read __line__; do
93 
94  if [[ -n "$__line__" && "$__line__" != \#* ]]; then
95 
96  echo $__line__ | read __id__ __string__ __floor__ __x__ __y__ __z__
97 
98  eval ${__ARRAY__}\[${__id__}\]=\"$__x__ $__y__ $__z__\"
99  fi
100 
101  done < $__FILE__
102 }
103 
104 
105 #
106 # Method to write transmitter data from given file into associative array.
107 #
108 # \param 1 file name
109 # \param 2 associative array
110 #
111 function get_transmitters()
112 {
113  eval $2=\(\)
114 
115  get_transmitters+ $1 $2
116 }
117 
118 
119 #
120 # Method to print string numbers of strings with with transmitter.
121 #
122 # \param 1 file name
123 # \return string numbers
124 #
125 function get_strings_with_transmitter()
126 {
127  set_local_variable __FILE__ $1
128 
129  while read __line__; do
130 
131  if [[ -n "$__line__" && "$__line__" != \#* ]]; then
132 
133  echo $__line__ | read __id__ __string__ __floor__ __x__ __y__ __z__
134 
135  echo -n " $__string__"
136  fi
137 
138  done < $__FILE__
139 
140  echo
141 }
142 
143 
144 #
145 # Method to print string numbers of strings with with hydrophone.
146 #
147 # \param 1 file name
148 # \return string numbers
149 #
150 function get_strings_with_hydrophone()
151 {
152  set_local_variable __FILE__ $1
153 
154  while read __line__; do
155 
156  if [[ -n "$__line__" && "$__line__" != \#* ]]; then
157 
158  echo $__line__ | read __string__ __floor__ __x__ __y__ __z__
159 
160  echo -n " $__string__"
161  fi
162 
163  done < $__FILE__
164 
165  echo
166 }
167 
168 
169 #
170 # Method to write waveform data from given file into associative array.
171 #
172 # \param 1 file name
173 # \param 2 associative array
174 #
175 function get_waveforms()
176 {
177  set_local_variable __FILE__ $1
178  set_local_variable __ARRAY__ $2
179 
180  while read __line__; do
181 
182  if [[ -n "$__line__" && "$__line__" != \#* ]]; then
183 
184  echo $__line__ | read __id__ __m__
185 
186  eval ${__ARRAY__}\[${__id__}\]=\"$__m__\"
187  fi
188 
189  done < $__FILE__
190 }
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
exit
Definition: JPizza.sh:36
then usage $script< input file > nFor possible input files
Definition: JMechanics.sh:23
then
Definition: datalogs.sh:31
const int n
Definition: JPolint.hh:786
* usage
then echo
Definition: JQAQC.sh:90
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null