diff --git a/glue_astronomy/translators/spectrum1d.py b/glue_astronomy/translators/spectrum1d.py index a5c6799..75e29c2 100644 --- a/glue_astronomy/translators/spectrum1d.py +++ b/glue_astronomy/translators/spectrum1d.py @@ -158,7 +158,8 @@ def _has_homogenous_spectral_solution(self, data): def to_data(self, obj): - # specutils 2.0 doesn't care where the spectral axis anymore, but we still need PaddedSpectrumWCS for now + # specutils 2.0 doesn't care where the spectral axis anymore, but we still need + # PaddedSpectrumWCS for now if obj.flux.ndim > 1 and obj.wcs.world_n_dim == 1: data = Data(coords=PaddedSpectrumWCS(obj.wcs, obj.flux.ndim, obj.spectral_axis_index)) else: @@ -233,17 +234,19 @@ def to_object(self, data_or_subset, attribute=None, statistic='mean'): wcs_args[spectral_axis_index] = np.arange(data.shape[spectral_axis_index]) wcs_args.reverse() spectral_and_spatial = data.coords.pixel_to_world(*wcs_args) - spectral_axis = [x for x in spectral_and_spatial if isinstance(x, SpectralCoord)][0] + spectral_axis = [x for x in spectral_and_spatial if isinstance(x, SpectralCoord)][0] # noqa kwargs = {'spectral_axis': spectral_axis} else: - # In this case we should resample the flux onto a common spectral axis before collapsing - warnings.warn("Spectral solution is not the same at all spatial points," - " collapsing may give inaccurate results.") + # In this case the flux should be resampled onto a common spectral axis + # before collapsing + warnings.warn('Spectral solution is not the same at all spatial points,' + ' collapsing may give inaccurate results.') kwargs = {'wcs': data.coords} else: # Shouldn't get here anymore, but just in case. - raise ValueError('Can only use statistic= if the Data object has a GWCS or FITS WCS') + raise ValueError('Can only use statistic= if the Data object has a GWCS' + ' or FITS WCS') elif isinstance(data.coords, SpectralCoordinates):