Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JAcoustics.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 script=${0##*/}
3 
4 # ------------------------------------------------------------------------------------------
5 #
6 # Auxiliary script for configuration of 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 set_variable: ACOUSTICS_DEBUG ACOUSTICS_DEBUG 2
18 set_variable: ACOUSTICS_WORKDIR ACOUSTICS_WORKDIR ./
19 
20 if do_usage $*; then
21  usage "$script [<detector identifier>]"
22 fi
23 
24 if (( $# > 1 )); then
25  fatal "Wrong number of arguments."
26 fi
27 
28 if (( $# == 1 )) && [[ "$1" != "--" ]] ; then
29 
30  let ID="$1" # Detector identifier
31 
32  # Locally install input files.
33 
34  typeset -a ERRORS
35 
36  for KEY in sound_velocity tripod waveform hydrophone mechanics acoustics_trigger_parameters acoustics_fit_parameters; do
37 
38  if [[ ! -f $ACOUSTICS_WORKDIR/${KEY}.txt ]]; then
39  if [[ -f $JPP_LIB/${KEY}_${(l:8::0::0:)ID}.txt ]]; then
40  cp $JPP_LIB/${KEY}_${(l:8::0::0:)ID}.txt $ACOUSTICS_WORKDIR/${KEY}.txt
41  else
42  ERRORS+=($ACOUSTICS_WORKDIR/${KEY}.txt)
43  fi
44  fi
45  done
46 
47  if (( ${#ERRORS} != 0 )); then
48  error "There are missing input files for detector identifier $ID"\
49  "\nYou can use $script with one of the existing detector identifiers: "`ls $JPP_LIB/${KEY}_*.txt | sed 's/.*_0*\([^0][0-9]*\).txt/\1/'`\
50  "\nand accordingly update files:\n ${ERRORS[*]}"
51  return 1
52  fi
53 fi
54 
55 
56 #
57 # Method write tripod data from given file into associative array.
58 #
59 # \param 1 file name
60 # \param 2 associative array
61 #
62 function get_tripods()
63 {
64  set_local_variable __FILE__ $1
65  set_local_variable __ARRAY__ $2
66 
67  while read __line__; do
68 
69  if [[ -n "$__line__" && "$__line__" != \#* ]]; then
70 
71  echo $__line__ | read __id__ __x__ __y__ __z__
72 
73  eval ${__ARRAY__}\[${__id__}\]=\"$__x__ $__y__ $__z__\"
74  fi
75 
76  done < $__FILE__
77 }
bool read(Vec &v, std::istream &is)
Read a Vec(tor) from a stream.
Definition: io_ascii.hh:141
exit
Definition: JPizza.sh:36
then JPizza f
Definition: JPizza.sh:46
then echo
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
Definition: JAcoustics.sh:20
* usage
then JCalibrateToT a
Definition: JTuneHV.sh:116
alias put_queue eval echo n
Definition: qlib.csh:19
then cp
then cp $JPP_LIB
Definition: JAcoustics.sh:40
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:38
script
Definition: JAcoustics.sh:2
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null
then echo Monitoring data echo Detector
Definition: JSlewingK40.sh:95
esac done
Definition: JAddHDE.sh:21