def calc_variances(params):
depth = params.electrodeParams['<STR_LIT:z>']<EOL>for i, data_type in enumerate(['<STR_LIT>','<STR_LIT>']):<EOL><INDENT>if i % SIZE == RANK:<EOL><INDENT>f_out = h5py.File(os.path.join(params.savefolder, ana_params.analysis_folder,<EOL>data_type + ana_params.fname_variances), '<STR_LIT:w>')<EOL>f_out['<STR_LIT>']=depth<EOL>for celltype in params.y:<EOL><INDENT>f_in = h5py.File(os.path.join(params.populations_path,<EOL>'<STR_LIT>' % (celltype,data_type) + '<STR_LIT>' ))<EOL>var = f_in['<STR_LIT:data>'].value[:, ana_params.transient:].var(axis=<NUM_LIT:1>)<EOL>f_in.close()<EOL>f_out[celltype]= var<EOL><DEDENT>f_in = h5py.File(os.path.join(params.savefolder, data_type + '<STR_LIT>' ))<EOL>var= f_in['<STR_LIT:data>'].value[:, ana_params.transient:].var(axis=<NUM_LIT:1>)<EOL>f_in.close()<EOL>f_out['<STR_LIT>']= var<EOL>f_out.close()<EOL><DEDENT><DEDENT>return<EOL>
This function calculates the variance of the sum signal and all population-resolved signals