buh
This commit is contained in:
parent
ca4185a64a
commit
90388959c4
@ -47,7 +47,7 @@ def plot_chirp(eodf, eodf1, phase, axis):
|
|||||||
|
|
||||||
y = chirp_eod * 0.4 + eod
|
y = chirp_eod * 0.4 + eod
|
||||||
p, t = pd.detect_peaks(y, 0.1)
|
p, t = pd.detect_peaks(y, 0.1)
|
||||||
axis.plot(time*1000, y, color = 'royalblue')
|
axis.plot(time*1000, y, color = 'darkblue')
|
||||||
axis.plot(time[p]*1000, (y)[p], lw=2, color='k')
|
axis.plot(time[p]*1000, (y)[p], lw=2, color='k')
|
||||||
axis.plot(time[t]*1000, (y)[t], lw=2, color='k')
|
axis.plot(time[t]*1000, (y)[t], lw=2, color='k')
|
||||||
axis.spines["top"].set_visible(False)
|
axis.spines["top"].set_visible(False)
|
||||||
@ -93,4 +93,4 @@ ax4.set_yticklabels([])
|
|||||||
|
|
||||||
fig.tight_layout()
|
fig.tight_layout()
|
||||||
#plt.show()
|
#plt.show()
|
||||||
plt.savefig('chirps_while_beat.png')
|
plt.savefig('chirps_while_beat.pdf')
|
||||||
|
@ -25,7 +25,7 @@ time_axis = np.arange(len(ampl))
|
|||||||
|
|
||||||
|
|
||||||
fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor))
|
fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor))
|
||||||
plt.plot(time[10000:20000]*1000, ampl, color='royalblue')
|
plt.plot(time[10000:20000]*1000, ampl, color='darkblue')
|
||||||
plt.plot(time[10000:20000][p]*1000, ampl[p], lw=2, color='k')
|
plt.plot(time[10000:20000][p]*1000, ampl[p], lw=2, color='k')
|
||||||
plt.plot(time[10000:20000][t]*1000, ampl[t], lw=2, color='k')
|
plt.plot(time[10000:20000][t]*1000, ampl[t], lw=2, color='k')
|
||||||
ax.set_xlabel("Time [ms]", fontsize = 22)
|
ax.set_xlabel("Time [ms]", fontsize = 22)
|
||||||
@ -37,7 +37,7 @@ ax.spines["right"].set_visible(False)
|
|||||||
fig.tight_layout()
|
fig.tight_layout()
|
||||||
|
|
||||||
#plt.show()
|
#plt.show()
|
||||||
plt.savefig('beat.png')
|
plt.savefig('beat.pdf')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ spikes = read_baseline_spikes(os.path.join(data_dir, dataset)) #spikes in s
|
|||||||
interspikeintervals = np.diff(spikes)/eod_duration
|
interspikeintervals = np.diff(spikes)/eod_duration
|
||||||
|
|
||||||
fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor))
|
fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor))
|
||||||
plt.hist(interspikeintervals, bins=np.arange(0, np.max(interspikeintervals), 0.1), color='royalblue')
|
plt.hist(interspikeintervals, bins=np.arange(0, np.max(interspikeintervals), 0.1), color='darkblue')
|
||||||
plt.xlabel("EOD cycles", fontsize = 22)
|
plt.xlabel("EOD cycles", fontsize = 22)
|
||||||
plt.xticks(fontsize = 18)
|
plt.xticks(fontsize = 18)
|
||||||
plt.ylabel("Number of \n interspikeintervals", fontsize = 22)
|
plt.ylabel("Number of \n interspikeintervals", fontsize = 22)
|
||||||
@ -44,8 +44,8 @@ ax.spines["top"].set_visible(False)
|
|||||||
ax.spines["right"].set_visible(False)
|
ax.spines["right"].set_visible(False)
|
||||||
fig.tight_layout()
|
fig.tight_layout()
|
||||||
#plt.show()
|
#plt.show()
|
||||||
#plt.savefig('isis.pdf')
|
plt.savefig('isis.pdf')
|
||||||
plt.savefig('isis.png')
|
#plt.savefig('isis.png')
|
||||||
|
|
||||||
|
|
||||||
# calculate coefficient of variation
|
# calculate coefficient of variation
|
||||||
@ -98,13 +98,13 @@ plt.yticks(fontsize=18)
|
|||||||
ax1.spines['top'].set_visible(False)
|
ax1.spines['top'].set_visible(False)
|
||||||
|
|
||||||
ax2 = ax1.twinx()
|
ax2 = ax1.twinx()
|
||||||
ax2.fill_between(time_axis, mu_eod+std_eod, mu_eod-std_eod, color='royalblue', alpha=0.5)
|
ax2.fill_between(time_axis, mu_eod+std_eod, mu_eod-std_eod, color='darkblue', alpha=0.5)
|
||||||
ax2.plot(time_axis, mu_eod, color='black', lw=2)
|
ax2.plot(time_axis, mu_eod, color='black', lw=2)
|
||||||
ax2.set_ylabel('Voltage [mV]', fontsize=22)
|
ax2.set_ylabel('Voltage [mV]', fontsize=22)
|
||||||
ax2.tick_params(axis='y', labelcolor='royalblue')
|
ax2.tick_params(axis='y', labelcolor='darkblue')
|
||||||
ax2.spines['top'].set_visible(False)
|
ax2.spines['top'].set_visible(False)
|
||||||
|
|
||||||
plt.yticks(fontsize=18)
|
plt.yticks(fontsize=18)
|
||||||
fig.tight_layout()
|
fig.tight_layout()
|
||||||
#plt.show()
|
#plt.show()
|
||||||
plt.savefig('eodform_spikehist.png')
|
plt.savefig('eodform_spikehist.pdf')
|
@ -8,7 +8,8 @@ from IPython import embed
|
|||||||
# define sampling rate and data path
|
# define sampling rate and data path
|
||||||
sampling_rate = 40 #kHz
|
sampling_rate = 40 #kHz
|
||||||
data_dir = "../data"
|
data_dir = "../data"
|
||||||
dataset = "2018-11-14-al-invivo-1"
|
#dataset = "2018-11-14-al-invivo-1"
|
||||||
|
dataset = "2018-11-09-ad-invivo-1"
|
||||||
inch_factor = 2.54
|
inch_factor = 2.54
|
||||||
# parameters for binning, smoothing and plotting
|
# parameters for binning, smoothing and plotting
|
||||||
cut_window = 60
|
cut_window = 60
|
||||||
@ -85,7 +86,7 @@ for df in df_phase_time.keys():
|
|||||||
for i, trial in enumerate(plot_trials):
|
for i, trial in enumerate(plot_trials):
|
||||||
ax[0].scatter(trial, np.ones(len(trial))+i, marker='|', color='k')
|
ax[0].scatter(trial, np.ones(len(trial))+i, marker='|', color='k')
|
||||||
|
|
||||||
ax[1].plot(time_axis[0+5*sampling_rate:-5*sampling_rate], smoothed_spikes[0+5*sampling_rate:-5*sampling_rate]*1000, color='royalblue', lw = 2)
|
ax[1].plot(time_axis[0+5*sampling_rate:-5*sampling_rate], smoothed_spikes[0+5*sampling_rate:-5*sampling_rate]*1000, color='darkblue', lw = 2)
|
||||||
|
|
||||||
ax[0].set_title('$\Delta$f = %s Hz' %(df), fontsize = 18)
|
ax[0].set_title('$\Delta$f = %s Hz' %(df), fontsize = 18)
|
||||||
ax[0].set_ylabel('Repetition', fontsize=22)
|
ax[0].set_ylabel('Repetition', fontsize=22)
|
||||||
@ -101,5 +102,5 @@ for df in df_phase_time.keys():
|
|||||||
fig.tight_layout()
|
fig.tight_layout()
|
||||||
#plt.show()
|
#plt.show()
|
||||||
#exit()
|
#exit()
|
||||||
namefigure = '../figures/%s_%i_%i_firingrate.png' %(dataset, df, index_phase)
|
namefigure = '../figures/%s_%i_%i_firingrate.pdf' %(dataset, df, index_phase)
|
||||||
plt.savefig(namefigure)
|
plt.savefig(namefigure)
|
||||||
|
@ -40,8 +40,8 @@ ax1 = fig.add_subplot(211)
|
|||||||
plt.yticks(fontsize=18)
|
plt.yticks(fontsize=18)
|
||||||
ax2 = fig.add_subplot(212, sharex=ax1)
|
ax2 = fig.add_subplot(212, sharex=ax1)
|
||||||
plt.setp(ax1.get_xticklabels(), visible=False)
|
plt.setp(ax1.get_xticklabels(), visible=False)
|
||||||
ax1.plot(time*1000, signal, color = 'royalblue', lw = 1)
|
ax1.plot(time*1000, signal, color = 'darkblue', lw = 1)
|
||||||
ax2.plot(time*1000, freq, color = 'royalblue', lw = 3)
|
ax2.plot(time*1000, freq, color = 'darkblue', lw = 3)
|
||||||
|
|
||||||
ax1.set_ylabel("Field [mV]", fontsize = 22)
|
ax1.set_ylabel("Field [mV]", fontsize = 22)
|
||||||
|
|
||||||
@ -58,4 +58,4 @@ ax2.spines["top"].set_visible(False)
|
|||||||
ax2.spines["right"].set_visible(False)
|
ax2.spines["right"].set_visible(False)
|
||||||
fig.tight_layout()
|
fig.tight_layout()
|
||||||
#plt.show()
|
#plt.show()
|
||||||
plt.savefig('stimulus_chirp.png')
|
plt.savefig('stimulus_chirp.pdf')
|
||||||
|
Loading…
Reference in New Issue
Block a user