https://github.com/NikVard/memstim-hh
Tip revision: feb0b78bd97eb8598625df9bc0543233990798a7 authored by NikVard on 13 December 2023, 09:55:10 UTC
[ENV] added conda environment used for cuda runs
[ENV] added conda environment used for cuda runs
Tip revision: feb0b78
annex_funcs.py
# -------------------------------------------
# Miscellaneous helper functions
# -------------------------------------------
def make_flat(old_list):
''' Takes as argument a list of lists and flattens it (i.e. returns a 1D list with all the elements) '''
new_list = []
for elem in old_list :
if type(elem)==list:
elem_flat = make_flat(elem)
new_list += elem_flat
else :
new_list.append(elem)
return new_list
def visualise_connectivity(S, alpha=1.0):
Ns = len(S.source)
Nt = len(S.target)
fig = figure(figsize=(10, 4))
subplot(121)
plot(zeros(Ns), arange(Ns), 'ok', ms=10)
plot(ones(Nt), arange(Nt), 'ok', ms=10)
for i, j in zip(S.i, S.j):
plot([0, 1], [i, j], '-k', alpha=alpha)
xticks([0, 1], ['Source', 'Target'])
ylabel('Neuron index')
xlim(-0.1, 1.1)
ylim(-1, max(Ns, Nt))
subplot(122)
plot(S.i, S.j, 'ok')
xlim(-1, Ns)
ylim(-1, Nt)
xlabel('Source neuron index')
ylabel('Target neuron index')
return fig