Skip to content

Commit 462f453

Browse files
authored
Merge pull request #370 from mkelley/setup-updates-202304
Setup updates 202304
2 parents 997d64d + 2853c0a commit 462f453

File tree

19 files changed

+574
-349
lines changed

19 files changed

+574
-349
lines changed

.github/workflows/ci_cron_weekly.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,45 @@ name: Weekly CI Tests
55

66
on:
77
schedule:
8-
# run at 6am UTC on Mondays
9-
- cron: '0 6 * * 1'
8+
# run at 5am UTC on Mondays
9+
- cron: '0 5 * * 1'
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
IS_CRON: 'true'
1017

1118
jobs:
12-
weekly:
19+
tests:
1320
runs-on: ubuntu-latest
21+
env:
22+
ARCH_ON_CI: "normal"
1423
strategy:
1524
fail-fast: false
1625
matrix:
1726
include:
1827
- name: Check links in docs using tox
1928
toxenv: linkcheck
2029
- name: Check dev versions of key dependencies
21-
toxenv: py39-test-devdeps
30+
python: '3.11'
31+
toxenv: py311-test-devdeps
2232
toxposargs: --remote-data
2333

2434
steps:
2535
- name: Checkout code
26-
uses: actions/checkout@v2
36+
uses: actions/checkout@v3
2737
with:
2838
fetch-depth: 0
2939
- name: Set up Python
30-
uses: actions/setup-python@v2
40+
uses: actions/setup-python@v4
3141
with:
32-
python-version: 3.9
42+
python-version: ${{ matrix.python }}
3343
- name: Install base dependencies
3444
run: |
3545
python -m pip install --upgrade pip tox
36-
- name: Test with tox
46+
- name: Run tests
3747
env:
3848
ADS_DEV_KEY: ${{ secrets.ADS_DEV_KEY }}
39-
run: tox ${{ matrix.toxargs}} -e ${{ matrix.toxenv}} -- ${{ matrix.toxposargs}}
49+
run: tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}

.github/workflows/ci_tests.yml

Lines changed: 45 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -7,91 +7,72 @@ name: CI Tests
77
on:
88
push:
99
branches:
10-
- main # GitHub now defaults to 'main' as the name of the primary branch. Change this as needed.
11-
# tags: # run CI if specific tags are pushed
10+
- main
11+
tags:
12+
- '*'
1213
pull_request:
1314
# branches: # only build on PRs against 'main' if you need to further limit when CI is run.
1415
# - main
1516

17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
env:
22+
ARCH_ON_CI: "normal"
23+
IS_CRON: "false"
24+
1625
jobs:
1726
# Github Actions supports ubuntu, windows, and macos virtual environments:
1827
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
19-
ci_tests:
20-
name: ${{ matrix.name }}
21-
runs-on: ${{ matrix.os }}
22-
strategy:
23-
matrix:
24-
include:
25-
- name: Code style checks
26-
os: ubuntu-latest
27-
python: 3.x
28-
toxenv: codestyle
29-
30-
- name: Python 3.7 with minimal dependencies
31-
os: ubuntu-latest
32-
python: 3.7
33-
toxenv: py37-test
34-
35-
- name: Python 3.8 with all optional dependencies and coverage checking
36-
os: ubuntu-latest
37-
python: 3.8
38-
toxenv: py38-test-alldeps
39-
40-
- name: OS X - Python 3.8 with all optional dependencies
41-
os: macos-latest
42-
python: 3.8
43-
toxenv: py38-test-alldeps
28+
tests:
29+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
30+
secrets:
31+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
32+
with:
33+
setenv: |
34+
ARCH_ON_CI: "normal"
35+
IS_CRON: "false"
36+
submodules: false
37+
coverage: ''
38+
envs: |
39+
- name: Code style checks
40+
linux: codestyle
4441
45-
- name: Python 3.8 with all optional dependencies and coverage checking
46-
os: ubuntu-latest
47-
python: 3.8
48-
toxenv: py38-test-alldeps-cov
42+
- name: Python 3.11 with minimal dependencies and full coverage
43+
linux: py311-test-cov
44+
coverage: codecov
4945
50-
# - name: Windows - Python 3.8 with all optional dependencies
51-
# os: windows-latest
52-
# python: 3.8
53-
# toxenv: py38-test-alldeps
54-
55-
# - name: Python 3.7 with oldest supported version of all dependencies
56-
# os: ubuntu-16.04
57-
# python: 3.7
58-
# toxenv: py37-test-oldestdeps
59-
60-
# - name: Python 3.8 with latest dev versions of key dependencies
61-
# os: ubuntu-latest
62-
# python: 3.8
63-
# toxenv: py38-test-devdeps
64-
65-
# - name: Test building of Sphinx docs
66-
# os: ubuntu-latest
67-
# python: 3.x
68-
# toxenv: build_docs
46+
- name: Python 3.10 with all optional dependencies
47+
linux: py310-test-alldeps
48+
49+
- name: Python 3.8 with oldest supported versions
50+
linux: py38-test-oldestdeps
51+
coverage: codecov
6952
53+
macos-tests:
54+
name: Python 3.10 with all optional dependencies (MacOS)
55+
runs-on: macos-latest
56+
env:
57+
ARCH_ON_CI: "normal"
7058
steps:
7159
- name: Checkout code
72-
uses: actions/checkout@v2
60+
uses: actions/checkout@v3
7361
with:
7462
fetch-depth: 0
75-
- name: Set up python ${{ matrix.python }} on ${{ matrix.os }}
76-
uses: actions/setup-python@v2
63+
- name: Set up python
64+
uses: actions/setup-python@v4
7765
with:
78-
python-version: ${{ matrix.python }}
66+
python-version: "3.10"
7967
- name: Set up gfortran on ${{ matrix.os }}
8068
if: runner.os == 'macos'
8169
run: |
8270
echo `which gfortran-11`
8371
sudo ln -sfn /usr/local/bin/gfortran-11 /usr/local/bin/gfortran
84-
echo `which gfortran`
72+
gfortran --version
8573
- name: Install base dependencies
8674
run: |
8775
python -m pip install --upgrade pip
88-
python -m pip install tox codecov
76+
python -m pip install tox
8977
- name: Test with tox
90-
run: tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}
91-
92-
# This is an example of how to upload coverage to codecov
93-
# - name: Upload coverage to codecov
94-
# if: "contains(matrix.toxenv, '-cov')"
95-
# uses: codecov/codecov-action@v1
96-
# with:
97-
# file: ./coverage.xml
78+
run: tox -e py310-test-alldeps

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ distribute-*.tar.gz
5656
.*.sw[op]
5757
*~
5858
\#*
59+
.hypothesis
5960
.project
6061
.pydevproject
6162
.settings

CHANGES.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
0.4.0 (release date TBD)
22
========================
33

4+
* Dropped support for Python 3.7, minimum supported version is 3.8.
5+
6+
* Bumped minimum supported versions for `numpy` to 1.18, `astropy` to 4.3, `synphot`
7+
to 1.1, `astroquery` to 4.6.
8+
9+
410
New Features
511
------------
612

@@ -12,6 +18,7 @@ sbpy.data
1218

1319
- Added ``Orbit.D_criterion`` to evaluate the D-criterion between two sets
1420
of orbital elements. [#325]
21+
1522
- Added ``DataClass.__contains__`` to enable `in` operator for ``DataClass``
1623
objects. [#357]
1724

docs/sbpy/activity/dust.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ The `Afrho` class may be converted to a flux density, and the original value is
8585

8686
`Afrho` works seamlessly with `sbpy`'s spectral calibration framework (:ref:`sbpy-calib`) when the `astropy` affiliated package `synphot` is installed. The solar flux density (via `~sbpy.calib.solar_fluxd`) is not required, but instead the spectral wavelengths or the system transmission of the instrument and filter:
8787

88-
.. doctest-requires:: synphot
88+
.. doctest-requires:: synphot; astropy>=5.3
8989

9090
>>> wave = [0.4, 0.5, 0.6] * u.um
9191
>>> print(afrho.to_fluxd(wave, aper, eph)) # doctest: +FLOAT_CMP
92-
[7.76770018e-14 1.05542873e-13 9.57978939e-14] W / (m2 um)
92+
[7.76770018e-14 1.05542873e-13 9.57978939e-14] W / (um m2)
9393

9494
.. doctest-requires:: synphot
9595

docs/sbpy/calib.rst

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,21 @@ Photometric calibration (without spectra or `synphot`)
9595

9696
The `~astropy.utils.state.ScienceState` objects `~sbpy.calib.solar_fluxd` and `~sbpy.calib.vega_fluxd` control photometric calibration by filter name. These are completely independent of the spectroscopic calibration and can be used without the optional `synphot` package. The spectral flux densities (per unit wavelength) of the Sun and Vega are provided and enabled by default. Values and filters are from Willmer (2018):
9797

98+
.. testsetup::
99+
.. doctest-requires:: astropy<5.3
100+
101+
>>> from sbpy.calib import Sun, solar_fluxd, vega_fluxd
102+
>>> import sbpy.units as sbu
103+
104+
.. doctest-requires:: astropy>=5.3
105+
98106
>>> from sbpy.calib import Sun, solar_fluxd, vega_fluxd
99107
>>> import sbpy.units as sbu
100108
>>>
101109
>>> solar_fluxd.set('Willmer2018') # doctest: +IGNORE_OUTPUT
102110
>>> sun = Sun(None)
103111
>>> print(sun.observe('PS1 r')) # doctest: +FLOAT_CMP
104-
167.49428760264365 erg / (Angstrom cm2 s)
112+
167.49428760264365 erg / (Angstrom s cm2)
105113
>>> vega_fluxd.set('Willmer2018') # doctest: +IGNORE_OUTPUT
106114
>>> print(sun.observe('PS1 r', unit=sbu.VEGAmag)) # doctest: +FLOAT_CMP
107115
-27.05 mag(VEGA)
@@ -117,6 +125,8 @@ Users wanting to calibrate data with their own flux densities may do so. For ex
117125

118126
Some sbpy calculations will require the effective wavelength or the pivot wavelength. These are optional parameters that may be specified with `~sbpy.calib.solar_fluxd` and `~sbpy.calib.vega_fluxd`:
119127

128+
.. doctest-requires:: astropy>=5.3
129+
120130
>>> import astropy.units as u
121131
>>> from sbpy.calib import vega_fluxd, Vega
122132
>>>
@@ -133,15 +143,15 @@ Some sbpy calculations will require the effective wavelength or the pivot wavele
133143
... # doctest: +IGNORE_EXCEPTION_DETAIL
134144
Traceback (most recent call last):
135145
...
136-
UnitConversionError: 'Jy' (spectral flux density) and 'erg / (Angstrom cm2 s)' (spectral flux density wav) are not convertible Is "V(lambda pivot)" required and was it provided?
146+
UnitConversionError: 'Jy' (spectral flux density) and 'erg / (Angstrom s cm2)' (spectral flux density wav) are not convertible Is "V(lambda pivot)" required and was it provided?
137147
>>> vega_fluxd.set({
138148
... 'V': 3674.73 * u.Jy,
139149
... 'V(lambda eff)': 5476 * u.AA,
140150
... 'V(lambda pivot)': 5511 * u.AA
141151
... }) # doctest: +IGNORE_OUTPUT
142152
<ScienceState vega_fluxd: {'V': <Quantity 3674.73 Jy>, 'V(lambda eff)': <Quantity 5476. Angstrom>, 'V(lambda pivot)': <Quantity 5511. Angstrom>}>
143153
>>> print(vega.observe('V', unit='erg/(s cm2 AA)')) # doctest: +FLOAT_CMP
144-
3.62701e-9 erg / (Angstrom cm2 s)
154+
3.62701e-9 erg / (Angstrom s cm2)
145155

146156
Observe the Sun
147157
---------------
@@ -178,15 +188,23 @@ Compare interpolation and rebinning for the E490 low-resolution solar spectrum,
178188

179189
Inspect a sub-set of the data for this example.
180190

191+
.. doctest-requires:: astropy>=5.3
192+
181193
>>> wave = sun.wave[430:435]
182194
>>> S = sun.fluxd[430:435]
183195
>>> print(wave) # doctest: +FLOAT_CMP
184196
[5495. 5505. 5515. 5525. 5535.] Angstrom
185197
>>> print(S) # doctest: +FLOAT_CMP
186-
[1895. 1862. 1871. 1846. 1882.] W / (m2 um)
198+
[1895. 1862. 1871. 1846. 1882.] W / (um m2)
187199

188200
Interpolate with observe() and compare to the original values.
189201

202+
.. testsetup::
203+
.. doctest-requires:: astropy<5.3
204+
205+
>>> wave = sun.wave[430:435]
206+
>>> S = sun.fluxd[430:435] # for astropy<5.3
207+
190208
>>> S_interp = sun.observe(wave, interpolate=True)
191209
>>> np.allclose(S.value, S_interp.value)
192210
True

docs/sbpy/data/obs.rst

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,27 @@ Observational Data Objects (`sbpy.data.Obs`)
88
For instance, this class allows you to query observations reported to the Minor
99
Planet Center for a given target via `astroquery.mpc.MPCClass.get_observations`:
1010

11-
>>> from sbpy.data import Obs
12-
>>> data = Obs.from_mpc('2019 AA', id_type='asteroid designation') # doctest: +REMOTE_DATA
13-
>>> data # doctest: +REMOTE_DATA +SKIP
14-
<QTable masked=True length=33>
15-
number desig discovery note1 ... DEC mag band observatory
16-
... deg mag
17-
int64 str7 str1 str1 ... float64 float64 str1 str3
18-
------ ------- --------- ----- ... ------------------ ------- ---- -----------
19-
-- 2019 AA -- -- ... 42.32416944444445 20.2 G F51
20-
-- 2019 AA -- -- ... 42.32879722222223 20.3 G F51
21-
-- 2019 AA -- -- ... 42.333225000000006 20.3 G F51
22-
-- 2019 AA * -- ... 46.52321666666666 20.0 w F51
23-
-- 2019 AA -- -- ... 46.52748611111111 20.0 w F51
24-
-- 2019 AA -- -- ... 46.531755555555556 20.0 w F51
25-
... ... ... ... ... ... ... ... ...
26-
-- 2019 AA -- -- ... 46.706500000000005 20.2 V 033
27-
-- 2019 AA -- -- ... 46.70652777777778 20.2 V 033
28-
-- 2019 AA -- -- ... 49.73566111111111 20.1 i F52
29-
-- 2019 AA -- -- ... 49.73788888888889 20.1 i F52
30-
-- 2019 AA -- -- ... 49.74008611111111 20.1 i F52
31-
-- 2019 AA -- -- ... 49.742266666666666 20.2 i F52
11+
.. doctest-remote-data::
3212

13+
>>> from sbpy.data import Obs
14+
>>> data = Obs.from_mpc('2019 AA', id_type='asteroid designation')
15+
>>> data = data[:10] # limit the number of rows for this example
16+
>>> data # doctest: +SKIP
17+
<QTable length=10>
18+
number desig discovery note1 ... DEC mag band observatory
19+
... deg mag
20+
int64 str7 str1 str1 ... float64 float64 str1 str3
21+
------ ------- --------- ----- ... ------------------- ------- ---- -----------
22+
-- 2019 AA -- -- ... -2.6917250000000004 22.2 w F51
23+
-- 2019 AA -- -- ... -2.6893833333333337 22.1 w F51
24+
-- 2019 AA -- -- ... -2.6872222222222226 22.2 w F51
25+
-- 2019 AA -- -- ... 18.10141666666667 20.3 V 703
26+
-- 2019 AA -- -- ... 18.100916666666667 19.4 V 703
27+
-- 2019 AA -- -- ... 18.100555555555555 20.2 V 703
28+
-- 2019 AA -- -- ... 18.10086111111111 20.8 V 703
29+
-- 2019 AA -- -- ... 22.21022222222222 19.6 V G96
30+
-- 2019 AA -- -- ... 22.210083333333333 19.8 V G96
31+
-- 2019 AA -- -- ... 22.21022222222222 20.2 V G96
3332

3433
For a given `~sbpy.data.Obs` object, `~sbpy.data.Obs.supplement`
3534
allows you to supplement the information content of this object by
@@ -38,18 +37,17 @@ function makes use of the query functions that are part of
3837
`~sbpy.data.Ephem` and allows you to pick a service from which you
3938
would like to obtain the data.
4039

41-
>>> data.field_names # doctest: +REMOTE_DATA
40+
.. doctest-remote-data::
41+
42+
>>> data.field_names
4243
['number', 'desig', 'discovery', 'note1', 'note2', 'epoch', 'RA', 'DEC', 'mag', 'band', 'observatory']
43-
>>> data_sup = data.supplement(id_field='desig') # doctest: +REMOTE_DATA
44-
>>> data_sup.field_names # doctest: +REMOTE_DATA
44+
>>> data_sup = data.supplement(id_field='desig')
45+
>>> data_sup.field_names
4546
['number', 'desig', 'discovery', 'note1', 'note2', 'epoch', 'RA_obs', 'DEC_obs', 'mag', 'band', 'observatory', 'targetname', 'H', 'G', 'solar_presence', 'flags', 'RA', 'DEC', 'RA_app', 'DEC_app', 'RA*cos(Dec)_rate', 'DEC_rate', 'AZ', 'EL', 'AZ_rate', 'EL_rate', 'sat_X', 'sat_Y', 'sat_PANG', 'siderealtime', 'airmass', 'magextinct', 'V', 'surfbright', 'illumination', 'illum_defect', 'sat_sep', 'sat_vis', 'ang_width', 'PDObsLon', 'PDObsLat', 'PDSunLon', 'PDSunLat', 'SubSol_ang', 'SubSol_dist', 'NPole_ang', 'NPole_dist', 'EclLon', 'EclLat', 'r', 'r_rate', 'delta', 'delta_rate', 'lighttime', 'vel_sun', 'vel_obs', 'elong', 'elongFlag', 'alpha', 'lunar_elong', 'lunar_illum', 'sat_alpha', 'sunTargetPA', 'velocityPA', 'OrbPlaneAng', 'constellation', 'TDB-UT', 'ObsEclLon', 'ObsEclLat', 'NPole_RA', 'NPole_DEC', 'GlxLon', 'GlxLat', 'solartime', 'earth_lighttime', 'RA_3sigma', 'DEC_3sigma', 'SMAA_3sigma', 'SMIA_3sigma', 'Theta_3sigma', 'Area_3sigma', 'RSS_3sigma', 'r_3sigma', 'r_rate_3sigma', 'SBand_3sigma', 'XBand_3sigma', 'DoppDelay_3sigma', 'true_anom', 'hour_angle', 'alpha_true', 'PABLon', 'PABLat']
4647
>>> data_sup['r'] # doctest: +SKIP
47-
[1.87637455 1.87638696 1.87639935 1.8891401 1.88915504 1.88916999
48-
1.88918492 1.88963885 1.88964435 1.88965078 1.8896515 1.88965233
49-
1.88965306 1.88970198 1.88970271 1.88970353 1.88970426 1.88970508
50-
1.88970581 1.88978031 1.88978103 1.88978186 1.8897826 1.88978341
51-
1.88978415 1.88978497 1.88978569 1.88978653 1.88978725 1.90342431
52-
1.903438 1.90345164 1.90346529] AU
48+
<MaskedQuantity [1.74110682, 1.74111208, 1.74111672, 1.97466336,
49+
1.97465973, 1.97465603, 1.97465236, 1.98676694,
50+
1.98676467, 1.9867624 ] AU>
5351

5452
`~sbpy.data.Obs.supplement` queries in this case ephemerides from the
5553
JPL Horizons system (the default ``service`` to be used) and appends

0 commit comments

Comments
 (0)