-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·85 lines (61 loc) · 1.82 KB
/
test.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env sh
set -e
OUTPUTDIR=${PWD}/output
SMAP=${PWD}/testdata/smap.fits
setup_outputdir() {
test -d $OUTPUTDIR && rm -rf $OUTPUTDIR
mkdir -p $OUTPUTDIR
}
setup_environment() {
export PYTHONPATH=../zlp-script/scripts:$PYTHONPATH
}
test_create_bias() {
BIASLIST=$TMPDIR/biaslist.txt
find testdata/bias -name 'IMAGE*.bz2' > $BIASLIST
MBIAS=mbias.fits
python bin/pipebias.py $BIASLIST $MBIAS $OUTPUTDIR
FILENAME=$OUTPUTDIR/$MBIAS py.test -m bias
}
test_create_dark() {
DARKLIST=$TMPDIR/darklist.txt
find testdata/dark -name 'IMAGE*.bz2' > $DARKLIST
MDARK=mdark.fits
python bin/pipedark.py $DARKLIST $MBIAS $MDARK $OUTPUTDIR
FILENAME=$OUTPUTDIR/$MDARK py.test -m dark
}
test_create_flat() {
FLATLIST=$TMPDIR/flatlist.txt
find testdata/flat -name 'IMAGE*.bz2' > $FLATLIST
MFLAT=mflat.fits
SMAPNAME=smap.fits
cp $SMAP $OUTPUTDIR/$SMAPNAME
python bin/pipeflat.py $FLATLIST $MBIAS $MDARK $SMAPNAME $MFLAT $OUTPUTDIR
FILENAME=$OUTPUTDIR/$MFLAT py.test -m flat
}
test_reduce_files() {
SCIENCELIST=$TMPDIR/sciencelist.txt
find testdata/source -name 'IMAGE*.bz2' > $SCIENCELIST
python bin/pipered.py $SCIENCELIST $MBIAS $MDARK $SMAPNAME $MFLAT $OUTPUTDIR $OUTPUTDIR
py.test -m reduction
}
test_flat_already_exists() {
FLATLIST=$TMPDIR/flatlist.txt
find testdata/flat -name 'IMAGE*.bz2' > $FLATLIST
MFLAT=mflat.fits
SMAPNAME=smap.fits
cp $SMAP $OUTPUTDIR/$SMAPNAME
# Ensure the file already exists
touch $OUTPUTDIR/$MFLAT
python bin/pipeflat.py $FLATLIST $MBIAS $MDARK $SMAPNAME $MFLAT $OUTPUTDIR
FILENAME=$OUTPUTDIR/$MFLAT py.test -m flat
}
main() {
setup_environment
setup_outputdir
test_create_bias
test_create_dark
test_create_flat
test_reduce_files
test_flat_already_exists
}
main