From b43212924708c0a9f192ae3d2ef40b22204d3323 Mon Sep 17 00:00:00 2001 From: "J. Xavier Prochaska" Date: Thu, 5 May 2016 08:56:06 -0700 Subject: [PATCH] Bug in wvmin, wvmax --- linetools/spectra/tests/test_xspectrum_utils.py | 15 +++++++++++++-- linetools/spectra/xspectrum1d.py | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/linetools/spectra/tests/test_xspectrum_utils.py b/linetools/spectra/tests/test_xspectrum_utils.py index 199448bf..134316f4 100644 --- a/linetools/spectra/tests/test_xspectrum_utils.py +++ b/linetools/spectra/tests/test_xspectrum_utils.py @@ -184,8 +184,6 @@ def test_continuum_utils(spec): np.testing.assert_allclose(spec.flux,flux_old) - - def test_assignment(spec): temp = np.arange(1, len(spec.wavelength) + 1) spec.wavelength = temp * u.m @@ -197,3 +195,16 @@ def test_assignment(spec): assert spec.sig[0] == temp[0] * unit spec.co = temp assert spec.co[0] == temp[0] * unit + + +def test_wvmnx(): + npix = 1000 + # Without sig + spec = XSpectrum1D.from_tuple((np.linspace(5000.,6000,npix), np.ones(npix))) + assert spec.wvmin.value == 5000. + assert spec.wvmax.value == 6000. + # With sig + spec = XSpectrum1D.from_tuple((np.linspace(5000.,6000,npix), np.ones(npix), + np.ones(npix)*0.1)) + assert spec.wvmin.value == 5000. + assert spec.wvmax.value == 6000. diff --git a/linetools/spectra/xspectrum1d.py b/linetools/spectra/xspectrum1d.py index 7af100ee..229a34eb 100644 --- a/linetools/spectra/xspectrum1d.py +++ b/linetools/spectra/xspectrum1d.py @@ -334,7 +334,7 @@ def set_diagnostics(self): and `_wvmax`. """ # Cut on good pixels - if self.sig is not None: + if self.sig_is_set: gdpx = self.sig > 0. else: gdpx = np.array([True] * self.data['flux'].size)