Jpp
 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 
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  # Install input files.
33 
34  for KEY in tripod hydrophone; do
35  if [[ ! -f $ACOUSTICS_WORKDIR/${KEY}.txt && -f $JPP_LIB/${KEY}_${(l:8::0::0:)ID}.txt ]]; then
36  cp $JPP_LIB/${KEY}_${(l:8::0::0:)ID}.txt $ACOUSTICS_WORKDIR/${KEY}.txt
37  fi
38  done
39 
40  typeset -A TRIGGER # Event builder parameters.
41  typeset -A PARAMETERS # Position calibration parameters.
42 
43  case $ID in
44 
45  49) VELOCITY="1538.0 -17e-3 -2000.0"; # Sound velocity [m/s], depth dependence [s^-1] and depth [m].
46 
48  Q 0.0
49  TMax_s 0.020
50  numberOfHits 90);
51 
53  Tmax_s 300.0
54  Nmin 3
55  sigma_s 50.0e-6
56  stdev 10.0
57  mestimator 1);;
58 
59 
60  42) VELOCITY="1481.0 -17e-3 -3000.0"; # Sound velocity [m/s], depth dependence [s^-1] and depth [m].
61 
62  TRIGGER=(
63  Q 0.0
64  TMax_s 0.020
65  numberOfHits 15);
66 
67  PARAMETERS=(
68  Tmax_s 300.0
69  Nmin 3
70  sigma_s 50.0e-6
71  stdev 10.0
72  mestimator 1);;
73 
74  *) fatal "Invalid argument $*."
75  esac
76 fi
77 
78 
79 # Print sound velocity conform command line option.
80 #
81 function print_velocity()
82 {
83  echo "\"$VELOCITY\""
84 }
85 
86 
87 # Print tripod data conform command line option.
88 #
89 function print_tripods()
90 {
91  awk 'BEGIN { printf "\"" } END { printf "\"\n" } $1 !~ /^#/ { print $0 }' $ACOUSTICS_WORKDIR/tripod.txt
92 }
93 
94 
95 # Get tripods.
96 #
97 # \param 1 tripod file
98 # \param 2 associative array
99 #
100 function get_tripods()
101 {
102  set_local_variable __FILE__ $1
103  set_local_variable __ARRAY__ $2
104 
105  while read __line__; do
106 
107  if [[ -n "$__line__" && "$__line__" != \#* ]]; then
108 
109  echo $__line__ | read __id__ __x__ __y__ __z__
110 
111  eval ${__ARRAY__}\[${__id__}\]=\"$__x__ $__y__ $__z__\"
112  fi
113 
114  done < $__FILE__
115 }
function get_tripods()
Definition: JAcoustics.sh:100
void set_variable(const std::string &name, const std::string &value)
Set environment variable.
bool read(Vec &v, std::istream &is)
Read a Vec(tor) from a stream.
Definition: io_ascii.hh:141
function print_tripods()
Definition: JAcoustics.sh:89
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
exit
Definition: JPizza.sh:36
do set_array DAQHEADER JPrintDAQHeader f
Definition: JTuneHV.sh:74
*fatal Invalid argument *esac fi function print_velocity()
Definition: JAcoustics.sh:81
VELOCITY
Definition: JAcoustics.sh:60
then echo
* usage
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable ACOUSTICS_DEBUG
Definition: JAcoustics.sh:17
TRIGGER
Definition: JAcoustics.sh:47
then $DIR JKatoomba a $DETECTOR o $WORKDIR katoomba root T $TRIPOD n sigma_s
alias put_queue eval echo n
Definition: qlib.csh:19
PARAMETERS
Definition: JAcoustics.sh:52
then cp
then cp $JPP_LIB
Definition: JAcoustics.sh:36
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 typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:36
script
Definition: JAcoustics.sh:2
source $JPP_DIR setenv csh $JPP_DIR eval JShellParser o a A
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