def collectSingleContribs(self, measure='<STR_LIT>'):
try:<EOL><INDENT>assert(self.recordSingleContribFrac <= <NUM_LIT:1> and<EOL>self.recordSingleContribFrac >= <NUM_LIT:0>)<EOL><DEDENT>except AssertionError as ae:<EOL><INDENT>raise ae('<STR_LIT>'.format(<EOL>self.recordSingleContribFrac))<EOL><DEDENT>if not self.recordSingleContribFrac:<EOL><INDENT>return<EOL><DEDENT>else:<EOL><INDENT>if self.recordSingleContribFrac == <NUM_LIT:1.>:<EOL><INDENT>SAMPLESIZE = self.POPULATION_SIZE<EOL>RANK_CELLINDICES = []<EOL>for i in range(SIZE):<EOL><INDENT>RANK_CELLINDICES += [self.CELLINDICES[<EOL>self.CELLINDICES % SIZE == i]]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>SAMPLESIZE = int(self.recordSingleContribFrac *<EOL>self.POPULATION_SIZE)<EOL>RANK_CELLINDICES = []<EOL>for i in range(SIZE):<EOL><INDENT>ids = self.CELLINDICES[self.CELLINDICES % SIZE == i]<EOL>RANK_CELLINDICES += [ids[ids < SAMPLESIZE]]<EOL><DEDENT><DEDENT>if RANK_CELLINDICES[RANK].size > <NUM_LIT:0>:<EOL><INDENT>for i, cellindex in enumerate(RANK_CELLINDICES[RANK]):<EOL><INDENT>if i == <NUM_LIT:0>:<EOL><INDENT>data_temp = np.zeros([RANK_CELLINDICES[RANK].size] +<EOL>list(self.output[cellindex<EOL>][measure].shape),<EOL>dtype=np.float32)<EOL><DEDENT>data_temp[i, ] = self.output[cellindex][measure]<EOL><DEDENT><DEDENT>if RANK == <NUM_LIT:0>:<EOL><INDENT>data = np.zeros([SAMPLESIZE] +<EOL>list(self.output[cellindex][measure].shape),<EOL>dtype=np.float32)<EOL>if RANK_CELLINDICES[<NUM_LIT:0>].size > <NUM_LIT:0>:<EOL><INDENT>for j, k in enumerate(RANK_CELLINDICES[<NUM_LIT:0>]):<EOL><INDENT>data[k, ] = data_temp[j, ]<EOL><DEDENT><DEDENT>for i in range(<NUM_LIT:1>, len(RANK_CELLINDICES)):<EOL><INDENT>if RANK_CELLINDICES[i].size > <NUM_LIT:0>:<EOL><INDENT>data_temp = np.zeros([RANK_CELLINDICES[i].size] +<EOL>list(self.output[cellindex<EOL>][measure].shape),<EOL>dtype=np.float32)<EOL>COMM.Recv([data_temp, MPI.FLOAT], source=i, tag=<NUM_LIT>)<EOL>for j, k in enumerate(RANK_CELLINDICES[i]):<EOL><INDENT>data[k, ] = data_temp[j, ]<EOL><DEDENT><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>data = None<EOL>if RANK_CELLINDICES[RANK].size > <NUM_LIT:0>:<EOL><INDENT>COMM.Send([data_temp, MPI.FLOAT], dest=<NUM_LIT:0>, tag=<NUM_LIT>)<EOL><DEDENT><DEDENT>if RANK == <NUM_LIT:0>:<EOL><INDENT>fname = os.path.join(self.populations_path,<EOL>'<STR_LIT>' % (self.y, measure))<EOL>f = h5py.File(fname, '<STR_LIT:w>')<EOL>f.create_dataset('<STR_LIT:data>', data=data, compression=<NUM_LIT:4>)<EOL>f['<STR_LIT>'] = self.output[<NUM_LIT:0>]['<STR_LIT>']<EOL>f.close()<EOL>assert(os.path.isfile(fname))<EOL>print(('<STR_LIT>' % (self.y, measure)))<EOL><DEDENT>COMM.Barrier()<EOL>return data<EOL><DEDENT>
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