-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy path.travis.yml
142 lines (120 loc) · 5.64 KB
/
.travis.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
136
137
138
139
140
141
142
language: python
sudo: false
matrix:
include:
# "Legacy" environments: oldest supported versions, without and with numba
#- python: "2.7"
# env: DEPS="scipy matplotlib astropy=1.2 progressbar"
#- python: "2.7"
# env: DEPS="scipy matplotlib astropy=1.3 progressbar-latest"
## "Recommended" environments: More recent versions, for Py2 and Py3.
#- python: "2.7"
# env: DEPS="scipy matplotlib astropy=1.3.1 progressbar"
#- python: "2.7"
# env: DEPS="scipy matplotlib astropy"
- python: "3.5"
env: DEPS="scipy matplotlib astropy=1.3"
- python: "3.6"
env: DEPS="scipy matplotlib astropy"
- python: "3.8"
env: DEPS="scipy matplotlib astropy"
install:
# Fetch and install conda
# -----------------------
- export CONDA_BASE="http://repo.continuum.io/miniconda/Miniconda"
- if [[ "${TRAVIS_PYTHON_VERSION}" == 2* ]]; then
wget ${CONDA_BASE}2-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget ${CONDA_BASE}3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p ${HOME}/miniconda
- export PATH="${HOME}/miniconda/bin:${PATH}"
# Create the testing environment
# ------------------------------
- conda config --set always_yes true
- conda config --set changeps1 no
- conda config --set show_channel_urls true
- conda config --add channels conda-forge
- conda config --add channels auto
- conda update --quiet conda
- ENV_NAME="test-environment"
- conda create --quiet -n ${ENV_NAME} python=${TRAVIS_PYTHON_VERSION} $DEPS pandas healpy python-dateutil
- source activate ${ENV_NAME}
- if [[ "${TRAVIS_PYTHON_VERSION}" == 2* ]]; then
pip install python-dateutil==2.5.0;
fi
# Customise the testing environment
# ---------------------------------
- pip install setuptools codecov pyflakes
# Summerise environment
# ---------------------
- conda list
- conda info -a
# Install and test nway
- python setup.py install
script:
- coverage run setup.py test
- 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
- 'echo "backend: Agg" > matplotlibrc'
- cd doc/
- 'echo "backend: Agg" > matplotlibrc'
- python -c 'import pandas, nwaylib, nwaylib.progress' || exit 1
- 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
# creating offset catalogues
- 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
# 2 catalogue match
- 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
- 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
# 3 catalogue match
- 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
## 3 catalogue match, with magnitudes
- 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
# create fake catalogues
- nway-explain.py example3.fits 422
- 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
# we should test for created output files
- ls
- cd -
# test elliptical errors
- cd tests/elltest/
- 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
- cd -
- python nway-apitest.py
after_success: codecov