-
Notifications
You must be signed in to change notification settings - Fork 0
/
auto_fast_dp
executable file
·44 lines (44 loc) · 1.57 KB
/
auto_fast_dp
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
#!/bin/bash
#$1 = wedge size
#$2 = directory, should be absolute path
trap handler SIGINT
handler() { echo "interrupted"; exit 1; }
work_dir=$PWD
lib=$(which dectris-neggia.so)
if [ "$lib" = "" ]; then echo "error: no dectris-neggia.so found!"; exit 1; fi
if [ ! -d "$2" ]; then echo "error: invalid directory"; exit 1; fi
if [ $(which eiger2cbf) = "" ]; then echo "error: no eiger2cbf found"; exit 1; fi
if [ $(which fast_dp) = "" ]; then echo "error: no fast_dp found"; exit 1; fi;
touch tmpautofdp.dat
find $2 -name "*master.h5" > tmpautofdp.dat
while IFS='' read -r line || [ -n "$line" ]; do
a=1
b=$1
nimages=$(eiger2cbf "$line" 2>/dev/null | tail -n 1)
# echo "nimages=$nimages"
dir=$2
dirlen=`expr ${#dir} + 1`
if [ "${dir: -1}" != "/" ]; then dirlen=`expr $dirlen + 1`; fi
# echo "$dirlen"
substr=$(echo "$line" | cut -c $dirlen-)
substr="${substr%/*}"
mkdir -p $substr
cd $substr
touch auto_fast_dp.log
while [ "$b" -le "$nimages" ]; do
echo "{ time fast_dp --lib=$lib -1 $a -N $b $line 2> fast_dp.error; } 2> time.txt" >> auto_fast_dp.log
# echo "fast_dp --lib=$lib -1 $a -N $b $line" >> auto_fast_dp.log
mkdir run$a-$b
cd run$a-$b
{ time fast_dp --lib=$lib -1 $a -N $b $line 2> fast_dp.error; } 2> time.txt
# fast_dp --lib=$lib -1 $a -N $b $line
if [ ! -s fast_dp.error ]; then rm fast_dp.error; fi
cd ..
a=`expr $a + $1`
b=`expr $b + $1`
done
cd $work_dir
done < tmpautofdp.dat
rm tmpautofdp.dat
touch good_runs.txt
find -name "XDS_ASCII.HKL" > good_runs.txt