Skip to content

Commit

Permalink
Get rid of hypothesis testing which is just ANNOYING
Browse files Browse the repository at this point in the history
  • Loading branch information
jobovy committed Mar 2, 2023
1 parent 555ec13 commit fd94204
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ jobs:
env:
DUST_DIR: ${{github.workspace}}/data/
run: |
pip install pytest hypothesis
pip install pytest
pytest -v tests/
23 changes: 10 additions & 13 deletions tests/test_extcurve.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
from datetime import timedelta
from hypothesis import given, strategies, settings
import numpy
from numpy.random import default_rng
rng= default_rng()

@given(strategies.floats(min_value=0.,max_value=360.,
allow_nan=False,allow_infinity=False),
strategies.floats(min_value=-90.,max_value=90.,
allow_nan=False,allow_infinity=False),
strategies.floats(min_value=0.,max_value=20.,
allow_nan=False,allow_infinity=False))
@settings(max_examples=20,
deadline=timedelta(milliseconds=100000))
def test_avebv(ll,bb,dist):
# Simple test of the extinction curve, using Drimmel03 as an example
def test_avebv():
# Simple test of the extinction curve, using SFD as an example
# Test that A_V/E(B-V) = 3.1 for the CTIO V filter
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
glons= rng.uniform(0.,360.,size=20)
glats= rng.uniform(-90.,90.,size=20)
dists= rng.uniform(0.1,10.,size=5)
for ll,bb,dist in zip(glons,glats,dists):
assert numpy.fabs(sfd_av(ll,bb,dist)/sfd_ebv(ll,bb,dist)/0.86-3.1) < 0.02, \
'SFD extinction curve for CTIO V does not agree with known values for A_V/E(B-V) = 3.1'
return None

0 comments on commit fd94204

Please sign in to comment.