added firing rate to regimes
This commit is contained in:
15
twobeats.py
15
twobeats.py
@@ -12,6 +12,8 @@ cell = '2021-08-03-ac-invivo-1'
|
||||
|
||||
data_path = Path('data')
|
||||
|
||||
sigma = 0.002
|
||||
|
||||
|
||||
def load_spikes(cell_path, f1=797, f2=631):
|
||||
load = False
|
||||
@@ -205,14 +207,15 @@ def plot_stimulus(ax, s, tmax, eodf, freqs, c=0.1):
|
||||
ams = {}
|
||||
f1, f2 = freqs
|
||||
label = '$f_{EOD}$'
|
||||
dp = np.pi
|
||||
if f1 is not None:
|
||||
eod += c*np.cos(2*np.pi*(eodf + f1)*time)
|
||||
am += c*np.cos(2*np.pi*f1*time)
|
||||
eod += c*np.cos(2*np.pi*(eodf + f1)*time + dp)
|
||||
am += c*np.cos(2*np.pi*f1*time + dp)
|
||||
ams = s.lsF02
|
||||
label += r' \& $f_1$'
|
||||
if f2 is not None:
|
||||
eod += c*np.cos(2*np.pi*(eodf + f2)*time)
|
||||
am += c*np.cos(2*np.pi*f2*time)
|
||||
eod += c*np.cos(2*np.pi*(eodf + f2)*time + dp)
|
||||
am += c*np.cos(2*np.pi*f2*time + dp)
|
||||
ams = s.lsF01
|
||||
label += r' \& $f_2$'
|
||||
if f1 is not None and f2 is not None:
|
||||
@@ -234,7 +237,7 @@ def plot_raster(ax, s, spikes, tmin, tmax):
|
||||
|
||||
|
||||
def plot_rate(ax, s, spikes, tmin, tmax, sigma=0.002):
|
||||
time = np.arange(0, tmin + tmax, 0.001)
|
||||
time = np.arange(0, tmin + tmax, sigma/4)
|
||||
r, rsd = rate(time, spikes, sigma)
|
||||
mask = (time >= tmin) & (time <= tmax)
|
||||
time = time[mask] - tmin
|
||||
@@ -311,7 +314,7 @@ if __name__ == '__main__':
|
||||
plot_psd(axs[4, i], s, freqs, power, fmax)
|
||||
sub_spikes = align_spikes(sub_spikes, stim_freqs[i], stim_phases[i])
|
||||
plot_raster(axs[2, i], s, sub_spikes, tmin, tmax)
|
||||
plot_rate(axs[3, i], s, sub_spikes, tmin, tmax)
|
||||
plot_rate(axs[3, i], s, sub_spikes, tmin, tmax, sigma)
|
||||
mark_freq(axs[4, 0], freqs, powers[0], base_rate, f'$r={base_rate:.0f}$\\,Hz', s.psF0, 30)
|
||||
mark_freq(axs[4, 1], freqs, powers[1], df2, f'$\\Delta f_1=f_1 - f_{{EOD}}={abs(df2):.0f}$\\,Hz', s.psF02)
|
||||
mark_freq(axs[4, 1], freqs, powers[1], 2*df2, f'$2\\Delta f_1={abs(2*df2):.0f}$\\,Hz', s.psF02)
|
||||
|
||||
Reference in New Issue
Block a user