diff --git a/netpyne/sim/gather.py b/netpyne/sim/gather.py index f093ecbd0..b4e0eb36b 100644 --- a/netpyne/sim/gather.py +++ b/netpyne/sim/gather.py @@ -107,6 +107,8 @@ def gatherData(gatherLFP=True, gatherDipole=True): for k in list(gather[0]['simData'].keys()): # initialize all keys of allSimData dict if gatherLFP and k == 'LFP': sim.allSimData[k] = np.zeros((gather[0]['simData']['LFP'].shape)) + elif gatherLFP and k == 'LFPPops': + sim.allSimData[k] = {p: np.zeros(gather[0]['simData']['LFP'].shape) for p in gather[0]['simData']['LFPPops'].keys()} elif gatherDipole and k == 'dipoleSum': sim.allSimData[k] = np.zeros((gather[0]['simData']['dipoleSum'].shape)) elif sim.cfg.recordDipolesHNN and k == 'dipole': @@ -136,6 +138,9 @@ def gatherData(gatherLFP=True, gatherDipole=True): sim.allSimData[key] = list(sim.allSimData[key])+list(val) # udpate simData dicts which are Vectors elif gatherLFP and key == 'LFP': sim.allSimData[key] += np.array(val) + elif gatherLFP and key == 'LFPPops': + for p in val: + sim.allSimData[key][p] += np.array(val[p]) elif gatherDipole and key == 'dipoleSum': sim.allSimData[key] += np.array(val) elif key not in singleNodeVecs: @@ -175,6 +180,8 @@ def gatherData(gatherLFP=True, gatherDipole=True): for k in list(gather[0]['simData'].keys()): # initialize all keys of allSimData dict if gatherLFP and k == 'LFP': sim.allSimData[k] = np.zeros((gather[0]['simData']['LFP'].shape)) + elif gatherLFP and k == 'LFPPops': + sim.allSimData[k] = {p: np.zeros(gather[0]['simData']['LFP'].shape) for p in gather[0]['simData']['LFPPops'].keys()} elif gatherDipole and k == 'dipoleSum': sim.allSimData[k] = np.zeros((gather[0]['simData']['dipoleSum'].shape)) elif sim.cfg.recordDipolesHNN and k == 'dipole': @@ -208,6 +215,9 @@ def gatherData(gatherLFP=True, gatherDipole=True): sim.allSimData[key] = list(sim.allSimData[key])+list(val) # udpate simData dicts which are Vectors elif gatherLFP and key == 'LFP': sim.allSimData[key] += np.array(val) + elif gatherLFP and key == 'LFPPops': + for p in val: + sim.allSimData[key][p] += np.array(val[p]) elif gatherDipole and key == 'dipoleSum': sim.allSimData[key] += np.array(val) elif key not in singleNodeVecs: @@ -469,6 +479,12 @@ def sort(popKeyAndValue): for p in value: allSimData['LFPPops'][p] += np.array(value[p]) + elif key == 'dipoleSum': + if key not in allSimData.keys(): + allSimData[key] = value + else: + allSimData[key] += value + elif key not in singleNodeVecs: allSimData[key].update(value) diff --git a/netpyne/sim/save.py b/netpyne/sim/save.py index b2299336d..41fc028e0 100644 --- a/netpyne/sim/save.py +++ b/netpyne/sim/save.py @@ -406,9 +406,13 @@ def intervalSave(simTime, gatherLFP=True): for k in list(gather[0]['simData'].keys()): # initialize all keys of allSimData dict if gatherLFP and k == 'LFP': sim.allSimData[k] = np.zeros((gather[0]['simData']['LFP'].shape)) + elif gatherLFP and k == 'LFPPops': + sim.allSimData[k] = {p: np.zeros(gather[0]['simData']['LFP'].shape) for p in gather[0]['simData']['LFPPops'].keys()} elif sim.cfg.recordDipolesHNN and k == 'dipole': for dk in sim.cfg.recordDipolesHNN: sim.allSimData[k][dk] = np.zeros(len(gather[0]['simData']['dipole'][dk])) + elif sim.cfg.recordDipole and k == 'dipoleSum': + sim.allSimData[k] = np.zeros(gather[0]['simData']['dipoleSum'].shape) else: sim.allSimData[k] = {} @@ -437,6 +441,11 @@ def intervalSave(simTime, gatherLFP=True): sim.allSimData[key] = list(sim.allSimData[key])+list(val) # udpate simData dicts which are Vectors elif gatherLFP and key == 'LFP': sim.allSimData[key] += np.array(val) + elif gatherLFP and key == 'LFPPops': + for p in val: + sim.allSimData[key][p] += np.array(val[p]) + elif key == 'dipoleSum': + sim.allSimData[key] += val elif key not in singleNodeVecs: sim.allSimData[key].update(val) # update simData dicts which are not Vectors if 'xElectrodeTransferResistances' in node: