def getMeanInpCurrents(params, numunits=<NUM_LIT:100>,<EOL>filepattern=os.path.join('<STR_LIT>',<EOL>'<STR_LIT>')):
<EOL>x = np.arange(<NUM_LIT:100>) * params.dt<EOL>kernel = np.exp(-x / params.model_params['<STR_LIT>'])<EOL>K_bg = np.array(sum(params.K_bg, []))<EOL>iDC =  K_bg * params.dc_amplitude * <NUM_LIT> <EOL>data = {}<EOL>for i, Y in enumerate(params.Y):<EOL><INDENT>if i % SIZE == RANK:<EOL><INDENT>fname = glob.glob(filepattern+'<STR_LIT:*>' + Y + '<STR_LIT:*>')[<NUM_LIT:0>]<EOL>print(fname)<EOL>rawdata = np.array(helpers.read_gdf(fname))<EOL>units = np.unique(rawdata[:, <NUM_LIT:0>])<EOL>if numunits > units.size:<EOL><INDENT>numcells = units.size<EOL><DEDENT>else:<EOL><INDENT>numcells = numunits<EOL><DEDENT>units = units[:numcells]<EOL>for j, unit in enumerate(units):<EOL><INDENT>slc = rawdata[:, <NUM_LIT:0>] == unit<EOL>if j == <NUM_LIT:0>:<EOL><INDENT>dataslc = rawdata[slc, <NUM_LIT:2>:]<EOL><DEDENT>else:<EOL><INDENT>dataslc = np.r_['<STR_LIT>', dataslc, rawdata[slc, <NUM_LIT:2>:]]<EOL><DEDENT><DEDENT>dataslc = dataslc.astype(float)<EOL>data.update({<EOL>Y : {<EOL>'<STR_LIT:E>' : np.convolve(dataslc[:, :, <NUM_LIT:0>].mean(axis=<NUM_LIT:0>),<EOL>kernel, '<STR_LIT>')*<NUM_LIT> + float(iDC[i]),<EOL>'<STR_LIT:I>' : np.convolve(dataslc[:, :, <NUM_LIT:1>].mean(axis=<NUM_LIT:0>),<EOL>kernel, '<STR_LIT>')*<NUM_LIT>,<EOL>'<STR_LIT>' : rawdata[slc, <NUM_LIT:1>],<EOL>'<STR_LIT>' : numunits,<EOL>}<EOL>})<EOL><DEDENT><DEDENT>data = COMM.allgather(data)<EOL>return {k: v for d in data for k, v in list(d.items())}<EOL>
return a dict with the per population mean and std synaptic current,
    averaging over numcells recorded units from each population in the
    network

    Returned currents are in unit of nA.