Exemple #1
0
def find_jid_spiking_kcs(jid_list, datadir):
    ret = []
    for jid in jid_list:
        fname = nda.find_h5_file(str(jid), datadir)
        with h5.File(fname, 'r') as fd:
            ret.append(nda.get_spiking_kcs(fd))
    return ret
def get_dv_kc_data(fname):
    """Create a dataset where each row contains a KC, its presynaptic GGN
    section, maximum conductance from GGN, peak depolarization of that
    section and the number of spikes generated by that KC"""
    with h5.File(fname, 'r') as fd:
        print(jid, len(nda.get_spiking_kcs(fd)))
        print(yaml.dump(nda.load_config(fd), default_style=''))
        ggn_kc_gbar = pd.DataFrame(fd[nda.ggn_kc_syn_path]['pre', 'post',
                                                           'gbar'][:, 0])
        ggn_peak_vm = fd['/data/uniform/ggn_output/GGN_output_Vm'].value.max(
            axis=1)
        ggn_sec = fd['/data/uniform/ggn_output/GGN_output_Vm'].dims[0][
            'source']
        ggn_sec_vm = pd.DataFrame(data={'sec': ggn_sec, 'vm': ggn_peak_vm})
        pn_kc_gmax = pd.DataFrame(fd[nda.pn_kc_syn_path]['post', 'gmax'][:, 0])
        pn_kc_gmax_by_kc = pn_kc_gmax.groupby('post').sum().reset_index()
        kc_sc = {
            kc_st.attrs['source']: len(kc_st)
            for kc_st in fd[nda.kc_st_path].values()
        }
    df_kc_sc = pd.DataFrame(data={
        'kc': list(kc_sc.keys()),
        'spike_count': list(kc_sc.values())
    })
    combined = pd.merge(ggn_kc_gbar, df_kc_sc, left_on='post', right_on='kc')
    combined = pd.merge(combined, ggn_sec_vm, left_on='pre', right_on='sec')
    combined.drop(columns=['pre', 'post'], inplace=True)
    return combined
plt.rc('font', size=8)

_ur = pint.UnitRegistry()
Q_ = _ur.Quantity
# datadir = 'Z:/Subhasis/ggn_model_data/olfactory_network'
# datadir = '/data/rays3/ggn/olfactory_network/'
datadir = 'D:/biowulf_stage/olfactory_network'

#** jid_sc for only shifting PN, constant GGN->KC inhibition - but this did not
# have PN-KC clustered conn

jid_sc = '22087969'
fname_sc = nda.find_h5_file(jid_sc, datadir)
fd_sc = h5.File(fname_sc, 'r')
print('shifting PN, jid: {}, spiking KCs {}'.format(
    jid_sc, len(nda.get_spiking_kcs(fd_sc))))
print(yaml.dump(nda.load_config(fd_sc), default_style=''))
print('-' * 20)

stiminfo = nda.get_stimtime(fd_sc)
pn_st = []
pn_id = []
for pn in fd_sc[nda.pn_st_path].values():
    pn_st.append(pn[:])
    pn_id.append([int(pn.name.rpartition('_')[-1])] * len(pn))

kc_st = []
kc_id = []
for kc, st in fd_sc[nda.kc_st_path].items():
    kc_st.append(st[:])
    kc_id.append([int(kc)] * len(st))
Exemple #4
0
plt.rc('font', size=8)

_ur = pint.UnitRegistry()
Q_ = _ur.Quantity
# datadir = 'Z:/Subhasis/ggn_model_data/olfactory_network'
# datadir = '/data/rays3/ggn/olfactory_network/'
datadir = 'D:/biowulf_stage/olfactory_network'

#** jid_sc for only shifting PN, constant GGN->KC inhibition - but this did not
# have PN-KC clustered conn

# jid_sc = '22295183'
jid_sc = '24211204'
fname_sc = nda.find_h5_file(jid_sc, datadir)
fd_sc = h5.File(fname_sc, 'r')
print('shifting PN, jid: {}, spiking KCs {}'.format(jid_sc, len(nda.get_spiking_kcs(fd_sc))))
print(yaml.dump(nda.load_config(fd_sc), default_style=''))
print('-' * 20)

stiminfo = nda.get_stimtime(fd_sc)
pn_st = []
pn_id = []
for pn in fd_sc[nda.pn_st_path].values():
    pn_st.append(pn[:])
    pn_id.append([int(pn.name.rpartition('_')[-1])] * len(pn))

kc_st = []
kc_id = []
for kc, st in fd_sc[nda.kc_st_path].items():
    kc_st.append(st[:])
    kc_id.append([int(kc)] * len(st))
gs = gridspec.GridSpec(nrows=3, ncols=1, height_ratios=[2, 1, 1], hspace=0.05)
fig = plt.figure()
ax0 = fig.add_subplot(gs[0])
ax1 = fig.add_subplot(gs[1], sharex=ax0)
ax2 = fig.add_subplot(gs[2], sharex=ax0, sharey=ax1)

#* open file descriptors
#** jid_shifting_lognorm for shifting PNs with lognorm distribution of synapses
# jid = '3047110'  # this was old version
# jid_lognorm = '16240941'  # newer simulation with 0.2 s off response
# jid_lognorm = '22087970'   # This is with lognorm distribution of all synaptic strengths, pn-kc gmax=2.4pS, 5K KCs spiked
jid_lognorm = '22087969'
fname_lognorm = nda.find_h5_file(jid_lognorm, datadir)
fd_lognorm = h5.File(fname_lognorm, 'r')
print('shifting PN, jid: {}, spiking KCs {}'.format(
    jid_lognorm, len(nda.get_spiking_kcs(fd_lognorm))))
print(yaml.dump(nda.load_config(fd_lognorm), default_style=''))
print('-' * 20)
#** jid_constant for only shifting PN, constant GGN->KC inhibition - but this did not
# have PN-KC clustered conn
# jid_constant = '16562835'   # Thu Mar 14 13:49:49 EDT 2019 - this file was somehow lost from backup.
# jid_constant = '22295183'   # Redid simulations with constant synaptic conductances on 2019-03-13 PN-KC gmax=3 pS, spiking KCs 1707
jid_constant = '24211204'  # The jid '22295183' in fig 5 had off-time 0.2 s, this one has 0.5s
fname_constant = nda.find_h5_file(jid_constant, datadir)
fd_constant = h5.File(fname_constant, 'r')
print('shifting PN, jid: {}, spiking KCs {}'.format(
    jid_constant, len(nda.get_spiking_kcs(fd_constant))))
print(yaml.dump(nda.load_config(fd_constant), default_style=''))
print('-' * 20)

#* plot PN activity from jid_lognorm
Exemple #6
0
#     '9674069',
#     '9674087',
#     '9674120',
#     '9673863']
# ^-These will not do - constant GGN->KC inhibition with 2% weakly inhibited

jid = '9674118'
fname = nda.find_h5_file(jid, datadir)

gs = gridspec.GridSpec(nrows=2, ncols=1, height_ratios=[3, 1], hspace=0.05)
fig = plt.figure()
ax0 = fig.add_subplot(gs[0])
ax1 = fig.add_subplot(gs[1], sharex=ax0)
axes = [ax0, ax1]
with h5.File(fname, 'r') as fd:
    print('jid: {} spiking KCs: {}'.format(jid, len(nda.get_spiking_kcs(fd))))
    print(yaml.dump(nda.load_config(fd), default_style=''))
    # pn_st = []
    # pn_id = []
    # for pn in fd[nda.pn_st_path].values():
    #     pn_st.append(pn.value)
    #     pn_id.append([int(pn.name.rpartition('_')[-1])] * len(pn))
    # ax0.plot(np.concatenate(pn_st[::10]), np.concatenate(pn_id[::10]), 'k,')
    kc_x, kc_y = nda.get_event_times(fd[nda.kc_st_path])
    ax0.plot(np.concatenate(kc_x[::10]), np.concatenate(kc_y[::10]), 'k,')
    myplot.plot_ggn_vm(ax1,
                       fd,
                       fd['/data/uniform/ggn_basal/GGN_basal_Vm'],
                       'dend_b',
                       1,
                       color='k')
Exemple #7
0
datadir = '/data/rays3/ggn/olfactory_network/'

# jid = '16034794'
jid = '22295165'
fname = nda.find_h5_file(jid, datadir)

gs = gridspec.GridSpec(nrows=3, ncols=1, height_ratios=[2, 2, 1], hspace=0.05)
fig = plt.figure()
ax0 = fig.add_subplot(gs[0])
ax1 = fig.add_subplot(gs[1], sharex=ax0)
ax2 = fig.add_subplot(gs[2], sharex=ax0)

axes = [ax0, ax1, ax2]

with h5.File(fname, 'r') as fd:
    print(jid, len(nda.get_spiking_kcs(fd)))
    config = nda.load_config(fd)
    print(yaml.dump(config, default_style=''))
    pn_st = []
    pn_id = []
    for pn in fd[nda.pn_st_path].values():
        pn_st.append(pn.value)
        pn_id.append([int(pn.name.rpartition('_')[-1])] * len(pn))
    ax0.plot(np.concatenate(pn_st[::10]),
             np.concatenate(pn_id[::10]),
             marker='s',
             ms=1,
             color='#fdb863',
             ls='none')
    kc_x, kc_y = nda.get_event_times(fd[nda.kc_st_path])
    ax1.plot(np.concatenate(kc_x[::10]),