Calculate bootstrap estimates of spectral connectivity measures.

        Bootstrapping is performed on trial level.

        Parameters
        ----------
        measure_names : {str, list of str}
            Name(s) of the connectivity measure(s) to calculate. See :class:`Connectivity` for supported measures.
        repeats : int, optional
            How many bootstrap estimates to take.
        num_samples : int, optional
            How many samples to take for each bootstrap estimates. Defaults to the same number of trials as present in
            the data.

        Returns
        -------
        measure : array, shape = [`repeats`, n_channels, n_channels, nfft]
            Values of the connectivity measure for each bootstrap estimate. If `measure_names` is a list of strings a
            dictionary is returned, where each key is the name of the measure, and the corresponding values are
            ndarrays of shape [`repeats`, n_channels, n_channels, nfft].

        See Also
        --------
        :func:`scot.connectivity_statistics.bootstrap_connectivity` : Calculates bootstrap connectivity

def get_bootstrap_connectivity(self, measure_names, repeats=100, num_samples=None, plot=False, random_state=None):
        """ Calculate bootstrap estimates of spectral connectivity measures.

        Bootstrapping is performed on trial level.

        Parameters
        ----------
        measure_names : {str, list of str}
            Name(s) of the connectivity measure(s) to calculate. See :class:`Connectivity` for supported measures.
        repeats : int, optional
            How many bootstrap estimates to take.
        num_samples : int, optional
            How many samples to take for each bootstrap estimates. Defaults to the same number of trials as present in
            the data.

        Returns
        -------
        measure : array, shape = [`repeats`, n_channels, n_channels, nfft]
            Values of the connectivity measure for each bootstrap estimate. If `measure_names` is a list of strings a
            dictionary is returned, where each key is the name of the measure, and the corresponding values are
            ndarrays of shape [`repeats`, n_channels, n_channels, nfft].

        See Also
        --------
        :func:`scot.connectivity_statistics.bootstrap_connectivity` : Calculates bootstrap connectivity
        """
        if num_samples is None:
            num_samples = np.sum(self.trial_mask_)

        cb = bootstrap_connectivity(measure_names, self.activations_[self.trial_mask_, :, :],
                                    self.var_, self.nfft_, repeats, num_samples, random_state=random_state)

        if plot is None or plot:
            fig = plot
            if self.plot_diagonal == 'fill':
                diagonal = 0
            elif self.plot_diagonal == 'S':
                diagonal = -1
                sb = self.get_bootstrap_connectivity('absS', repeats, num_samples)
                sb /= np.max(sb)     # scale to 1 since components are scaled arbitrarily anyway
                sm = np.median(sb, axis=0)
                sl = np.percentile(sb, 2.5, axis=0)
                su = np.percentile(sb, 97.5, axis=0)
                fig = self.plotting.plot_connectivity_spectrum([sm, sl, su], fs=self.fs_, freq_range=self.plot_f_range,
                                                          diagonal=1, border=self.plot_outside_topo, fig=fig)
            else:
                diagonal = -1
            cm = np.median(cb, axis=0)
            cl = np.percentile(cb, 2.5, axis=0)
            cu = np.percentile(cb, 97.5, axis=0)
            fig = self.plotting.plot_connectivity_spectrum([cm, cl, cu], fs=self.fs_, freq_range=self.plot_f_range,
                                                      diagonal=diagonal, border=self.plot_outside_topo, fig=fig)
            return cb, fig

        return cb