def calc_lfp_layer(self):
LFPdict = {}<EOL>lastY = None<EOL>for Y, y in self.mapping_Yy:<EOL><INDENT>if lastY != Y:<EOL><INDENT>try:<EOL><INDENT>LFPdict.update({Y : self.LFPdict[y]})<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>LFPdict[Y] += self.LFPdict[y]<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>lastY = Y<EOL><DEDENT>return LFPdict<EOL>
Calculate the LFP from concatenated subpopulations residing in a
certain layer, e.g all L4E pops are summed, according to the `mapping_Yy`
attribute of the `hybridLFPy.Population` objects.