-
Notifications
You must be signed in to change notification settings - Fork 0
/
multfast2hdf5.sh
executable file
·58 lines (49 loc) · 1.2 KB
/
multfast2hdf5.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
LABEL1='0'
LABEL2='0'
LABEL3='0'
LABEL4='0'
OPTIONS_FILE=''
OUTPUT_FILE=''
function show_help {
echo "Convert multiple .fast files into the HDF5 format."
echo "Options:"
echo "-h: Show help"
echo "-l: Labels for the channels on the used inputs. Usage: l1,l2,l3,l4"
echo "-o: Specify output file"
echo "-p: Specify further options"
echo "Example: multfast2hdf5.sh -o output.h5 -l 1,3,4 input_00*"
echo "Support for options file (.setup) not yet implemented"
}
while getopts ":hl:o:p:" opt; do
case "$opt" in
h|\?)
show_help
exit 0
;;
l) arrIN=(${OPTARG//,/ })
LABEL1=${arrIN[0]}
LABEL2=${arrIN[1]}
LABEL3=${arrIN[2]}
LABEL4=${arrIN[3]}
;;
o) OUTPUT_FILE=$OPTARG
;;
p) OPTIONS_FILE=$OPTARG
;;
:) echo "Option -$OPTARG requires an argument." >&2
exit 1
esac
done
if [ "$OUTPUT_FILE" = "" ]; then
echo "Output file needs to be specified by -o output_file.h5"
exit 0
fi
shift $((OPTIND-1))
for f in $@
do
echo "File $f"
echo "Label1: $LABEL1 LABEL2: $LABEL2 LABEL3: $LABEL3 LABEL4: $LABEL4"
fast2hdf5 $f $OUTPUT_FILE $LABEL1 $LABEL2 $LABEL3 $LABEL4
echo "Conversion of $f completed"
done