diff --git a/py/qsonic/__init__.py b/py/qsonic/__init__.py index dd428c1..dcd108f 100644 --- a/py/qsonic/__init__.py +++ b/py/qsonic/__init__.py @@ -1,6 +1,6 @@ __author__ = 'Naim Goksel Karacayli' __email__ = 'ngokselk@gmail.com' -__version__ = '1.1.1' +__version__ = '1.1.2' class QsonicException(Exception): diff --git a/py/qsonic/spectrum.py b/py/qsonic/spectrum.py index 3b43a1e..a6cdb26 100644 --- a/py/qsonic/spectrum.py +++ b/py/qsonic/spectrum.py @@ -2,8 +2,7 @@ import numpy as np -from qsonic.mathtools import ( - _zero_function, _one_function, get_smooth_ivar, get_median_outlier_mask) +from qsonic.mathtools import _zero_function, _one_function, get_smooth_ivar def add_wave_region_parser(parser=None): @@ -303,11 +302,11 @@ def slice(self, arm, i1, i2): self.cont_params['cont'][arm][i1:i2] def set_forest_region(self, w1, w2, lya1, lya2): - """ Sets slices for the forest region. Masks outliers in each arm - separately based on moving median statistics - (see :func:`qsonic.mathtools.get_median_outlier_mask`). Also calculates + """ Sets slices for the forest region. Also calculates the mean SNR in the forest and an initial guess for the continuum - amplitude. + amplitude. This is currently turned off, but it can mask outliers in + each arm separately based on moving median statistics + (see :func:`qsonic.mathtools.get_median_outlier_mask`). Arguments --------- @@ -337,11 +336,6 @@ def set_forest_region(self, w1, w2, lya1, lya2): if self.reso: self._forestreso[arm] = self.reso[arm][:, ii1:ii2].copy() - w = get_median_outlier_mask( - self._forestflux[arm], self._forestivar[arm]) - self._forestflux[arm][w] = 0 - self._forestivar[arm][w] = 0 - self._forestivar_sm = self._forestivar self._forestweight = self._forestivar self._set_forest_related_parameters() @@ -611,8 +605,10 @@ def coadd_arms_forest( min_wave = np.min([wave[0] for wave in self.forestwave.values()]) max_wave = np.max([wave[-1] for wave in self.forestwave.values()]) - nwaves = int((max_wave - min_wave) / self.dwave + 0.1) + 1 - coadd_wave = np.linspace(min_wave, max_wave, nwaves) + nwaves = round((max_wave - min_wave) / self.dwave + 0.1) + coadd_wave = np.linspace( + min_wave, min_wave + nwaves * self.dwave, nwaves + 1) + nwaves += 1 coadd_flux = np.zeros(nwaves) coadd_ivar = np.zeros(nwaves) coadd_norm = np.zeros(nwaves) diff --git a/setup.cfg b/setup.cfg index bfa99fb..81f31f5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.1.1 +current_version = 1.1.2 commit = True tag = False message = [skip ci] Bump version: {current_version} → {new_version} diff --git a/tests/test_spectrum.py b/tests/test_spectrum.py index eef39ec..ce1c399 100644 --- a/tests/test_spectrum.py +++ b/tests/test_spectrum.py @@ -57,9 +57,10 @@ def test_set_forest_region(self, setup_data): assert ('R' not in spec.forestflux.keys()) assert (not spec.forestreso) - spec.flux['B'][10:15] = 1e2 - spec.set_forest_region(3600., 6000., 1050., 1180.) - npt.assert_equal(spec.forestflux['B'][10:15], 0) + # Test outlier masking (turned off) + # spec.flux['B'][10:15] = 1e2 + # spec.set_forest_region(3600., 6000., 1050., 1180.) + # npt.assert_equal(spec.forestflux['B'][10:15], 0) def test_drop_short_arms(self, setup_data): cat_by_survey, _, data = setup_data(1)