Skip to content

Commit b45bc1c

Browse files
baltzelltongtongcao
authored andcommitted
draft: add convenience scripts for diffing gold runs (#1124)
* add convenience scripts for diffing gold runs * Increase hipo-diff limit from 1000 to 10000
1 parent 0446220 commit b45bc1c

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

libexec/git-lfs-wget

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
[ "$#" -ne 2 ] && echo 'Usage: git-lfs-wget URI subpath' && exit 1
4+
5+
subdir=$(echo $1 | awk -F/ '{print$NF}' | awk -F. '{print$1}')
6+
7+
if [ -d $subdir ]
8+
then
9+
if ! [ -e $subdir/.git ]
10+
then
11+
echo "ERROR: $subdir already exists but is not a git repo."
12+
exit 1
13+
fi
14+
else
15+
GIT_LFS_SKIP_SMUDGE=1 git clone $1
16+
git lfs install --skip-smudge
17+
fi
18+
19+
cd $subdir
20+
21+
git config lfs.fetchinclude "$2"
22+
23+
git lfs pull
24+

libexec/gold-diff

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
[ "$#" -ne 2 ] && echo 'Usage: gold-diff dir1 dir2' && exit 1
4+
5+
a=$1
6+
b=$2
7+
8+
for x in $a/*.hipo
9+
do
10+
y=$b/$(basename $x)
11+
stub=$(basename $x)
12+
stub=${stub%%.*}
13+
hipo-diff -q 1 -s 0,1,2 -n 10000 $x $y >& $stub.log &
14+
done
15+
16+
wait

libexec/gold-run

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
exe='decoder4u -n 10000'
4+
csv=gold.csv
5+
cache=pin-gold.txt
6+
7+
if ! [ -f $csv ] || ! [ -f $cache ]
8+
then
9+
echo "ERROR: This requires the gold text files from the 'raw-data' repository"
10+
echo "to be in your current working directory. The easiest way to get them:"
11+
echo "GIT_LFS_SKIP_SMUDGE=1 git clone https://code.jlab.org/hallb/clas12/raw-data.git"
12+
exit 1
13+
fi
14+
15+
IFS=$'\n'
16+
17+
for x in $(tail -n +2 $csv)
18+
do
19+
x=${x//[[:space:]]/}
20+
run=${x##*,}
21+
period=${x%%,*}
22+
stub=${period}_${run}
23+
data=$(grep ${run} $cache | grep 1$)
24+
$exe -o $stub.hipo $data >& $stub.log &
25+
done
26+
27+
wait

0 commit comments

Comments
 (0)