In [1]:
import os
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import pickle
from Experiment import Experiment
from LIF import LIF
from Filter_Rect_LogSpaced import Filter_Rect_LogSpaced
import bluebrain_data_io as bbp_io
plt.style.use('ggplot')
mpl.rcParams['font.size'] = 12
mpl.rcParams['axes.facecolor'] = 'white'
In [9]:
vip_expms = bbp_io.get_vip_expms(merged=True, verbose=False)
In [10]:
len(vip_expms)
Out[10]:
In [11]:
'''
for expm in expms:
tr = expm.trainingset_traces[0]
plt.figure(figsize=(12,12))
for i in range(tr.getSpikeNb()):
plt.plot(tr.spike_waveforms[i,:], label='V')
spike_diff = np.diff(tr.spike_waveforms[i,:])
plt.plot(tr.relative_threshold_times[i], tr.threshold_values[i],'*r')
plt.plot(tr.relative_peak_times[i], tr.spike_waveforms[i,tr.relative_peak_times[i]], 'ob')
plt.title(expm.name)
plt.show()
'''
Out[11]:
In [12]:
lifs = []
for expm in vip_expms:
# Create a new object GIF
myLIF = LIF(expm.dt)
# Define parameters
myLIF.Tref = 5.0
# detect Spikes
expm.detectSpikes_cython(verbose=False)
# Perform the fit
myLIF.fit(expm, DT_beforeSpike=5.0)
lifs.append(myLIF)
In [13]:
plt.figure()
for a in lifs:
if a.fitted:
plt.plot(a.avg_spike_shape_support, a.avg_spike_shape, 'black')
Tref_ind = np.where(a.avg_spike_shape_support >= a.Tref)[0][0]
plt.plot([a.avg_spike_shape_support[Tref_ind]], [a.Vr], '.', color='red')
plt.show()
In [14]:
params_dict = {}
params_dict['tau (ms)'] = np.array([lif.C/lif.gl for lif in lifs])
params_dict['R (MOhm)'] = np.array([1/lif.gl for lif in lifs])
params_dict['C (nF)'] = np.array([lif.C for lif in lifs])
params_dict['El (mV)'] = np.array([lif.El for lif in lifs])
params_dict['Vr (mV)'] = np.array([lif.Vr for lif in lifs])
params_dict['Vt (mV)'] = np.array([lif.Vt for lif in lifs])
import pandas as pd
df = pd.DataFrame(params_dict)
In [15]:
df.describe(percentiles=[])
Out[15]:
In [17]:
df
Out[17]:
In [ ]: