-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get rid of hypothesis testing which is just ANNOYING
- Loading branch information
Showing
2 changed files
with
11 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |