Skip to content

Commit

Permalink
Fix failing uncertainty test
Browse files Browse the repository at this point in the history
  • Loading branch information
nmearl committed Sep 17, 2019
1 parent e804847 commit 31a4b53
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions specutils/tests/test_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,18 @@ def calculate_rms(x, init_mod, implicit_weights):
spec = Spectrum1D(spectral_axis=x, flux=y * u.Jy,
uncertainty=StdDevUncertainty(unc * u.Jy))

weights = 'unc' if implicit_weights else 1 / unc
weights = 'unc' if implicit_weights else unc ** -2

spec_fit = fit_lines(spec, init_mod, weights=weights)

rms.append(np.std(spec_fit(x).value - y))

return np.median(rms)

assert np.allclose(calculate_rms(x, init_mod, implicit_weights=True), 5.101611033799086)
assert np.allclose(calculate_rms(x, init_mod, implicit_weights=False), 5.113697654869089)
assert np.allclose(calculate_rms(x, init_mod, implicit_weights=True),
5.113708262419985)
assert np.allclose(calculate_rms(x, init_mod, implicit_weights=False),
5.147348340711497)


def test_single_peak_fit_window():
Expand Down

0 comments on commit 31a4b53

Please sign in to comment.