def testStatistics(self):
     conn_params = self.conn_dict.copy()
     conn_params['allow_autapses'] = True
     conn_params['allow_multapses'] = True
     conn_params['N'] = self.N
     for fan in ['in', 'out']:
         expected = connect_test_base.get_expected_degrees_totalNumber(
             self.N, fan, self.N_s, self.N_t)
         pvalues = []
         for i in range(self.stat_dict['n_runs']):
             connect_test_base.reset_seed(i + 1, self.nr_threads)
             self.setUpNetwork(conn_dict=conn_params,
                               N1=self.N_s,
                               N2=self.N_t)
             degrees = connect_test_base.get_degrees(
                 fan, self.pop1, self.pop2)
             degrees = connect_test_base.gather_data(degrees)
             if degrees is not None:
                 chi, p = connect_test_base.chi_squared_check(
                     degrees, expected)
                 pvalues.append(p)
             connect_test_base.mpi_barrier()
         p = None
         if degrees is not None:
             ks, p = scipy.stats.kstest(pvalues, 'uniform')
         p = connect_test_base.bcast_data(p)
         self.assertGreater(p, self.stat_dict['alpha2'])
    def testStatistics(self):
        for fan in ['in', 'out']:
            expected = connect_test_base.get_expected_degrees_bernoulli(
                self.p, fan, self.N_s, self.N_t)

            pvalues = []
            for i in range(self.stat_dict['n_runs']):
                connect_test_base.reset_seed(i + 1, self.nr_threads)
                self.setUpNetwork(conn_dict=self.conn_dict,
                                  N1=self.N_s,
                                  N2=self.N_t)
                degrees = connect_test_base.get_degrees(
                    fan, self.pop1, self.pop2)
                degrees = connect_test_base.gather_data(degrees)
                # degrees = self.comm.gather(degrees, root=0)
                # if self.rank == 0:
                if degrees is not None:
                    chi, p = connect_test_base.chi_squared_check(
                        degrees, expected, self.rule)
                    pvalues.append(p)
                connect_test_base.mpi_barrier()
            if degrees is not None:
                ks, p = scipy.stats.kstest(pvalues, 'uniform')
                self.assertTrue(p > self.stat_dict['alpha2'])