Skip to content

Commit 831dcb9

Browse files
committed
Added the script which I use to compare results of conversion from two versions
1 parent 1dac9d7 commit 831dcb9

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

test-compare-two-versions.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
# A script which is for now very ad-hoc and to be ran outside of this codebase and
3+
# assumes having two repos of heudiconv -- one under heudiconv and another heudiconv-master
4+
# with virtualenvs setup inside under venvs/dev.
5+
# Was used for https://github.com/nipy/heudiconv/pull/129
6+
7+
PS1=+
8+
set -eu
9+
10+
outdir=${OUTDIR:=compare-versions/$(basename $1)}
11+
12+
RUN=echo
13+
RUN=
14+
15+
#if [ -e $outdir ]; then
16+
# # just fail if exists already
17+
# echo "$outdir exists already -- remove if you want to run the comparison" >&2
18+
# exit 1
19+
#fi
20+
21+
mkdir -p $outdir
22+
23+
function run() {
24+
heudiconvdir="$1"
25+
out=$outdir/$2
26+
shift
27+
shift
28+
source $heudiconvdir/venvs/dev/bin/activate
29+
whichheudiconv=$(which heudiconv)
30+
31+
# just do full conversion
32+
echo "Running $whichheudiconv with log in $out.log"
33+
$RUN heudiconv --random-seed 1 -f $heudiconvdir/heuristics/dbic_bids.py -c dcm2niix -o $out --datalad --bids "$@" >| $out.log 2>&1
34+
}
35+
36+
run heudiconv rolando "$@"
37+
run heudiconv-master master --files "$@"
38+
39+
cd $outdir
40+
#git remote add rolando "$outdir/rolando"
41+
#git fetch rolando
42+
# git diff --stat rolando/master..
43+
if diff -Naur --exclude=.git --ignore-matching-lines='^\s*id\s*=.*' rolando master >| diff.patch; then
44+
echo "Results are identical"
45+
else
46+
echo "Results differ: $PWD/diff.patch"
47+
cat diff.patch | diffstat
48+
fi
49+

0 commit comments

Comments
 (0)