Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

TST: Move bbfunc test from astropy to here #223

Closed
pllim opened this issue Oct 10, 2019 · 0 comments · Fixed by #250
Closed

TST: Move bbfunc test from astropy to here #223

pllim opened this issue Oct 10, 2019 · 0 comments · Fixed by #250

Comments

@pllim
Copy link
Contributor

pllim commented Oct 10, 2019

https://github.com/astropy/astropy/blob/09b7796bbd4eadc793bb48fc5c8554bb5bd4af0d/astropy/modeling/tests/test_blackbody.py#L97-L111

def test_blackbody_synphot():
    """Test that it is consistent with IRAF SYNPHOT BBFUNC."""
    # Solid angle of solar radius at 1 kpc
    fac = np.pi * (const.R_sun / const.kpc) ** 2 * u.sr

    with np.errstate(all='ignore'):
        flux = blackbody_nu([100, 1, 1000, 1e4, 1e5] * u.AA, 5000) * fac
    assert flux.unit == FNU

    # Special check for overflow value (SYNPHOT gives 0)
    assert np.log10(flux[0].value) < -143

    np.testing.assert_allclose(
        flux.value[1:], [0, 2.01950807e-34, 3.78584515e-26, 1.90431881e-27],
        rtol=0.01)  # 1% accuracy

This test will not run for the refactored BlackBody code after astropy/astropy#9282 is merged.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant