jason-neal / spectrum_overload

An astronomy spectrum class with overloaded math operators.

Home Page:http://spectrum-overload.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

normalization issue on traivs

jason-neal opened this issue · comments

Travis build 187. on python 2.7 and 3.4 was failing with this issue. a nan appearing in the normalization.

I have added a hack in the test to make it pass by removing the nans.

_______________ test_normalization_method_match_degree[linear-1] _______________
method = 'linear', degree = 1
@pytest.mark.parametrize("method, degree", [
("scalar", 0),
("linear", 1),
("quadratic", 2),
("cubic", 3)])
def test_normalization_method_match_degree(method, degree):
# TODO: Eventually call phoenix_spectrum to do this.
x = np.arange(1000)
y = np.arange(1000)
s = Spectrum(xaxis=x, flux=y)
named_method = s.normalize(method=method)
poly_deg = s.normalize(method='poly', degree=degree)

  assert np.allclose(named_method.flux, poly_deg.flux)

E assert False
E + where False = <function allclose at 0x7f105498cae8>(array([ nan, 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,\n 1., 1., 1., 1., 1., 1., ...1., 1., 1., 1., 1., 1., 1., 1., 1.,\n 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]), array([ nan, 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,\n 1., 1., 1., 1., 1., 1., ...1., 1., 1., 1., 1., 1., 1., 1., 1.,\n 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]))
E + where <function allclose at 0x7f105498cae8> = np.allclose
E + and array([ nan, 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,\n 1., 1., 1., 1., 1., 1., ...1., 1., 1., 1., 1., 1., 1., 1., 1.,\n 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]) = <spectrum_overload.spectrum.Spectrum object at 0x7f10550cee80>.flux
E + and array([ nan, 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,\n 1., 1., 1., 1., 1., 1., ...1., 1., 1., 1., 1., 1., 1., 1., 1.,\n 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]) = <spectrum_overload.spectrum.Spectrum object at 0x7f103aaebac8>.flux
spectrum_overload/test/test_Spectrum.py:475: AssertionError