def compare_conditions(self, labels1, labels2, measure_name, alpha=0.01, repeats=100, num_samples=None, plot=False, random_state=None):
        """ Test for significant difference in connectivity of two sets of class labels.

        Connectivity estimates are obtained by bootstrapping. Correction for multiple testing is performed by
        controlling the false discovery rate (FDR).

        Parameters
        ----------
        labels1, labels2 : list of class labels
            The two sets of class labels to compare. Each set may contain more than one label.
        measure_name : str
            Name of the connectivity measure to calculate. See :class:`Connectivity` for supported measures.
        alpha : float, optional
            Maximum allowed FDR. The ratio of falsely detected significant differences is guaranteed to be less than
            `alpha`.
        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.
        plot : {False, None, Figure object}, optional
            Whether and where to plot the connectivity. If set to **False**, nothing is plotted. Otherwise set to the
            Figure object. If set to **None**, a new figure is created.

        Returns
        -------
        p : array, shape = [n_channels, n_channels, nfft]
            Uncorrected p-values.
        s : array, dtype=bool, shape = [n_channels, n_channels, nfft]
            FDR corrected significance. True means the difference is significant in this location.
        fig : Figure object, optional
            Instance of the figure in which was plotted. This is only returned if `plot` is not **False**.
        """
        self.set_used_labels(labels1)
        ca = self.get_bootstrap_connectivity(measure_name, repeats, num_samples, random_state=random_state)
        self.set_used_labels(labels2)
        cb = self.get_bootstrap_connectivity(measure_name, repeats, num_samples, random_state=random_state)

        p = test_bootstrap_difference(ca, cb)
        s = significance_fdr(p, alpha)

        if plot is None or plot:
            fig = plot
            if self.plot_diagonal == 'topo':
                diagonal = -1
            elif self.plot_diagonal == 'fill':
                diagonal = 0
            elif self.plot_diagonal is 'S':
                diagonal = -1
                self.set_used_labels(labels1)
                sa = self.get_bootstrap_connectivity('absS', repeats, num_samples)
                sm = np.median(sa, axis=0)
                sl = np.percentile(sa, 2.5, axis=0)
                su = np.percentile(sa, 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)

                self.set_used_labels(labels2)
                sb = self.get_bootstrap_connectivity('absS', repeats, num_samples)
                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)

                p_s = test_bootstrap_difference(ca, cb)
                s_s = significance_fdr(p_s, alpha)

                self.plotting.plot_connectivity_significance(s_s, fs=self.fs_, freq_range=self.plot_f_range,
                                                        diagonal=1, border=self.plot_outside_topo, fig=fig)
            else:
                diagonal = -1

            cm = np.median(ca, axis=0)
            cl = np.percentile(ca, 2.5, axis=0)
            cu = np.percentile(ca, 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)

            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)

            self.plotting.plot_connectivity_significance(s, fs=self.fs_, freq_range=self.plot_f_range,
                                                    diagonal=diagonal, border=self.plot_outside_topo, fig=fig)

            return p, s, fig

        return p, s
Test for significant difference in connectivity of two sets of class labels.

        Connectivity estimates are obtained by bootstrapping. Correction for multiple testing is performed by
        controlling the false discovery rate (FDR).

        Parameters
        ----------
        labels1, labels2 : list of class labels
            The two sets of class labels to compare. Each set may contain more than one label.
        measure_name : str
            Name of the connectivity measure to calculate. See :class:`Connectivity` for supported measures.
        alpha : float, optional
            Maximum allowed FDR. The ratio of falsely detected significant differences is guaranteed to be less than
            `alpha`.
        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.
        plot : {False, None, Figure object}, optional
            Whether and where to plot the connectivity. If set to **False**, nothing is plotted. Otherwise set to the
            Figure object. If set to **None**, a new figure is created.

        Returns
        -------
        p : array, shape = [n_channels, n_channels, nfft]
            Uncorrected p-values.
        s : array, dtype=bool, shape = [n_channels, n_channels, nfft]
            FDR corrected significance. True means the difference is significant in this location.
        fig : Figure object, optional
            Instance of the figure in which was plotted. This is only returned if `plot` is not **False**.