Skip to content

Commit

Permalink
Only download SFD in CI and cache it
Browse files Browse the repository at this point in the history
  • Loading branch information
jobovy committed Feb 27, 2023
1 parent e2f68bf commit d1a15c0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
numpy-version: ["1.22","1.23","1.24"]
steps:
- uses: actions/checkout@v3
- name: Cache dust maps
uses: actions/cache@v3
with:
path: ${{github.workspace}}/data/
key: sfd-${{ runner.os }}-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand All @@ -30,12 +35,12 @@ jobs:
if: runner.os == 'Windows'
env:
DUST_DIR: ${{github.workspace}}/data/
run: New-Item -ItemType directory -Path $env:DUST_DIR
run: New-Item -ItemType directory -Force -Path $env:DUST_DIR
- name: Create data directory
if: runner.os != 'Windows'
env:
DUST_DIR: ${{github.workspace}}/data/
run: mkdir $DUST_DIR
run: mkdir -p $DUST_DIR
- name: Test downloads
env:
DUST_DIR: ${{github.workspace}}/data/
Expand All @@ -45,7 +50,7 @@ jobs:
env:
DUST_DIR: ${{github.workspace}}/data/
run: |
pip install .
python setup.py develop --just-sfd
- name: Test package
env:
DUST_DIR: ${{github.workspace}}/data/
Expand Down
16 changes: 16 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@
_DOWNLOAD_COMBINED= False
_DOWNLOAD_COMBINED19= False

try:
just_sfd_pos = sys.argv.index('--just-sfd')
except ValueError:
pass
else:
del sys.argv[just_sfd_pos]
_DOWNLOAD_SFD= True
_DOWNLOAD_DRIMMEL= False
_DOWNLOAD_MARSHALL= False
_DOWNLOAD_SALE= False
_DOWNLOAD_GREEN= False
_DOWNLOAD_GREEN17= False
_DOWNLOAD_GREEN19= False
_DOWNLOAD_COMBINED= False
_DOWNLOAD_COMBINED19= False

try:
test_downloads_pos= sys.argv.index('--test-downloads')
except ValueError:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_extcurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
def test_avebv(ll,bb,dist):
# Simple test of the extinction curve, using Drimmel03 as an example
# Test that A_V/E(B-V) = 3.1 for the CTIO V filter
from mwdust import Drimmel03
drim_av= Drimmel03(filter='CTIO V')
drim_ebv= Drimmel03()
assert numpy.fabs(drim_av(ll,bb,dist)/drim_ebv(ll,bb,dist)/0.86-3.1) < 0.02
from mwdust import SFD
sfd_av= SFD(filter='CTIO V')
sfd_ebv= SFD()
assert numpy.fabs(sfd_av(ll,bb,dist)/sfd_ebv(ll,bb,dist)/0.86-3.1) < 0.02
return None

0 comments on commit d1a15c0

Please sign in to comment.