Skip to content

Commit 997d64d

Browse files
authored
Merge pull request #345 from mkelley/fix-and-test-stsci-sun-urls-2022.06
Fix and test STScI Sun URLs
2 parents 8241a98 + a1fb6b2 commit 997d64d

File tree

8 files changed

+52
-20
lines changed

8 files changed

+52
-20
lines changed
Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# GitHub Actions workflow that runs on a cron schedule.
2+
# Check URLs and run latest deps with remote tests
23

34
name: Weekly CI Tests
45

@@ -8,9 +9,18 @@ on:
89
- cron: '0 6 * * 1'
910

1011
jobs:
11-
# Weekly testing to catch links that stop working for some reason.
12-
doc_test:
12+
weekly:
1313
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
- name: Check links in docs using tox
19+
toxenv: linkcheck
20+
- name: Check dev versions of key dependencies
21+
toxenv: py39-test-devdeps
22+
toxposargs: --remote-data
23+
1424
steps:
1525
- name: Checkout code
1626
uses: actions/checkout@v2
@@ -19,10 +29,11 @@ jobs:
1929
- name: Set up Python
2030
uses: actions/setup-python@v2
2131
with:
22-
python-version: 3.8
32+
python-version: 3.9
2333
- name: Install base dependencies
2434
run: |
2535
python -m pip install --upgrade pip tox
26-
- name: Check links in docs using tox
27-
run: |
28-
tox -e linkcheck
36+
- name: Test with tox
37+
env:
38+
ADS_DEV_KEY: ${{ secrets.ADS_DEV_KEY }}
39+
run: tox ${{ matrix.toxargs}} -e ${{ matrix.toxenv}} -- ${{ matrix.toxposargs}}

.github/workflows/ci_tests.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ jobs:
4242
python: 3.8
4343
toxenv: py38-test-alldeps
4444

45-
- name: Python 3.8 with all optional dependencies, remote tests, and coverage checking
45+
- name: Python 3.8 with all optional dependencies and coverage checking
4646
os: ubuntu-latest
4747
python: 3.8
4848
toxenv: py38-test-alldeps-cov
49-
toxposargs: --remote-data
5049

5150
# - name: Windows - Python 3.8 with all optional dependencies
5251
# os: windows-latest
@@ -88,8 +87,8 @@ jobs:
8887
python -m pip install --upgrade pip
8988
python -m pip install tox codecov
9089
- name: Test with tox
91-
run: |
92-
tox -e ${{ matrix.toxenv }}
90+
run: tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}
91+
9392
# This is an example of how to upload coverage to codecov
9493
# - name: Upload coverage to codecov
9594
# if: "contains(matrix.toxenv, '-cov')"

sbpy/calib/core.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
import numpy as np
3131
from astropy.utils.state import ScienceState
3232
from astropy.utils.data import get_pkg_data_filename
33-
from astropy.table import Table, QTable
34-
from astropy.io import ascii
33+
from astropy.table import Table
3534
import astropy.units as u
3635

3736
from ..spectroscopy.sources import SpectralSource, SynphotRequired

sbpy/calib/solar_sources.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,23 @@ class SolarSpectra:
3232
'filename': 'e490-00a_2014_hires.csv',
3333
'wave_unit': 'um',
3434
'flux_unit': 'W/(m2 um)',
35-
'description': 'E490-00a (2014) low resolution reference solar spectrum (Table 4)',
35+
'description': ('E490-00a (2014) low resolution reference solar '
36+
'spectrum (Table 4)'),
3637
'bibcode': 'doi:10.1520/E0490'
3738
}
3839

3940
Kurucz1993 = {
40-
'filename': 'ftp://ftp.stsci.edu/cdbs/grid/k93models/standards/sun_kurucz93.fits',
41+
'filename': ('https://archive.stsci.edu/hlsps/reference-atlases/cdbs/'
42+
'grid/k93models/standards/sun_kurucz93.fits'),
4143
'description': 'Kurucz (1993) model, scaled by Colina et al. (1996)',
4244
'bibcode': '1993KurCD..13.....K'
4345
}
4446

4547
Castelli1996 = {
46-
'filename': 'ftp://ftp.stsci.edu/cdbs/grid/k93models/standards/sun_castelli.fits',
47-
'description': 'Castelli model, scaled and presented by Colina et al. (1996)',
48+
'filename': ('https://archive.stsci.edu/hlsps/reference-atlases/cdbs/'
49+
'grid/k93models/standards/sun_castelli.fits'),
50+
'description': ('Castelli model, scaled and presented by Colina et '
51+
'al. (1996)'),
4852
'bibcode': '1996AJ....112..307C'
4953
}
5054

sbpy/calib/tests/test_sun.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ def test_meta(self):
134134
sun = Sun.from_builtin('E490_2014')
135135
assert sun.meta is None
136136

137-
@pytest.mark.skipif('True')
138137
@pytest.mark.remote_data
139138
def test_kurucz_nan_error(self):
140139
"""sbpy#113
@@ -149,6 +148,26 @@ def test_kurucz_nan_error(self):
149148
fluxd = sun.observe(V, unit=u.ABmag)
150149
assert np.isclose(fluxd.value, -26.77, atol=0.005)
151150

151+
@pytest.mark.remote_data
152+
def test_castelli96(self):
153+
"""Verify Castelli1996 calibration.
154+
155+
According to the FITS header:
156+
157+
HISTORY Created Thu 15:49:31 16-Nov-95
158+
COMMENT solar model spectrum calculated by F. Castelli.
159+
COMMENT Absolute flux normalized to a V flux of 184.2 ergs/s/cm^2/A
160+
COMMENT For more details see Colina, Bohlin & Castelli 1996
161+
CAL/SCS-008
162+
163+
2022-06-05: sbpy calculates 184.5 ergs/s/cm^2/A; agreement within 0.2%
164+
"""
165+
166+
sun = Sun.from_builtin('Castelli1996')
167+
V = bandpass('johnson v')
168+
fluxd = sun.observe(V, unit='erg/(s cm2 AA)')
169+
assert np.isclose(fluxd.value, 184.2, rtol=0.002)
170+
152171
def test_show_builtin(self, capsys):
153172
Sun.show_builtin()
154173
captured = capsys.readouterr()

sbpy/data/ephem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ def from_oo(cls, orbit, epochs=None, location='500', scope='full',
738738
1 Ceres 2458529.2336329385 ... 1.326517587380005e-05 70.34353031031534
739739
1 Ceres 2458529.2752996054 ... 1.1193369555934085e-05 70.35298818987367 """
740740

741-
if not pyoorb:
741+
if pyoorb is None:
742742
raise RequiredPackageUnavailable('pyoorb')
743743

744744
# create a copy of orbit

sbpy/data/tests/test_orbit_remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def test_oo_propagate(self):
187187

188188
elements = ['a', 'e', 'i', 'Omega', 'w', 'M']
189189
assert all([u.isclose(oo_orbit[k][0], future_orbit[k][0])
190-
for k in elements])
190+
for k in elements])
191191
assert u.isclose(oo_orbit['epoch'][0].utc.jd,
192192
future_orbit['epoch'][0].utc.jd)
193193
assert oo_orbit['epoch'].scale == 'utc'

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ isolated_build = true
1919
pypi_filter = https://raw.githubusercontent.com/astropy/ci-helpers/main/pip_pinnings.txt
2020

2121
# Pass through the following environemnt variables which are needed for the CI
22-
passenv = HOME WINDIR LC_ALL LC_CTYPE CC CI TEST_READ_HUGE_FILE FC_GFORTRAN
22+
passenv = HOME WINDIR LC_ALL LC_CTYPE CC CI TEST_READ_HUGE_FILE FC_GFORTRAN ADS_DEV_KEY
2323

2424
# For coverage, we need to pass extra options to the C compiler
2525
setenv =

0 commit comments

Comments
 (0)