-
Notifications
You must be signed in to change notification settings - Fork 15
135 lines (118 loc) · 5.65 KB
/
tests.yml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8, "3.10", 3.12]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: python -m pip install flake8 pytest python-dateutil setuptools codecov pyflakes numpy cython astropy healpy
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install package
run: python -m pip install .
- name: Test with pytest
run: |
python -c 'import pandas, nwaylib, nwaylib.progress'
coverage run setup.py test
- name: pyflakes
run: |
pyflakes *.py nwaylib/*.py | grep -vE '(may be undefined|imported but unused|unable to detect undefined names|local variable ._|list comprehension redefines)' | tee static_errors
cat static_errors
if test -s static_errors; then exit 2; else true; fi
- name: API test
run: coverage run -a nway-apitest.py
- name: submit coverage results
run: codecov
- name: nway-write-header
run: |
echo "backend: Agg" > matplotlibrc
cd doc/
echo "backend: Agg" > matplotlibrc
nway-write-header.py COSMOS_OPTICAL.fits OPT 2
nway-write-header.py COSMOS_IRAC.fits IRAC 2
nway-write-header.py COSMOS_XMM.fits XMM 2
- name: creating offset catalogues
working-directory: doc
run: |
nway-create-fake-catalogue.py --radius 20 COSMOS_XMM.fits COSMOS_XMM-fake.fits
test -e COSMOS_XMM-fake.fits
nway-create-shifted-catalogue.py --radius 40 --shift-ra 60 COSMOS_XMM.fits COSMOS_XMM-shift.fits
test -e COSMOS_XMM-shift.fits
rm -f COSMOS_XMM-shift.fits
nway-create-shifted-catalogue.py --radius 40 --shift-dec 60 COSMOS_XMM.fits COSMOS_XMM-shift.fits
test -e COSMOS_XMM-shift.fits
- name: 2 catalogue match
working-directory: doc
run: |
nway.py COSMOS_XMM.fits :pos_err COSMOS_OPTICAL.fits 0.1 --out=example2.fits --radius 20
test -e example2.fits
nway.py COSMOS_XMM-shift.fits :pos_err COSMOS_OPTICAL.fits 0.1 --out=example2-offset.fits --radius 20
test -e example2-offset.fits
# 2 catalogue match, with magnitudes
- name: 2 catalogue match, with magnitudes
working-directory: doc
run: |
nway.py COSMOS_XMM.fits :pos_err COSMOS_OPTICAL.fits 0.1 --out=example2-mag.fits --radius 20 --mag OPT:MAG auto --mag-radius=4
test -e example2-mag.fits
test -e OPT_MAG_fit.pdf
test -e OPT_MAG_fit.txt
nway.py COSMOS_XMM-shift.fits :pos_err COSMOS_OPTICAL.fits 0.1 --out=example2-mag-offset.fits --radius 20 --mag OPT:MAG OPT_MAG_fit.txt
test -e example2-mag-offset.fits
- name: 3 catalogue match
working-directory: doc
run: |
nway.py COSMOS_XMM.fits :pos_err COSMOS_OPTICAL.fits 0.1 COSMOS_IRAC.fits 0.5 --out=example3.fits --radius 20
test -e example3.fits
nway.py COSMOS_XMM-shift.fits :pos_err COSMOS_OPTICAL.fits 0.1 COSMOS_IRAC.fits 0.5 --out=example3-offset.fits --radius 20
test -e example3-offset.fits
- name: 3 catalogue match, with magnitudes
working-directory: doc
run: |
nway.py --radius 20 COSMOS_XMM.fits :pos_err COSMOS_OPTICAL.fits 0.1 COSMOS_IRAC.fits 0.5 --mag OPT:MAG auto --mag IRAC:mag_ch1 auto --mag-radius 4 --out=example3-mag.fits
test -e example3-mag.fits
test -e IRAC_mag_ch1_fit.pdf
test -e IRAC_mag_ch1_fit.txt
nway.py COSMOS_XMM-shift.fits :pos_err COSMOS_OPTICAL.fits 0.1 COSMOS_IRAC.fits 0.5 --out=example3-mag-offset.fits --radius 20 --mag OPT:MAG OPT_MAG_fit.txt --mag IRAC:mag_ch1 IRAC_mag_ch1_fit.txt
test -e example3-mag-offset.fits
- name: nway-explain
working-directory: doc
run: |
nway-explain.py example3.fits 422
- name: cutoff calibration
working-directory: doc
run: |
nway-calibrate-cutoff.py example2.fits example2-offset.fits
test -e example2.fits_p_any_cutoffquality.pdf
test -e example2.fits_p_any_p_i.pdf
nway-calibrate-cutoff.py example3-mag.fits example3-mag-offset.fits
ls
- name: test elliptical errors
working-directory: tests/elltest
run: |
nway.py --radius=10.0 randomcatX.fits :pos_err randomcatO.fits 0.1 --out=random_circtest.fits --min-prob=0.01
nway-explain.py random_circtest.fits 95
nway.py --radius=10.0 randomcatX.fits :a:b randomcatO.fits 0.1 --out=random_asymtest.fits --min-prob=0.01
nway-explain.py random_asymtest.fits 95
nway.py --radius=10.0 randomcatX.fits :a:b:phi randomcatO.fits 0.1 --out=random_elltest.fits --min-prob=0.01
nway-explain.py random_elltest.fits 95
nway.py --radius=10.0 randomcatX.fits :a:b:phi randomcatR.fits :a:b:phi randomcatO.fits 0.1 --out=random3_elltest.fits --min-prob=0.01
nway-explain.py random3_elltest.fits 95