Collect single cell data and save them to HDF5 file.
        The function will also return signals generated by all cells


        Parameters
        ----------
        measure : str
            {'LFP', 'CSD'}: Either 'LFP' or 'CSD'.


        Returns
        -------
        numpy.ndarray
            output of all neurons in population, axis 0 correspond to neuron ind

def collectSingleContribs(self, measure='LFP'):
        """
        Collect single cell data and save them to HDF5 file.
        The function will also return signals generated by all cells


        Parameters
        ----------
        measure : str
            {'LFP', 'CSD'}: Either 'LFP' or 'CSD'.


        Returns
        -------
        numpy.ndarray
            output of all neurons in population, axis 0 correspond to neuron ind

        """
        try:
            assert(self.recordSingleContribFrac <= 1 and
                   self.recordSingleContribFrac >= 0)
        except AssertionError as ae:
            raise ae, 'recordSingleContribFrac {} not in [0, 1]'.format(
                                                self.recordSingleContribFrac)

        if not self.recordSingleContribFrac:
            return
        else:
            #reconstruct RANK_CELLINDICES of all RANKs for controlling
            #communication
            if self.recordSingleContribFrac == 1.:
                SAMPLESIZE = self.POPULATION_SIZE
                RANK_CELLINDICES = []
                for i in range(SIZE):
                    RANK_CELLINDICES += [self.CELLINDICES[
                        self.CELLINDICES % SIZE == i]]
            else:
                SAMPLESIZE = int(self.recordSingleContribFrac *
                                 self.POPULATION_SIZE)
                RANK_CELLINDICES = []
                for i in range(SIZE):
                    ids = self.CELLINDICES[self.CELLINDICES % SIZE == i]
                    RANK_CELLINDICES += [ids[ids < SAMPLESIZE]]

            #gather data on this RANK
            if RANK_CELLINDICES[RANK].size > 0:
                for i, cellindex in enumerate(RANK_CELLINDICES[RANK]):
                    if i == 0:
                        data_temp = np.zeros([RANK_CELLINDICES[RANK].size] +
                                            list(self.output[cellindex
                                                             ][measure].shape),
                                            dtype=np.float32)
                    data_temp[i, ] = self.output[cellindex][measure]

            if RANK == 0:
                #container of all output
                data = np.zeros([SAMPLESIZE] +
                                 list(self.output[cellindex][measure].shape),
                                 dtype=np.float32)

                #fill in values from this RANK
                if RANK_CELLINDICES[0].size > 0:
                    for j, k in enumerate(RANK_CELLINDICES[0]):
                        data[k, ] = data_temp[j, ]

                #iterate over all other RANKs
                for i in range(1, len(RANK_CELLINDICES)):
                    if RANK_CELLINDICES[i].size > 0:
                        #receive on RANK 0 from all other RANK
                        data_temp = np.zeros([RANK_CELLINDICES[i].size] +
                                        list(self.output[cellindex
                                                         ][measure].shape),
                                        dtype=np.float32)
                        COMM.Recv([data_temp, MPI.FLOAT], source=i, tag=13)

                        #fill in values
                        for j, k in enumerate(RANK_CELLINDICES[i]):
                            data[k, ] = data_temp[j, ]
            else:
                data = None
                if RANK_CELLINDICES[RANK].size > 0:
                    #send to RANK 0
                    COMM.Send([data_temp, MPI.FLOAT], dest=0, tag=13)

            if RANK == 0:
                #save all single-cell data to file
                fname = os.path.join(self.populations_path,
                                     '%s_%ss.h5' % (self.y, measure))
                f = h5py.File(fname, 'w')
                f.create_dataset('data', data=data, compression=4)
                f['srate'] = self.output[0]['srate']
                f.close()
                assert(os.path.isfile(fname))

                print('file %s_%ss.h5 ok' % (self.y, measure))

            COMM.Barrier()

            return data