Skip to content

Commit

Permalink
Merge pull request #213 from linetools/wvmn_max
Browse files Browse the repository at this point in the history
Bug fix for wvmin/max
  • Loading branch information
nhmc committed May 6, 2016
2 parents bf04b8d + b432129 commit f0b40e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions linetools/spectra/tests/test_xspectrum_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
2 changes: 1 addition & 1 deletion linetools/spectra/xspectrum1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f0b40e4

Please sign in to comment.