227 lines
15 KiB
Python
227 lines
15 KiB
Python
import h5py
|
|
import numpy as np
|
|
import os
|
|
import pandas as pd
|
|
|
|
|
|
spiking = pd.DataFrame(columns=['t', 'RS Pyramidal','RS Inhibitory','FS','IB',
|
|
'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'IB +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'Cb stellate','Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$','STN','STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'])
|
|
values = pd.DataFrame(index = ['spike_ind', 'ramp_up','ramp_down'], columns=['RS Pyramidal','RS Inhibitory','FS','IB',
|
|
'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'IB +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$','Cb stellate','Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$','STN','STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'])
|
|
F = pd.DataFrame(columns=['I','I_inhib', 'RS Pyramidal','RS Inhibitory','FS','IB',
|
|
'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'IB +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$','Cb stellate','Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$','STN','STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'])
|
|
|
|
|
|
# RS Pyramidal #########################################################################################################
|
|
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
fname = os.path.join(script_dir, '../Neuron_models/RS_pyramidal.hdf5')
|
|
f = h5py.File(fname, "r")
|
|
I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'], (f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num'])*1000
|
|
start = np.int(f['data'].attrs['initial_period']*1/f['data'].attrs['dt'])
|
|
stim_len = np.int((f['data'].attrs['stim_time'] - start) *f['data'].attrs['dt'])
|
|
time = np.arange(0, stim_len,f['data'].attrs['dt'])
|
|
ind = 60
|
|
spiking['RS Pyramidal'] = f['data']['V_m'][ind][start:]
|
|
spiking['t'] = time
|
|
F['I'] = I_mag
|
|
F['RS Pyramidal'] = f['analysis']['F_inf'][:]
|
|
values.loc['spike_ind', 'RS Pyramidal'] = I_mag[ind]
|
|
values.loc['ramp_up', 'RS Pyramidal'] = f['analysis']['ramp_I_up'][()]
|
|
values.loc['ramp_down', 'RS Pyramidal'] = f['analysis']['ramp_I_down'][()]
|
|
|
|
# RS Inhibitory #########################################################################################################
|
|
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
fname = os.path.join(script_dir, '../Neuron_models/RS_inhib.hdf5')
|
|
f = h5py.File(fname, "r")
|
|
I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'], (f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num'])*1000
|
|
start = np.int(f['data'].attrs['initial_period']*1/f['data'].attrs['dt'])
|
|
stim_len = np.int((f['data'].attrs['stim_time'] - start) *f['data'].attrs['dt'])
|
|
time = np.arange(0, stim_len,f['data'].attrs['dt'])
|
|
ind = 25
|
|
spiking['RS Inhibitory'] = f['data']['V_m'][ind][start:]
|
|
F['I_inhib'] = I_mag
|
|
F['RS Inhibitory'] = f['analysis']['F_inf'][:]
|
|
values.loc['spike_ind', 'RS Inhibitory'] = I_mag[ind]
|
|
values.loc['ramp_up', 'RS Inhibitory'] = f['analysis']['ramp_I_up'][()]
|
|
values.loc['ramp_down', 'RS Inhibitory'] = f['analysis']['ramp_I_down'][()]
|
|
|
|
|
|
# FS#####################################################################################################################
|
|
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
fname = os.path.join(script_dir, '../Neuron_models/FS.hdf5')
|
|
f = h5py.File(fname, "r")
|
|
I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'], (f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num'])*1000
|
|
start = np.int(f['data'].attrs['initial_period']*1/f['data'].attrs['dt'])
|
|
stim_len = np.int((f['data'].attrs['stim_time'] - start) *f['data'].attrs['dt'])
|
|
time = np.arange(0, stim_len,f['data'].attrs['dt'])
|
|
ind = 50
|
|
spiking['FS'] = f['data']['V_m'][ind][start:]
|
|
F['FS'] = f['analysis']['F_inf'][:]
|
|
values.loc['spike_ind', 'FS'] = I_mag[ind]
|
|
values.loc['ramp_up', 'FS'] = f['analysis']['ramp_I_up'][()]
|
|
values.loc['ramp_down', 'FS'] = f['analysis']['ramp_I_down'][()]
|
|
|
|
# RS Pyramidal Kv #########################################################################################################
|
|
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
fname = os.path.join(script_dir, '../Neuron_models/RS_pyramidal_Kv.hdf5')
|
|
f = h5py.File(fname, "r")
|
|
I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'], (f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num'])*1000
|
|
start = np.int(f['data'].attrs['initial_period']*1/f['data'].attrs['dt'])
|
|
stim_len = np.int((f['data'].attrs['stim_time'] - start) *f['data'].attrs['dt'])
|
|
time = np.arange(0, stim_len,f['data'].attrs['dt'])
|
|
ind = 60
|
|
spiking['RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['data']['V_m'][ind][start:]
|
|
spiking['t'] = time
|
|
F['I'] = I_mag
|
|
F['RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['F_inf'][:]
|
|
values.loc['spike_ind', 'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = I_mag[ind]
|
|
values.loc['ramp_up', 'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_up'][()]
|
|
values.loc['ramp_down', 'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_down'][()]
|
|
|
|
# RS Inhibitory #########################################################################################################
|
|
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
fname = os.path.join(script_dir, '../Neuron_models/RS_inhib_Kv.hdf5')
|
|
f = h5py.File(fname, "r")
|
|
I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'], (f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num'])*1000
|
|
start = np.int(f['data'].attrs['initial_period']*1/f['data'].attrs['dt'])
|
|
stim_len = np.int((f['data'].attrs['stim_time'] - start) *f['data'].attrs['dt'])
|
|
time = np.arange(0, stim_len,f['data'].attrs['dt'])
|
|
ind = 50
|
|
spiking['RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['data']['V_m'][ind][start:]
|
|
F['I_inhib'] = I_mag
|
|
F['RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['F_inf'][:]
|
|
values.loc['spike_ind', 'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = I_mag[ind]
|
|
values.loc['ramp_up', 'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_up'][()]
|
|
values.loc['ramp_down', 'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_down'][()]
|
|
|
|
|
|
# FS#####################################################################################################################
|
|
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
fname = os.path.join(script_dir, '../Neuron_models/FS_Kv.hdf5')
|
|
f = h5py.File(fname, "r")
|
|
I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'], (f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num'])*1000
|
|
start = np.int(f['data'].attrs['initial_period']*1/f['data'].attrs['dt'])
|
|
stim_len = np.int((f['data'].attrs['stim_time'] - start) *f['data'].attrs['dt'])
|
|
time = np.arange(0, stim_len,f['data'].attrs['dt'])
|
|
ind = 50
|
|
spiking['FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['data']['V_m'][ind][start:]
|
|
F['FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['F_inf'][:]
|
|
values.loc['spike_ind', 'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = I_mag[ind]
|
|
values.loc['ramp_up', 'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_up'][()]
|
|
values.loc['ramp_down', 'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_down'][()]
|
|
|
|
# Cb Stellate cell ######################################################################################################
|
|
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
fname = os.path.join(script_dir, '../Neuron_models/Cb_stellate.hdf5')
|
|
f = h5py.File(fname, "r")
|
|
I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'], (f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num'])*1000
|
|
start = np.int(f['data'].attrs['initial_period']*1/f['data'].attrs['dt'])
|
|
stim_len = np.int((f['data'].attrs['stim_time'] - start) *f['data'].attrs['dt'])
|
|
time = np.arange(0, stim_len,f['data'].attrs['dt'])
|
|
ind = 60
|
|
spiking['Cb stellate'] = f['data']['V_m'][ind][start:]
|
|
F['Cb stellate'] = f['analysis']['F_inf'][:]
|
|
values.loc['spike_ind', 'Cb stellate'] = I_mag[ind]
|
|
values.loc['ramp_up', 'Cb stellate'] = f['analysis']['ramp_I_up'][()]
|
|
values.loc['ramp_down', 'Cb stellate'] = f['analysis']['ramp_I_down'][()]
|
|
|
|
|
|
# 'Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
|
|
# Cb stellate Kv #############################################################################################
|
|
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
fname = os.path.join(script_dir, '../Neuron_models/Cb_stellate_Kv.hdf5')
|
|
f = h5py.File(fname, "r")
|
|
I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'], (f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num'])*1000
|
|
start = np.int(f['data'].attrs['initial_period']*1/f['data'].attrs['dt'])
|
|
stim_len = np.int((f['data'].attrs['stim_time'] - start) *f['data'].attrs['dt'])
|
|
time = np.arange(0, stim_len,f['data'].attrs['dt'])
|
|
ind = 130
|
|
spiking['Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['data']['V_m'][ind][start:]
|
|
F['Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['F_inf'][:]
|
|
values.loc['spike_ind', 'Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = I_mag[ind]
|
|
values.loc['ramp_up', 'Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_up'][()]
|
|
values.loc['ramp_down', 'Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_down'][()]
|
|
|
|
# 'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
|
|
# Cb stellate Kv only ####################################################################################
|
|
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
fname = os.path.join(script_dir, '../Neuron_models/Cb_stellate_Delta_Kv.hdf5.hdf5')
|
|
f = h5py.File(fname, "r")
|
|
I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'], (f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num'])*1000
|
|
start = np.int(f['data'].attrs['initial_period']*1/f['data'].attrs['dt'])
|
|
stim_len = np.int((f['data'].attrs['stim_time'] - start) *f['data'].attrs['dt'])
|
|
time = np.arange(0, stim_len,f['data'].attrs['dt'])
|
|
ind = 75
|
|
spiking['Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['data']['V_m'][ind][start:]
|
|
F['Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['F_inf'][:]
|
|
values.loc['spike_ind', 'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = I_mag[ind]
|
|
values.loc['ramp_up', 'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_up'][()]
|
|
values.loc['ramp_down', 'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_down'][()]
|
|
|
|
# STN ###################################################################################################################
|
|
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
fname = os.path.join(script_dir, '../Neuron_models/STN.hdf5')
|
|
f = h5py.File(fname, "r")
|
|
I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'], (f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num'])*1000
|
|
start = np.int(f['data'].attrs['initial_period']*1/f['data'].attrs['dt'])
|
|
stim_len = np.int((f['data'].attrs['stim_time'] - start) *f['data'].attrs['dt'])
|
|
time = np.arange(0, stim_len,f['data'].attrs['dt'])
|
|
ind = 25
|
|
spiking['STN'] = f['data']['V_m'][ind][start:]
|
|
F['STN'] = f['analysis']['F_inf'][:]
|
|
values.loc['spike_ind', 'STN'] = I_mag[ind]
|
|
values.loc['ramp_up', 'STN'] = f['analysis']['ramp_I_up'][()]
|
|
values.loc['ramp_down', 'STN'] = f['analysis']['ramp_I_down'][()]
|
|
|
|
# 'STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
# STN Kv ##################################################################################################
|
|
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
fname = os.path.join(script_dir, '../Neuron_models/STN_Kv.hdf5')
|
|
f = h5py.File(fname, "r")
|
|
I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'], (f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num'])*1000
|
|
start = np.int(f['data'].attrs['initial_period']*1/f['data'].attrs['dt'])
|
|
stim_len = np.int((f['data'].attrs['stim_time'] - start) *f['data'].attrs['dt'])
|
|
time = np.arange(0, stim_len,f['data'].attrs['dt'])
|
|
ind = 95
|
|
spiking['STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['data']['V_m'][ind][start:]
|
|
F['STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['F_inf'][:]
|
|
values.loc['spike_ind', 'STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = I_mag[ind]
|
|
values.loc['ramp_up', 'STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_up'][()]
|
|
values.loc['ramp_down', 'STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_down'][()]
|
|
|
|
# 'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
|
|
# STN Kv only #############################################################################################3
|
|
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
fname = os.path.join(script_dir, '../Neuron_models/STN_Delta_Kv.hdf5')
|
|
f = h5py.File(fname, "r")
|
|
I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'], (f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num'])*1000
|
|
start = np.int(f['data'].attrs['initial_period']*1/f['data'].attrs['dt'])
|
|
stim_len = np.int((f['data'].attrs['stim_time'] - start) *f['data'].attrs['dt'])
|
|
time = np.arange(0, stim_len,f['data'].attrs['dt'])
|
|
ind = 80
|
|
spiking['STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['data']['V_m'][ind][start:]
|
|
F['STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['F_inf'][:]
|
|
values.loc['spike_ind', 'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = I_mag[ind]
|
|
values.loc['ramp_up', 'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_up'][()]
|
|
values.loc['ramp_down', 'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_down'][()]
|
|
|
|
#%%
|
|
spiking.to_csv('model_spiking.csv')
|
|
values.to_csv('firing_values.csv')
|
|
F.to_csv('model_F_inf.csv') |