Skip to content

Instantly share code, notes, and snippets.

@cjayb
Last active March 23, 2021 09:10
Show Gist options
  • Save cjayb/4c4c2a46229f82ce940f0b58ee5e5675 to your computer and use it in GitHub Desktop.
Save cjayb/4c4c2a46229f82ce940f0b58ee5e5675 to your computer and use it in GitHub Desktop.
import os.path as op
import tempfile
import hnn_core
from hnn_core import simulate_dipole, read_params, Network
hnn_core_root = op.dirname(hnn_core.__file__)
params_fname = op.join(hnn_core_root, 'param', 'default.json')
params = read_params(params_fname)
net = Network(params)
###############################################################################
weights_ampa_d1 = {'L2_basket': 0.006562, 'L2_pyramidal': .000007,
'L5_pyramidal': 0.142300}
weights_nmda_d1 = {'L2_basket': 0.019482, 'L2_pyramidal': 0.004317,
'L5_pyramidal': 0.080074}
synaptic_delays_d1 = {'L2_basket': 0.1, 'L2_pyramidal': 0.1,
'L5_pyramidal': 0.1}
net.add_evoked_drive(
'evdist1', mu=63.53, sigma=3.85, numspikes=1, weights_ampa=weights_ampa_d1,
weights_nmda=weights_nmda_d1, location='distal',
synaptic_delays=synaptic_delays_d1, seedcore=4)
weights_ampa_p1 = {'L2_basket': 0.08831, 'L2_pyramidal': 0.01525,
'L5_basket': 0.19934, 'L5_pyramidal': 0.00865}
synaptic_delays_prox = {'L2_basket': 0.1, 'L2_pyramidal': 0.1,
'L5_basket': 1., 'L5_pyramidal': 1.}
net.add_evoked_drive(
'evprox1', mu=26.61, sigma=2.47, numspikes=1, weights_ampa=weights_ampa_p1,
weights_nmda=None, location='proximal',
synaptic_delays=synaptic_delays_prox, seedcore=4)
weights_ampa_p2 = {'L2_basket': 0.000003, 'L2_pyramidal': 1.438840,
'L5_basket': 0.008958, 'L5_pyramidal': 0.684013}
net.add_evoked_drive(
'evprox2', mu=137.12, sigma=8.33, numspikes=1,
weights_ampa=weights_ampa_p2, location='proximal',
synaptic_delays=synaptic_delays_prox, seedcore=4)
###############################################################################
from hnn_core import MPIBackend
for ii in range(20):
print(10 * '>' + f' Starting iteration {ii + 1}... ' + 10 * '<')
with MPIBackend(n_procs=8, mpi_cmd='mpiexec'):
dpls = simulate_dipole(net, n_trials=1, postproc=False)
print(10 * '>' + f' ... ended iteration {ii + 1}.' + 10 * '<')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment