Jpp  18.0.1-rc.2
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  tripod
29  waveform
30  hydrophone
31  mechanics
32  acoustics_trigger_parameters
33  acoustics_fit_parameters
34  disable)
35 
36 
37 #
38 # Method to add tripod data from given file into associative array.
39 #
40 # \param 1 file name
41 # \param 2 associative array
42 #
43 function get_tripods+()
44 {
45  set_local_variable __FILE__ $1
46  set_local_variable __ARRAY__ $2
47 
48  while read __line__; do
49 
50  if [[ -n "$__line__" && "$__line__" != \#* ]]; then
51 
52  echo $__line__ | read __id__ __x__ __y__ __z__
53 
54  eval ${__ARRAY__}\[${__id__}\]=\"$__x__ $__y__ $__z__\"
55  fi
56 
57  done < $__FILE__
58 }
59 
60 
61 #
62 # Method to write tripod data from given file into associative array.
63 #
64 # \param 1 file name
65 # \param 2 associative array
66 #
67 function get_tripods()
68 {
69  eval $2=\(\)
70 
71  get_tripods+ $1 $2
72 }
73 
74 
75 #
76 # Method to add transmitter data from given file into associative array.
77 #
78 # \param 1 file name
79 # \param 2 associative array
80 #
81 function get_transmitters+()
82 {
83  set_local_variable __FILE__ $1
84  set_local_variable __ARRAY__ $2
85 
86  while read __line__; do
87 
88  if [[ -n "$__line__" && "$__line__" != \#* ]]; then
89 
90  echo $__line__ | read __id__ __string__ __floor__ __x__ __y__ __z__
91 
92  eval ${__ARRAY__}\[${__id__}\]=\"$__x__ $__y__ $__z__\"
93  fi
94 
95  done < $__FILE__
96 }
97 
98 
99 #
100 # Method to write transmitter data from given file into associative array.
101 #
102 # \param 1 file name
103 # \param 2 associative array
104 #
105 function get_transmitters()
106 {
107  eval $2=\(\)
108 
109  get_transmitters+ $1 $2
110 }
111 
112 
113 #
114 # Method to print string numbers of strings with with transmitter.
115 #
116 # \param 1 file name
117 # \return string numbers
118 #
119 function get_strings_with_transmitter()
120 {
121  set_local_variable __FILE__ $1
122 
123  while read __line__; do
124 
125  if [[ -n "$__line__" && "$__line__" != \#* ]]; then
126 
127  echo $__line__ | read __id__ __string__ __floor__ __x__ __y__ __z__
128 
129  echo -n " $__string__"
130  fi
131 
132  done < $__FILE__
133 
134  echo
135 }
136 
137 
138 #
139 # Method to print string numbers of strings with with hydrophone.
140 #
141 # \param 1 file name
142 # \return string numbers
143 #
144 function get_strings_with_hydrophone()
145 {
146  set_local_variable __FILE__ $1
147 
148  while read __line__; do
149 
150  if [[ -n "$__line__" && "$__line__" != \#* ]]; then
151 
152  echo $__line__ | read __string__ __floor__ __x__ __y__ __z__
153 
154  echo -n " $__string__"
155  fi
156 
157  done < $__FILE__
158 
159  echo
160 }
161 
162 
163 #
164 # Method to write waveform data from given file into associative array.
165 #
166 # \param 1 file name
167 # \param 2 associative array
168 #
169 function get_waveforms()
170 {
171  set_local_variable __FILE__ $1
172  set_local_variable __ARRAY__ $2
173 
174  while read __line__; do
175 
176  if [[ -n "$__line__" && "$__line__" != \#* ]]; then
177 
178  echo $__line__ | read __id__ __m__
179 
180  eval ${__ARRAY__}\[${__id__}\]=\"$__m__\"
181  fi
182 
183  done < $__FILE__
184 }
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
then usage $script[< detector identifier >< run range >]< QA/QCfile > nExample script to produce data quality plots nWhen a detector identifier and run range are data are downloaded from the database nand subsequently stored in the given QA QC file
Definition: JDataQuality.sh:19
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
exit
Definition: JPizza.sh:36
const int n
Definition: JPolint.hh:697
then fatal Missing detector file $DETECTOR fi eval JPrintDetector a $DETECTOR O IDENTIFIER for KEY in tripod hydrophone transmitter
* usage
then echo
Definition: JQAQC.sh:90
static JNullStream null
Null I/O stream.
Definition: JNullStream.hh:51
script
Definition: JAcoustics.sh:2