Skip to content

Commit efe693a

Browse files
authored
Merge pull request #191 from VERITAS-Observatory/eventdisplay-integration-tests
Add additional Eventdisplay integration tests
2 parents 2ccb301 + 81d041c commit efe693a

File tree

8 files changed

+132
-27
lines changed

8 files changed

+132
-27
lines changed

.github/workflows/v2dl3-codeChecking.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515
- 'setup.py'
1616

1717
jobs:
18-
tests:
18+
lint:
1919
runs-on: ubuntu-latest
2020
strategy:
2121
matrix:
@@ -31,17 +31,9 @@ jobs:
3131
with:
3232
python-version: ${{ matrix.python-version }}
3333

34-
- name: Install conda dependencies
35-
uses: mamba-org/setup-micromamba@v1
34+
- name: flake8 Lint
35+
uses: py-actions/flake8@v2
3636
with:
37-
environment-file: environment-eventdisplay.yml
38-
create-args: python=${{ matrix.python-version }}
39-
init-shell: bash
40-
41-
- name: flake8
42-
shell: bash -leo pipefail {0}
43-
run: |
44-
flake8 --count --select=E9,F63,F7,F82 --ignore=E203,W503 \
45-
--show-source --statistics .
46-
flake8 --count --max-complexity=25 --ignore=E203,W503 \
47-
--max-line-length=127 --statistics .
37+
ignore: "E203,W503"
38+
max-line-length: "127"
39+
path: "."

.github/workflows/v2dl3-eventdisplay.yml

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-latest
2020
strategy:
2121
matrix:
22-
python-version: ["3.10"]
22+
python-version: ["3.11"]
2323

2424
steps:
2525
- uses: actions/checkout@v3
@@ -49,7 +49,7 @@ jobs:
4949
run: |
5050
./utils/download_Eventdisplay_test_data.sh
5151
52-
- name: V2Dl3-Eventdisplay
52+
- name: Eventdisplay-pointlike
5353
shell: bash -leo pipefail {0}
5454
env:
5555
PYTHONPATH: .
@@ -58,19 +58,81 @@ jobs:
5858
python pyV2DL3/script/v2dl3_for_Eventdisplay.py \
5959
-f ./64080.anasum.root \
6060
./effectiveArea.root \
61+
--logfile test-pointlike.fits.log \
6162
test-pointlike-CI.fits.gz
6263
python pyV2DL3/script/compareFitsFiles.py \
6364
-f ED-pointlike-CI.fits.gz test-pointlike-CI.fits.gz \
6465
-d test-pointlike.log
6566
cat test-pointlike.log
6667
grep -q "No differences found" test-pointlike.log
68+
69+
- name: Eventdisplay-full-enclosure
70+
shell: bash -leo pipefail {0}
71+
env:
72+
PYTHONPATH: .
73+
run: |
6774
# full-enclosure tests
6875
python pyV2DL3/script/v2dl3_for_Eventdisplay.py --full-enclosure \
6976
-f ./64080.anasum.root \
7077
./effectiveArea.root \
78+
--logfile test-full-enclosure.fits.log \
7179
test-full-enclosure-CI.fits.gz
7280
python pyV2DL3/script/compareFitsFiles.py \
7381
-f ED-fullenclosure-CI.fits.gz test-full-enclosure-CI.fits.gz \
7482
-d test-full-enclosure.log
7583
cat test-full-enclosure.log
7684
grep -q "No differences found" test-full-enclosure.log
85+
86+
- name: Eventdisplay-pointlike-DB
87+
shell: bash -leo pipefail {0}
88+
env:
89+
PYTHONPATH: .
90+
run: |
91+
# point-like tests (with DB)
92+
python pyV2DL3/script/v2dl3_for_Eventdisplay.py \
93+
-f ./64080.anasum.root \
94+
./effectiveArea.root \
95+
--db_fits_file ./64080.db.fits.gz \
96+
--logfile test-pointlike-db.fits.log \
97+
test-pointlike-db-CI.fits.gz
98+
python pyV2DL3/script/compareFitsFiles.py \
99+
-f ED-pointlike-db-CI.fits.gz test-pointlike-db-CI.fits.gz \
100+
-d test-pointlike-db.log
101+
cat test-pointlike-db.log
102+
grep -q "No differences found" test-pointlike-db.log
103+
104+
- name: Eventdisplay-pointlike-select
105+
shell: bash -leo pipefail {0}
106+
env:
107+
PYTHONPATH: .
108+
run: |
109+
# point-like tests with event selection
110+
python pyV2DL3/script/v2dl3_for_Eventdisplay.py \
111+
-f ./64080.allevents.anasum.root \
112+
./effectiveArea.root \
113+
--evt_filter eventfilter.yml \
114+
--logfile test-pointlike-all.fits.log \
115+
test-pointlike-all-CI.fits.gz
116+
python pyV2DL3/script/compareFitsFiles.py \
117+
-f ED-pointlike-all-CI.fits.gz test-pointlike-all-CI.fits.gz \
118+
-d test-pointlike-all.log
119+
cat test-pointlike-all.log
120+
grep -q "No differences found" test-pointlike-all.log
121+
122+
- name: Eventdisplay-full-enclosure-select
123+
shell: bash -leo pipefail {0}
124+
env:
125+
PYTHONPATH: .
126+
run: |
127+
# full-enclosure tests with event selection
128+
python pyV2DL3/script/v2dl3_for_Eventdisplay.py --full-enclosure \
129+
-f ./64080.allevents.anasum.root \
130+
./effectiveArea.root \
131+
--evt_filter eventfilter.yml \
132+
--logfile test-full-enclosure-all.fits.log \
133+
test-full-enclosure-all-CI.fits.gz
134+
python pyV2DL3/script/compareFitsFiles.py \
135+
-f ED-full-enclosure-all-CI.fits.gz test-full-enclosure-all-CI.fits.gz \
136+
-d test-full-enclosure-all.log
137+
cat test-full-enclosure-all.log
138+
grep -q "No differences found" test-full-enclosure-all.log

environment-eventdisplay.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
- pre-commit
1515
- pyflakes
1616
- pytest
17-
- python>=3.8
17+
- python>=3.11
1818
- pyyaml
1919
- scipy
2020
- uproot

pyV2DL3/constant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Global setting
22

3-
VERSION = "0.3"
3+
VERSION = "0.5"
44

55
# Feb 1 2005
66
VTS_REFERENCE_MJD = 53402.0

pyV2DL3/generateObsHduIndex.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
from astropy.io import fits
55
from astropy.io.fits import table_to_hdu
6-
from astropy.table import Table
7-
from astropy.table import vstack
6+
from astropy.table import Table, vstack
87

98
from pyV2DL3.addHDUClassKeyword import addHDUClassKeyword
109

@@ -99,7 +98,7 @@ def get_unit_string_from_comment(comment_string):
9998
Return unit string from FITS comment
10099
101100
Examples: 'average pointing azimuth [deg]'
102-
101+
103102
"""
104103
bstart = comment_string.find("[")
105104
bstopp = comment_string.find("]")

utils/compare_fits_dirs.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Prints fitsdiff outputs that detect a difference.
44
#
5-
# Takes 'test' and 'control' directories as arguments.
5+
# Takes 'test' and 'control' directories as arguments.
66
DIR1=$1
77
DIR2=$2
88

@@ -11,15 +11,15 @@ DIR2=$2
1111
# e.g `test/batch1/name1.fits` matches to `control/batch1/name1.fits`
1212
#
1313
# Exit codes:
14-
# 0 = no differences,
14+
# 0 = no differences,
1515
# 1 = at least one file contained differences
1616

1717
DIFF_FOUND=false
1818

1919
# Works recursively
2020
for FILE in $(find $DIR1 -name \*.fits); do
21-
fitsdiff $FILE ${FILE/$DIR1/$DIR2} > $FILE.txt
22-
21+
fitsdiff -k CREATOR $FILE ${FILE/$DIR1/$DIR2} > $FILE.txt
22+
2323
if ! grep -q "No differences found" $FILE.txt; then
2424
cat $FILE.txt
2525
DIFF_FOUND=true
@@ -30,4 +30,4 @@ if [ "$DIFF_FOUND" = true ] ; then
3030
exit 1
3131
fi
3232

33-
echo "Fits files contain no differences."
33+
echo "Fits files contain no differences."
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
#!/bin/bash
2+
#
3+
# Expected files in tar ball:
4+
# - 64080.anasum.root
5+
# - EffectiveArea.root
6+
# - 64080.db.fits.gz
7+
# - ED-pointlike-CI.fits.gz
8+
# - ED-pointlike-CI.fits.gz
9+
# - ED-pointlike-db-CI.fits.gz
10+
# - ED-pointlike-all-CI.fits.gz
11+
# - ED-full-enclosure-all-CI.fits.gz
12+
# - eventfilter.yml
13+
# (plus corresponding log files)
214

315
set -e
416

5-
wget --no-verbose https://syncandshare.desy.de/index.php/s/S8KAyRAmNdF9qEX/download/github-CI.tar.gz
17+
wget --no-verbose https://syncandshare.desy.de/index.php/s/Pj4KBZ9E9cjLfk7/download/github-CI.tar.gz
618
tar -xvzf github-CI.tar.gz

utils/prepare_Eventdisplay_CI.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
# Prepare Eventdisplay CI files for integration tests
3+
4+
# point-like tests
5+
python pyV2DL3/script/v2dl3_for_Eventdisplay.py \
6+
-f ./64080.anasum.root \
7+
./effectiveArea.root \
8+
--logfile ED-pointlike-CI.log \
9+
ED-pointlike-CI.fits.gz
10+
11+
# full-enclosure tests
12+
python pyV2DL3/script/v2dl3_for_Eventdisplay.py --full-enclosure \
13+
-f ./64080.anasum.root \
14+
./effectiveArea.root \
15+
--logfile ED-fullenclosure-CI.log \
16+
ED-fullenclosure-CI.fits.gz
17+
18+
# point-like tests with DB
19+
python pyV2DL3/script/v2dl3_for_Eventdisplay.py \
20+
-f ./64080.anasum.root \
21+
./effectiveArea.root \
22+
--db_fits_file ./64080.db.fits.gz \
23+
--logfile ED-pointlike-db-CI.log \
24+
ED-pointlike-db-CI.fits.gz
25+
26+
# point-like tests with event filter
27+
python pyV2DL3/script/v2dl3_for_Eventdisplay.py \
28+
-f ./64080.allevents.anasum.root \
29+
./effectiveArea.root \
30+
--evt_filter eventfilter.yml \
31+
--logfile ED-pointlike-all-CI.log \
32+
ED-pointlike-all-CI.fits.gz
33+
34+
# full-enclosure tests with event selection
35+
python pyV2DL3/script/v2dl3_for_Eventdisplay.py --full-enclosure \
36+
-f ./64080.allevents.anasum.root \
37+
./effectiveArea.root \
38+
--evt_filter eventfilter.yml \
39+
--logfile ED-full-enclosure-all-CI.log \
40+
ED-full-enclosure-all-CI.fits.gz

0 commit comments

Comments
 (0)