def METHOD_NAME(self, add_data=True):
    """
    Collapse over the spectral axis.
    Parameters
    ----------
    add_data : bool
        Whether to load the resulting data back into the application according to
        ``add_results``.
    """
    # Collapsing over the spectral axis. Cut out the desired spectral
    # region. Defaults to the entire spectrum.
    cube = self.dataset.get_object(cls=Spectrum1D, statistic=None)
    spec_min, spec_max = self.spectral_subset.selected_min_max(cube)
    with warnings.catch_warnings():
        warnings.filterwarnings('ignore', message='No observer defined on WCS')
        spec = spectral_slab(cube, spec_min, spec_max)
        # Spatial-spatial image only.
        collapsed_spec = spec.METHOD_NAME(self.function_selected.lower(), axis=-1).T  # Quantity
    if add_data:
        data = Data()
        data['flux'] = collapsed_spec.value
        data.get_component('flux').units = str(collapsed_spec.unit)
        self.add_results.add_results_from_plugin(data)
        snackbar_message = SnackbarMessage(
            f"Data set '{self.dataset_selected}' collapsed successfully.",
            color="success",
            sender=self)
        self.hub.broadcast(snackbar_message)
    return collapsed_spec