diff --git a/CHANGES.rst b/CHANGES.rst index 2127e25..cef6429 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,22 @@ API Changes Bug Fixes ^^^^^^^^^ + +Other changes + +1.4.1 (unreleased) +------------------ + +New Features +^^^^^^^^^^^^ + +API Changes +^^^^^^^^^^^ + +Bug Fixes +^^^^^^^^^ +- Fix bug where Background one sided / two sided was not correctly assigning units to data. [#221] + Other changes ^^^^^^^^^^^^^ diff --git a/specreduce/core.py b/specreduce/core.py index a997147..1737d0f 100644 --- a/specreduce/core.py +++ b/specreduce/core.py @@ -51,7 +51,21 @@ def _parse_image(self, image, disp_axis=1): # useful for Background's instance methods return self.image - img = self._get_data_from_image(image) + img = self._get_data_from_image(image, disp_axis=disp_axis) + + return img + + @staticmethod + def _get_data_from_image(image, disp_axis=1): + """Extract data array from various input types for `image`. + Retruns `np.ndarray` of image data.""" + + if isinstance(image, u.quantity.Quantity): + img = image.value + elif isinstance(image, np.ndarray): + img = image + else: # NDData, including CCDData and Spectrum1D + img = image.data # mask and uncertainty are set as None when they aren't specified upon # creating a Spectrum1D object, so we must check whether these @@ -74,17 +88,6 @@ def _parse_image(self, image, disp_axis=1): return Spectrum1D(img * unit, spectral_axis=spectral_axis, uncertainty=uncertainty, mask=mask) - @staticmethod - def _get_data_from_image(image): - """Extract data array from various input types for `image`. - Retruns `np.ndarray` of image data.""" - - if isinstance(image, u.quantity.Quantity): - img = image.value - if isinstance(image, np.ndarray): - img = image - else: # NDData, including CCDData and Spectrum1D - img = image.data return img