Jpp  16.0.0
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  "\nAuxiliary script to initialise environment for acoustics data processing."
23 fi
24 
25 if (( $# > 1 )); then
26  fatal "Wrong number of arguments."
27 fi
28 
29 if (( $# == 1 )) && [[ "$1" != "--" ]] ; then
30 
31  let ID="$1" # Detector identifier
32 
33  # Locally install input files.
34 
35  typeset -a ERRORS
36 
37  for KEY in sound_velocity tripod waveform hydrophone mechanics acoustics_trigger_parameters acoustics_fit_parameters disable; do
38 
39  if [[ ! -f $ACOUSTICS_WORKDIR/${KEY}.txt ]]; then
40  if [[ -f $JPP_LIB/${KEY}_${(l:8::0::0:)ID}.txt ]]; then
41  cp $JPP_LIB/${KEY}_${(l:8::0::0:)ID}.txt $ACOUSTICS_WORKDIR/${KEY}.txt
42  else
43  ERRORS+=($ACOUSTICS_WORKDIR/${KEY}.txt)
44  fi
45  fi
46  done
47 
48  if (( ${#ERRORS} != 0 )); then
49  error "There are missing input files for detector identifier $ID"\
50  "\nYou can use $script with one of the existing detector identifiers: "`ls $JPP_LIB/${KEY}_*.txt | sed 's/.*_0*\([^0][0-9]*\).txt/\1/'`\
51  "\nand accordingly update files:\n ${ERRORS[*]}"
52  return 1
53  fi
54 fi
55 
56 
57 #
58 # Method write tripod data from given file into associative array.
59 #
60 # \param 1 file name
61 # \param 2 associative array
62 #
63 function get_tripods()
64 {
65  set_local_variable __FILE__ $1
66  set_local_variable __ARRAY__ $2
67 
68  while read __line__; do
69 
70  if [[ -n "$__line__" && "$__line__" != \#* ]]; then
71 
72  echo $__line__ | read __id__ __x__ __y__ __z__
73 
74  eval ${__ARRAY__}\[${__id__}\]=\"$__x__ $__y__ $__z__\"
75  fi
76 
77  done < $__FILE__
78 }
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
then usage $script< directory A >< directoryB > nIn each there should be a file detector datx and tripod txt
o $QUALITY_ROOT d $DEBUG!JPlot1D f
Definition: JDataQuality.sh:66
exit
Definition: JPizza.sh:36
then echo
const int n
Definition: JPolint.hh:676
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
Definition: JAcoustics.sh:20
set_variable NUMBER_OF_ITERATIONS set_variable EPSILON cat acoustics_fit_parameters txt<< EOF $CONFIGURATION[*]Nmin=3;sigma_s=100.0e-6;stdev=10.0;mestimator=0;fixStrings=0;EOF for STRING in $STRINGS[*];do#fit stretching and(z) position of given string set_variable DETECTOR_TMP ${TMPDIR:-/tmp}/detector_A.datx JEditDetector-a $DETECTOR-o $DETECTOR_TMP-r $STRING JEditDetector-a $DETECTOR-o $DETECTOR-k $STRING for MUL in 0.005 0.001;do DX_M=0.2 for((N=0;$N< $NUMBER_OF_ITERATIONS;++N));do CHI2[3]=$CHI2[1] fitPositionOfString $STRING Z $DX_M fitStretchingOfString $STRING $MUL if(($CHI2[3]-$CHI2[1]< $EPSILON));then break fi done if(($N >=$NUMBER_OF_ITERATIONS));then printf"warning: reached maximum number of iterations %d - converenge %7.3f\n"$N $(($CHI2[3]-$CHI2[1])) fi done JMergeDetector-a $DETECTOR-a $DETECTOR_TMP-o $DETECTOR rm-f $DETECTOR_TMP JConvertDetectorFormat-a $DETECTOR-o $DETECTOR-r-d 0 > &dev null done
* usage
then JCalibrateToT a
Definition: JTuneHV.sh:116
then cp
then cp $JPP_LIB
Definition: JAcoustics.sh:41
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:42
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:97