diff --git a/CHANGES.rst b/CHANGES.rst index 91b8ccdc1a..be85848478 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -20,6 +20,9 @@ Cubeviz - ``get_data`` now supports ``function=True`` to adopt the collapse-function from the spectrum viewer. [#2117] +- ``get_data`` now supports applying a spectral mask to a collapse spatial subset. [#2199] + + Imviz ^^^^^ diff --git a/jdaviz/configs/cubeviz/helper.py b/jdaviz/configs/cubeviz/helper.py index dc102af7e0..bb7a23e2e5 100644 --- a/jdaviz/configs/cubeviz/helper.py +++ b/jdaviz/configs/cubeviz/helper.py @@ -120,7 +120,8 @@ def specviz(self): self._specviz = Specviz(app=self.app) return self._specviz - def get_data(self, data_label=None, cls=None, subset_to_apply=None, function=None): + def get_data(self, data_label=None, spatial_subset=None, spectral_subset=None, function=None, + cls=None): """ Returns data with name equal to data_label of type cls with subsets applied from subset_to_apply. @@ -129,15 +130,18 @@ def get_data(self, data_label=None, cls=None, subset_to_apply=None, function=Non ---------- data_label : str, optional Provide a label to retrieve a specific data set from data_collection. - cls : `~specutils.Spectrum1D`, `~astropy.nddata.CCDData`, optional - The type that data will be returned as. - subset_to_apply : str, optional - Subset that is to be applied to data before it is returned. + spatial_subset : str, optional + Spatial subset applied to data. + spectral_subset : str, optional + Spectral subset applied to data. function : {True, False, 'minimum', 'maximum', 'mean', 'median', 'sum'}, optional Ignored if ``data_label`` does not point to cube-like data. If True, will collapse according to the current collapse function defined in the spectrum viewer. If provided as a string, the cube will be collapsed with the provided - function. If False, None, or not passed, the entire cube will be returned. + function. If False, None, or not passed, the entire cube will be returned (unless there + are values for ``spatial_subset`` and ``spectral_subset``). + cls : `~specutils.Spectrum1D`, `~astropy.nddata.CCDData`, optional + The type that data will be returned as. Returns ------- @@ -145,13 +149,20 @@ def get_data(self, data_label=None, cls=None, subset_to_apply=None, function=Non Data is returned as type cls with subsets applied. """ - if function is True: - return self.specviz.get_data(data_label=data_label, cls=cls, - subset_to_apply=subset_to_apply) + # If function is a value ('sum' or 'minimum') or True and spatial and spectral + # are set, then we collapse the cube along the spatial subset using the function, then + # we apply the mask from the spectral subset. + # If function is any value other than False, we use specviz + if (function is not False and spectral_subset and spatial_subset) or function: + return self.specviz.get_data(data_label=data_label, spectral_subset=spectral_subset, + cls=cls, spatial_subset=spatial_subset, function=function) + elif function is False and spectral_subset: + raise ValueError("function cannot be False if spectral_subset" + " is set") elif function is False: function = None - return self._get_data(data_label=data_label, cls=cls, subset_to_apply=subset_to_apply, - function=function) + return self._get_data(data_label=data_label, spatial_subset=spatial_subset, + spectral_subset=spectral_subset, function=function, cls=cls) def layer_is_cube_image_data(layer): diff --git a/jdaviz/configs/cubeviz/plugins/tests/test_cubeviz_helper.py b/jdaviz/configs/cubeviz/plugins/tests/test_cubeviz_helper.py index 2e9b0422a1..c4229448a2 100644 --- a/jdaviz/configs/cubeviz/plugins/tests/test_cubeviz_helper.py +++ b/jdaviz/configs/cubeviz/plugins/tests/test_cubeviz_helper.py @@ -4,6 +4,8 @@ from astropy.tests.helper import assert_quantity_allclose from specutils import Spectrum1D +from glue.core.roi import XRangeROI + def test_nested_helper(cubeviz_helper): '''Ensures the Cubeviz helper is always returned, even after the Specviz helper is called''' @@ -29,7 +31,7 @@ def test_invalid_function(cubeviz_helper, spectrum1d_cube): cubeviz_helper._apply_interactive_region('bqplot:ellipse', (0, 0), (9, 8)) with pytest.raises(ValueError, match='function 42 not in list of valid '): - cubeviz_helper.get_data(data_label="test[FLUX]", subset_to_apply='Subset 1', function=42) + cubeviz_helper.get_data(data_label="test[FLUX]", spatial_subset='Subset 1', function=42) # Also make sure specviz redshift slider warning does not show up. # https://github.com/spacetelescope/jdaviz/issues/2029 @@ -41,20 +43,20 @@ def test_valid_function(cubeviz_helper, spectrum1d_cube): cubeviz_helper._apply_interactive_region('bqplot:ellipse', (0, 0), (9, 8)) results_cube = cubeviz_helper.get_data(data_label="test[FLUX]", - subset_to_apply='Subset 1') + spatial_subset='Subset 1') assert results_cube.flux.ndim == 3 results_false = cubeviz_helper.get_data(data_label="test[FLUX]", - subset_to_apply='Subset 1', function=False) + spatial_subset='Subset 1', function=False) assert results_false.flux.ndim == 3 results_def = cubeviz_helper.get_data(data_label="test[FLUX]", - subset_to_apply='Subset 1', function=True) + spatial_subset='Subset 1', function=True) assert results_def.flux.ndim == 1 results_min = cubeviz_helper.get_data(data_label="test[FLUX]", - subset_to_apply='Subset 1', function="minimum") + spatial_subset='Subset 1', function="minimum") results_max = cubeviz_helper.get_data(data_label="test[FLUX]", - subset_to_apply='Subset 1', function="maximum") + spatial_subset='Subset 1', function="maximum") assert isinstance(results_min, Spectrum1D) assert_quantity_allclose(results_min.flux, [6., 14.] * u.Jy, atol=1e-5 * u.Jy) @@ -65,3 +67,50 @@ def test_valid_function(cubeviz_helper, spectrum1d_cube): assert cubeviz_helper.get_data(data_label="test[FLUX]").flux.ndim == 3 # but calling through specviz automatically collapses assert cubeviz_helper.specviz.get_data(data_label="test[FLUX]").flux.ndim == 1 + + +def test_get_data_spatial_and_spectral(cubeviz_helper, spectrum1d_cube_larger): + data_label = "test" + spatial_subset = "Subset 1" + spectral_subset = "Subset 2" + cubeviz_helper.load_data(spectrum1d_cube_larger, data_label) + cubeviz_helper._apply_interactive_region('bqplot:ellipse', (0, 0), (9, 8)) + + spec_viewer = cubeviz_helper.app.get_viewer(cubeviz_helper._default_spectrum_viewer_reference_name) # noqa + spec_viewer.apply_roi(XRangeROI(4.62440061e-07, 4.62520112e-07)) + + data_label = data_label + "[FLUX]" + # This will be the same if function is None or True + spatial_with_spec = cubeviz_helper.get_data(data_label=data_label, + spatial_subset=spatial_subset, + spectral_subset=spectral_subset) + assert spatial_with_spec.flux.ndim == 1 + assert list(spatial_with_spec.mask) == [True, True, False, False, True, + True, True, True, True, True] + assert max(list(spatial_with_spec.flux.value)) == 157. + assert min(list(spatial_with_spec.flux.value)) == 13. + + spatial_with_spec = cubeviz_helper.get_data(data_label=data_label, + spatial_subset=spatial_subset, + spectral_subset=spectral_subset, + function='minimum') + assert max(list(spatial_with_spec.flux.value)) == 78. + assert min(list(spatial_with_spec.flux.value)) == 6. + + collapse_with_spectral = cubeviz_helper.get_data(data_label=data_label, + spectral_subset=spectral_subset, + function=True) + collapse_with_spectral2 = cubeviz_helper.get_data(data_label=data_label, + function=True) + + assert list(collapse_with_spectral.flux) == list(collapse_with_spectral2.flux) + + with pytest.raises(ValueError, match=f'{spectral_subset} is not a spatial subset.'): + cubeviz_helper.get_data(data_label=data_label, spatial_subset=spectral_subset, + function=True) + with pytest.raises(ValueError, match=f'{spatial_subset} is not a spectral subset.'): + cubeviz_helper.get_data(data_label=data_label, spectral_subset=spatial_subset, + function=True) + with pytest.raises(ValueError, match='function cannot be False if spectral_subset'): + cubeviz_helper.get_data(data_label=data_label, spectral_subset=spectral_subset, + function=False) diff --git a/jdaviz/configs/imviz/helper.py b/jdaviz/configs/imviz/helper.py index ed5fe8cf8c..5d09c9a045 100644 --- a/jdaviz/configs/imviz/helper.py +++ b/jdaviz/configs/imviz/helper.py @@ -239,6 +239,28 @@ def get_catalog_source_results(self): """ return getattr(self.app, '_catalog_source_table', None) + def get_data(self, data_label=None, spatial_subset=None, cls=None): + """ + Returns data with name equal to data_label of type cls with subsets applied from + spatial_subset. + + Parameters + ---------- + data_label : str, optional + Provide a label to retrieve a specific data set from data_collection. + spatial_subset : str, optional + Spatial subset applied to data. + cls : `~specutils.Spectrum1D`, `~astropy.nddata.CCDData`, optional + The type that data will be returned as. + + Returns + ------- + data : cls + Data is returned as type cls with subsets applied. + + """ + return self._get_data(data_label=data_label, spatial_subset=spatial_subset, cls=cls) + def split_filename_with_fits_ext(filename): """Split a ``filename[ext]`` input into filename and FITS extension. diff --git a/jdaviz/configs/mosviz/helper.py b/jdaviz/configs/mosviz/helper.py index eefc35a968..8d16f085a7 100644 --- a/jdaviz/configs/mosviz/helper.py +++ b/jdaviz/configs/mosviz/helper.py @@ -1076,3 +1076,25 @@ def get_spectrum_2d(self, row=None, apply_slider_redshift="Warn"): `~specutils.Spectrum1D` """ return self._get_spectrum('2D Spectra', row, apply_slider_redshift) + + def get_data(self, data_label=None, spectral_subset=None, cls=None): + """ + Returns data with name equal to data_label of type cls with subsets applied from + spectral_subset. + + Parameters + ---------- + data_label : str, optional + Provide a label to retrieve a specific data set from data_collection. + spectral_subset : str, optional + Spectral subset applied to data. + cls : `~specutils.Spectrum1D`, `~astropy.nddata.CCDData`, optional + The type that data will be returned as. + + Returns + ------- + data : cls + Data is returned as type cls with subsets applied. + + """ + return self._get_data(data_label=data_label, spectral_subset=spectral_subset, cls=cls) diff --git a/jdaviz/configs/specviz/helper.py b/jdaviz/configs/specviz/helper.py index 04db731d89..c2a918b681 100644 --- a/jdaviz/configs/specviz/helper.py +++ b/jdaviz/configs/specviz/helper.py @@ -1,6 +1,7 @@ import warnings from astropy import units as u +from regions.core.core import Region from glue.core.subset_group import GroupedSubset from specutils import SpectralRegion, Spectrum1D @@ -76,10 +77,11 @@ def get_spectra(self, data_label=None, subset_to_apply=None, apply_slider_redshi get_data_method = self.app._jdaviz_helper.get_data viewer = self.app.get_viewer(self._default_spectrum_viewer_reference_name) function_kwargs = {'function': getattr(viewer.state, "function")} if self.app.config == 'cubeviz' else {} # noqa + all_subsets = self.app.get_subsets(object_only=True) if data_label is not None: spectrum = get_data_method(data_label=data_label, - subset_to_apply=subset_to_apply, + spectral_subset=subset_to_apply, cls=Spectrum1D) spectra[data_label] = spectrum else: @@ -88,16 +90,24 @@ def get_spectra(self, data_label=None, subset_to_apply=None, apply_slider_redshi if subset_to_apply is not None: if lyr.label == subset_to_apply: spectrum = get_data_method(data_label=lyr.data.label, - subset_to_apply=subset_to_apply, + spectral_subset=subset_to_apply, cls=Spectrum1D, **function_kwargs) spectra[lyr.data.label] = spectrum else: continue else: - if isinstance(lyr, GroupedSubset): + if (isinstance(lyr, GroupedSubset) and lyr.label in all_subsets.keys() and + isinstance(all_subsets[lyr.label][0], Region)): spectrum = get_data_method(data_label=lyr.data.label, - subset_to_apply=lyr.label, + spatial_subset=lyr.label, + cls=Spectrum1D, + **function_kwargs) + spectra[f'{lyr.data.label} ({lyr.label})'] = spectrum + elif (isinstance(lyr, GroupedSubset) and lyr.label in all_subsets.keys() and + isinstance(all_subsets[lyr.label], SpectralRegion)): + spectrum = get_data_method(data_label=lyr.data.label, + spectral_subset=lyr.label, cls=Spectrum1D, **function_kwargs) spectra[f'{lyr.data.label} ({lyr.label})'] = spectrum @@ -271,7 +281,7 @@ def set_spectrum_tick_format(self, fmt, axis=None): self._default_spectrum_viewer_reference_name ).figure.axes[axis].tick_format = fmt - def get_data(self, data_label=None, cls=None, subset_to_apply=None): + def get_data(self, data_label=None, spectral_subset=None, cls=None, **kwargs): """ Returns data with name equal to data_label of type cls with subsets applied from subset_to_apply. @@ -280,10 +290,10 @@ def get_data(self, data_label=None, cls=None, subset_to_apply=None): ---------- data_label : str, optional Provide a label to retrieve a specific data set from data_collection. + spectral_subset : str, optional + Spectral subset applied to data. cls : `~specutils.Spectrum1D`, optional The type that data will be returned as. - subset_to_apply : str, optional - Subset that is to be applied to data before it is returned. Returns ------- @@ -291,15 +301,25 @@ def get_data(self, data_label=None, cls=None, subset_to_apply=None): Data is returned as type cls with subsets applied. """ + spatial_subset = kwargs.pop("spatial_subset", None) + function = kwargs.pop("function", None) + if len(kwargs) > 0: + raise ValueError(f'kwargs {[x for x in kwargs.keys()]} are not valid') + if self.app.config == 'cubeviz': # then this is a specviz instance inside cubeviz and we want to default to the # viewer's collapse function default_sp_viewer = self.app.get_viewer(self._default_spectrum_viewer_reference_name) - function = getattr(default_sp_viewer.state, 'function', None) + if function is True or function is None: + function = getattr(default_sp_viewer.state, 'function', None) + if cls is None: cls = Spectrum1D + elif spatial_subset or function: + raise ValueError('kwargs spatial subset and function are not valid in specviz') else: + spatial_subset = None function = None - return self._get_data(data_label=data_label, cls=cls, subset_to_apply=subset_to_apply, - function=function) + return self._get_data(data_label=data_label, spatial_subset=spatial_subset, + spectral_subset=spectral_subset, function=function, cls=cls) diff --git a/jdaviz/configs/specviz/plugins/line_analysis/line_analysis.py b/jdaviz/configs/specviz/plugins/line_analysis/line_analysis.py index 134a9b917d..e19b115b1d 100644 --- a/jdaviz/configs/specviz/plugins/line_analysis/line_analysis.py +++ b/jdaviz/configs/specviz/plugins/line_analysis/line_analysis.py @@ -383,7 +383,7 @@ def _calculate_statistics(self, *args, **kwargs): # cube, but still apply that to the spatially-collapsed spectrum. continuum_mask = ~self._specviz_helper.get_data( self.dataset.selected, - subset_to_apply=self.continuum_subset_selected).mask + spectral_subset=self.continuum_subset_selected).mask spectral_axis_nanmasked = spectral_axis.value.copy() spectral_axis_nanmasked[~continuum_mask] = np.nan if self.spectral_subset_selected == "Entire Spectrum": diff --git a/jdaviz/configs/specviz2d/helper.py b/jdaviz/configs/specviz2d/helper.py index c2a50a7888..c41be5df54 100644 --- a/jdaviz/configs/specviz2d/helper.py +++ b/jdaviz/configs/specviz2d/helper.py @@ -238,3 +238,25 @@ def load_trace(self, trace, data_label, show_in_viewer=True): self.app.add_data_to_viewer( self._default_spectrum_2d_viewer_reference_name, data_label ) + + def get_data(self, data_label=None, spectral_subset=None, cls=None): + """ + Returns data with name equal to data_label of type cls with subsets applied from + spectral_subset. + + Parameters + ---------- + data_label : str, optional + Provide a label to retrieve a specific data set from data_collection. + spectral_subset : str, optional + Spectral subset applied to data. + cls : `~specutils.Spectrum1D`, `~astropy.nddata.CCDData`, optional + The type that data will be returned as. + + Returns + ------- + data : cls + Data is returned as type cls with subsets applied. + + """ + return self._get_data(data_label=data_label, spectral_subset=spectral_subset, cls=cls) diff --git a/jdaviz/core/helpers.py b/jdaviz/core/helpers.py index d9a415768d..c6759786c9 100644 --- a/jdaviz/core/helpers.py +++ b/jdaviz/core/helpers.py @@ -15,13 +15,14 @@ import astropy.units as u from astropy.wcs.wcsapi import BaseHighLevelWCS from astropy.nddata import CCDData +from regions.core.core import Region from glue.core import HubListener from glue.core.edit_subset_mode import NewMode from glue.core.message import SubsetCreateMessage, SubsetDeleteMessage from glue.core.subset import Subset, MaskSubsetState from glue.config import data_translator from ipywidgets.widgets import widget_serialization -from specutils import Spectrum1D +from specutils import Spectrum1D, SpectralRegion from jdaviz.app import Application @@ -410,7 +411,9 @@ def show_in_new_tab(self, title=None): # pragma: no cover DeprecationWarning) return self.show(loc="sidecar:tab-after", title=title) - def _get_data(self, data_label=None, cls=None, subset_to_apply=None, function=None): + def _get_data(self, data_label=None, spatial_subset=None, spectral_subset=None, + function=None, cls=None): + # Start validity checks list_of_valid_function_values = ('minimum', 'maximum', 'mean', 'median', 'sum') if function and function not in list_of_valid_function_values: @@ -418,8 +421,11 @@ def _get_data(self, data_label=None, cls=None, subset_to_apply=None, function=No f" function values {list_of_valid_function_values}") list_of_valid_subset_names = [x.label for x in self.app.data_collection.subset_groups] - if subset_to_apply and subset_to_apply not in list_of_valid_subset_names: - raise ValueError(f"Subset {subset_to_apply} not in list of valid" + if spatial_subset and spatial_subset not in list_of_valid_subset_names: + raise ValueError(f"Subset {spatial_subset} not in list of valid" + f" subset names {list_of_valid_subset_names}") + elif spectral_subset and spectral_subset not in list_of_valid_subset_names: + raise ValueError(f"Subset {spectral_subset} not in list of valid" f" subset names {list_of_valid_subset_names}") if data_label and data_label not in self.app.data_collection.labels: @@ -433,6 +439,8 @@ def _get_data(self, data_label=None, cls=None, subset_to_apply=None, function=No if cls is not None and not isclass(cls): raise TypeError( "cls in get_data must be a class or None.") + + # End validity checks and start data retrieval data = self.app.data_collection[data_label] if not cls: @@ -449,7 +457,7 @@ def _get_data(self, data_label=None, cls=None, subset_to_apply=None, function=No if cls == Spectrum1D: object_kwargs['statistic'] = function - if not subset_to_apply: + if not spatial_subset and not spectral_subset: if 'Trace' in data.meta: if cls is not None: # pragma: no cover raise ValueError("cls not supported for Trace object") @@ -459,33 +467,65 @@ def _get_data(self, data_label=None, cls=None, subset_to_apply=None, function=No return data - if not cls and subset_to_apply: + if not cls and spatial_subset: + raise AttributeError(f"A valid cls must be provided to" + f" apply subset {spatial_subset} to data. " + f"Instead, {cls} was given.") + elif not cls and spectral_subset: raise AttributeError(f"A valid cls must be provided to" - f" apply subset {subset_to_apply} to data. " + f" apply subset {spectral_subset} to data. " f"Instead, {cls} was given.") - # Loop through each subset - for subsets in self.app.data_collection.subset_groups: - # If name matches the name in subsets_to_apply, continue - if subsets.label.lower() == subset_to_apply.lower(): - # Loop through each data a subset applies to - for subset in subsets.subsets: - # If the subset applies to data with the same name as data_label, continue - if subset.data.label == data_label: - - handler, _ = data_translator.get_handler_for(cls) - try: - data = handler.to_object(subset, **object_kwargs) - except Exception as e: - warnings.warn(f"Not able to get {data_label} returned with" - f" subset {subsets.label} applied of type {cls}." - f" Exception: {e}") + # Now we work on applying subsets to the data + all_subsets = self.app.get_subsets(object_only=True) + + # Handle spatial subset + if spatial_subset and not isinstance(all_subsets[spatial_subset][0], + Region): + raise ValueError(f"{spatial_subset} is not a spatial subset.") + elif spatial_subset: + real_spatial = [sub for subsets in self.app.data_collection.subset_groups + for sub in subsets.subsets + if sub.data.label == data_label and subsets.label == spatial_subset][0] + handler, _ = data_translator.get_handler_for(cls) + try: + data = handler.to_object(real_spatial, **object_kwargs) + except Exception as e: + warnings.warn(f"Not able to get {data_label} returned with" + f" subset {spatial_subset} applied of type {cls}." + f" Exception: {e}") + elif function: + # This covers the case where cubeviz.get_data is called using a spectral_subset + # with function set. + data = data.get_object(cls=cls, **object_kwargs) + + # Handle spectral subset, including case where spatial subset is also set + if spectral_subset and not isinstance(all_subsets[spectral_subset], + SpectralRegion): + raise ValueError(f"{spectral_subset} is not a spectral subset.") + elif spectral_subset: + real_spectral = [sub for subsets in self.app.data_collection.subset_groups + for sub in subsets.subsets + if sub.data.label == data_label and subsets.label == spectral_subset][0] # noqa + + handler, _ = data_translator.get_handler_for(cls) + try: + spec_subset = handler.to_object(real_spectral, **object_kwargs) + except Exception as e: + warnings.warn(f"Not able to get {data_label} returned with" + f" subset {spectral_subset} applied of type {cls}." + f" Exception: {e}") + if spatial_subset or function: + # Return collapsed Spectrum1D object with spectral subset mask applied + data.mask = spec_subset.mask + else: + data = spec_subset + return data - def get_data(self, data_label=None, cls=None, subset_to_apply=None): + def get_data(self, data_label=None, cls=None): """ - Returns data with name equal to data_label of type cls with subsets applied from - subset_to_apply. + Returns data with name equal to data_label of type cls. Parameters ---------- @@ -493,16 +533,15 @@ def get_data(self, data_label=None, cls=None, subset_to_apply=None): Provide a label to retrieve a specific data set from data_collection. cls : `~specutils.Spectrum1D`, `~astropy.nddata.CCDData`, optional The type that data will be returned as. - subset_to_apply : str, optional - Subset that is to be applied to data before it is returned. Returns ------- data : cls - Data is returned as type cls with subsets applied. + Data is returned as type cls. """ - return self._get_data(data_label=data_label, cls=cls, subset_to_apply=subset_to_apply) + return self._get_data(data_label=data_label, spatial_subset=None, + spectral_subset=None, function=None, cls=None) class ImageConfigHelper(ConfigHelper): diff --git a/jdaviz/core/template_mixin.py b/jdaviz/core/template_mixin.py index fb094d6f5e..82b2670cba 100644 --- a/jdaviz/core/template_mixin.py +++ b/jdaviz/core/template_mixin.py @@ -1031,8 +1031,9 @@ def selected_subset_state(self): @property def selected_subset_mask(self): - get_data_kwargs = {'data_label': self.plugin.dataset.selected, - 'subset_to_apply': self.selected} + get_data_kwargs = {'data_label': self.plugin.dataset.selected} + if self._allowed_type: + get_data_kwargs[f'{self._allowed_type}_subset'] = self.selected if self.app.config == 'cubeviz' and self._allowed_type == 'spectral': viewer_ref = getattr(self.plugin, @@ -1487,7 +1488,7 @@ def selected_spectrum_for_spatial_subset(self, spatial_subset=SPATIAL_DEFAULT_TE if spatial_subset == SPATIAL_DEFAULT_TEXT: spatial_subset = None return self.plugin._specviz_helper.get_data(data_label=self.selected, - subset_to_apply=spatial_subset) + spatial_subset=spatial_subset) def _is_valid_item(self, data): def not_from_plugin(data): diff --git a/jdaviz/core/tests/test_helpers.py b/jdaviz/core/tests/test_helpers.py index 5340bd5f21..6b32860f30 100644 --- a/jdaviz/core/tests/test_helpers.py +++ b/jdaviz/core/tests/test_helpers.py @@ -64,7 +64,7 @@ def setup_class(self, specviz_helper, spectrum1d, multi_order_spectrum_list): def test_get_data_with_one_subset_per_data(self, specviz_helper, label, subset_name, answer): results = specviz_helper.get_data(data_label=label, - subset_to_apply=subset_name) + spectral_subset=subset_name) assert list(results.mask) == answer def test_get_data_no_label_multiple_in_dc(self, specviz_helper): @@ -88,4 +88,4 @@ def test_get_data_invald_cls_class(self, specviz_helper): def test_get_data_invald_subset_name(self, specviz_helper): with pytest.raises(ValueError, match="not in list of valid subset names"): - specviz_helper.get_data('Test 1D Spectrum', subset_to_apply="Fail") + specviz_helper.get_data('Test 1D Spectrum', spectral_subset="Fail")