Jpp 21.0.0-rc.1
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
14source $JPP_DIR/setenv.sh $JPP_DIR
15
16INPUT_FILES="J-11_11_22s_example.HDE J2212s_example.HDE";
17OUTPUT_SUFFIX="example";
18
19while getopts f:o:h option
20do case "$option" in
21 f) INPUT_FILES="$OPTARG";;
22 o) OUTPUT_SUFFIX="$OPTARG";;
23 h) exit;;
24 esac
25done;
26
27if [ -z $INPUT_FILES ]; then
28 echo "Please pass data file."
29 exit
30fi
31
32if [ -z $JPP_DIR ]; then
33 echo "Variable JPP_DIR undefined."
34 exit
35fi
36
37PARTICLES=""
38PARTICLES_RE="J([-_[:digit:]]*?)s.*"
39
40for FILE in "${(@s/ /)INPUT_FILES}"
41do
42 if [[ $FILE =~ $PARTICLES_RE ]]
43 then
44
45 FILE_PARTICLES="${match[1]}"
46
47 for particle in "${(@s/_/)FILE_PARTICLES}"
48 do
49 PARTICLES=${PARTICLES}${particle}_
50 done
51 fi
52done
53
54PARTICLES=${PARTICLES: 0: -1}
55
56OUTPUT_FILE="J${PARTICLES}s_${OUTPUT_SUFFIX}.HDE"
57
58JAddHDE \
59 -f $INPUT_FILES \
60 -o $OUTPUT_FILE