Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JAddHDE.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2#
3# \author jseneca
4#
5version=1.0
6script=${0##*/}
7
8# ------------------------------------------------------------------------------------------
9#
10# Utility script to create histogram of particle light pattern
11#
12# ------------------------------------------------------------------------------------------
13
14INPUT_FILES="J-11_11_22s_example.HDE J2212s_example.HDE";
15OUTPUT_SUFFIX="example";
16
17while getopts f:o:h option
18do case "$option" in
19 f) INPUT_FILES="$OPTARG";;
20 o) OUTPUT_SUFFIX="$OPTARG";;
21 h) exit;;
22 esac
23done;
24
25if [ -z $INPUT_FILES ]; then
26 echo "Please pass data file."
27 exit
28fi
29
30if [ -z $JPP_DIR ]; then
31 echo "Variable JPP_DIR undefined."
32 exit
33fi
34
35PARTICLES=""
36PARTICLES_RE="J([-_[:digit:]]*?)s.*"
37for FILE in "${(@s/ /)INPUT_FILES}"
38do
39 if [[ $FILE =~ $PARTICLES_RE ]]
40 then
41
42 FILE_PARTICLES="${match[1]}"
43 for particle in "${(@s/_/)FILE_PARTICLES}"
44 do
45 PARTICLES=${PARTICLES}${particle}_
46 done
47 fi
48done
49PARTICLES=${PARTICLES: 0: -1}
50
51OUTPUT_FILE="J${PARTICLES}s_${OUTPUT_SUFFIX}.HDE"
52
53source $JPP_DIR/setenv.sh $JPP_DIR
54
55JAddHDE \
56 -f $INPUT_FILES \
57 -o $OUTPUT_FILE