[examples] added isish for all cells
This commit is contained in:
parent
7a451a82fa
commit
aeb840a4e7
@ -33,6 +33,18 @@ def plot_isih(ax, s, rate, cv, isis, pdf):
|
|||||||
transform=ax.transAxes)
|
transform=ax.transAxes)
|
||||||
|
|
||||||
|
|
||||||
|
def plot_isih2(ax, s, rate, cv, isis, pdf):
|
||||||
|
ax.show_spines('b')
|
||||||
|
ax.fill_between(1000*isis, pdf, facecolor=s.cell_color1)
|
||||||
|
ax.set_xlim(0, 20)
|
||||||
|
ax.set_xticks_delta(5)
|
||||||
|
ax.set_xticks_blank()
|
||||||
|
#ax.set_xlabel('ISI', 'ms')
|
||||||
|
ax.text(1, 1.1, f'CV$_{{\\rm base}}$={cv:.2f}', ha='right',
|
||||||
|
transform=ax.transAxes)
|
||||||
|
ax.text(1, 0.6, f'$r={rate:.0f}$Hz', ha='right', transform=ax.transAxes)
|
||||||
|
|
||||||
|
|
||||||
def plot_response_spectrum(ax, s, eodf, rate, freqs, prr):
|
def plot_response_spectrum(ax, s, eodf, rate, freqs, prr):
|
||||||
rate_i = np.argmax(prr[freqs < 0.7*eodf])
|
rate_i = np.argmax(prr[freqs < 0.7*eodf])
|
||||||
eod_i = np.argmax(prr[freqs > 500]) + np.argmax(freqs > 500)
|
eod_i = np.argmax(prr[freqs > 500]) + np.argmax(freqs > 500)
|
||||||
@ -170,15 +182,16 @@ if __name__ == '__main__':
|
|||||||
s.lsC2 = s.lsA2
|
s.lsC2 = s.lsA2
|
||||||
s.psC1 = s.psA1
|
s.psC1 = s.psA1
|
||||||
s.psC2 = s.psA2
|
s.psC2 = s.psA2
|
||||||
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, height_ratios=[3, 0, 3, 0.5, 3],
|
fig, (ax1, ax2, ax3) = \
|
||||||
cmsize=(s.plot_width, 0.8*s.plot_width))
|
plt.subplots(3, 1, height_ratios=[3, 0, 3, 0.2, 4.5],
|
||||||
|
cmsize=(s.plot_width, 0.85*s.plot_width))
|
||||||
fig.subplots_adjust(leftm=8, rightm=9, topm=2, bottomm=4,
|
fig.subplots_adjust(leftm=8, rightm=9, topm=2, bottomm=4,
|
||||||
wspace=0.4, hspace=0.5)
|
wspace=0.4, hspace=0.4)
|
||||||
axi, axp, axr = ax1.subplots(1, 3, width_ratios=[2, 3, 0, 10])
|
axi, axp, axr = ax1.subplots(1, 3, width_ratios=[2, 3, 0, 10])
|
||||||
axg, axc1, axc2, axd = ax2.subplots(1, 4, wspace=0.4)
|
axg, axc1, axc2, axd = ax2.subplots(1, 4, wspace=0.4)
|
||||||
axg = axg.subplots(1, 1, width_ratios=[1, 0.1])
|
axg = axg.subplots(1, 1, width_ratios=[1, 0.1])
|
||||||
axd = axd.subplots(1, 1, width_ratios=[0.2, 1])
|
axd = axd.subplots(1, 1, width_ratios=[0.2, 1])
|
||||||
axs = ax3.subplots(1, 4, wspace=0.4)
|
axs = ax3.subplots(2, 4, wspace=0.4, hspace=0.2, height_ratios=[1, 4])
|
||||||
|
|
||||||
plot_isih(axi, s, rate, cv, isis, pdf)
|
plot_isih(axi, s, rate, cv, isis, pdf)
|
||||||
plot_response_spectrum(axp, s, eodf, rate, freqs, prr)
|
plot_response_spectrum(axp, s, eodf, rate, freqs, prr)
|
||||||
@ -205,19 +218,25 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
print('Additional example cells:')
|
print('Additional example cells:')
|
||||||
for k, (cell, run) in enumerate(example_cells):
|
for k, (cell, run) in enumerate(example_cells):
|
||||||
eodf, rate, cv, _, _, _, _ = load_baseline(data_path, cell)
|
eodf, rate, cv, isis, pdf, _, _ = load_baseline(data_path, cell)
|
||||||
fcutoff, contrast, freqs, gain, chi2 = load_spectra(data_path, cell, run)
|
fcutoff, contrast, freqs, gain, chi2 = load_spectra(data_path, cell, run)
|
||||||
dfreqs, diag = diag_projection(freqs, chi2, 2*fcutoff)
|
dfreqs, diag = diag_projection(freqs, chi2, 2*fcutoff)
|
||||||
nli, nlif = peakedness(dfreqs, diag, rate, median=False)
|
nli, nlif = peakedness(dfreqs, diag, rate, median=False)
|
||||||
print(f' {cell:<22s}: run={run:2d}, fbase={rate:3.0f}Hz, CV={cv:.2f}, SI={nli:3.1f}')
|
print(f' {cell:<22s}: run={run:2d}, fbase={rate:3.0f}Hz, CV={cv:.2f}, SI={nli:3.1f}')
|
||||||
pc = plot_chi2(axs[k], s, contrast, freqs, chi2, fcutoff, 1.2)
|
plot_isih2(axs[0, k], s, rate, cv, isis, pdf)
|
||||||
axs[k].set_title(f'$r={rate:.0f}$Hz, CV$_{{\\rm base}}$={cv:.2f}', fontsize='medium')
|
pc = plot_chi2(axs[1, k], s, contrast, freqs, chi2, fcutoff, 1.2)
|
||||||
axs[k].text(0.95, 0.9, f'SI($r$)={nli:.1f}', ha='right', zorder=50,
|
#axs[k].set_title(f'$r={rate:.0f}$Hz, CV$_{{\\rm base}}$={cv:.2f}', fontsize='medium')
|
||||||
color='white', fontsize='medium',
|
axs[1, k].text(0.95, 0.9, f'SI($r$)={nli:.1f}', ha='right', zorder=50,
|
||||||
transform=axs[k].transAxes)
|
color='white', fontsize='medium',
|
||||||
plot_colorbar(axs[-1], pc, 0.4)
|
transform=axs[1, k].transAxes)
|
||||||
fig.common_yticks(axs)
|
axs[0, 0].text(0, 1.6, 'Ampullary cells:', transform=axs[0, 0].transAxes,
|
||||||
fig.tag(axs, xoffs=-3, yoffs=2)
|
color=s.cell_color1,
|
||||||
|
fontsize='large')
|
||||||
|
axs[0, -1].text(1, 0, '5\\,ms', ha='right',
|
||||||
|
transform=axs[0, -1].transAxes)
|
||||||
|
plot_colorbar(axs[1, -1], pc, 0.4)
|
||||||
|
fig.common_yticks(axs[1, :])
|
||||||
|
fig.tag([axs[0, :]], xoffs=-3, yoffs=1)
|
||||||
|
|
||||||
fig.savefig()
|
fig.savefig()
|
||||||
print()
|
print()
|
||||||
|
@ -91,6 +91,18 @@ def plot_isih(ax, s, rate, cv, isis, pdf):
|
|||||||
transform=ax.transAxes)
|
transform=ax.transAxes)
|
||||||
|
|
||||||
|
|
||||||
|
def plot_isih2(ax, s, rate, cv, isis, pdf):
|
||||||
|
ax.show_spines('b')
|
||||||
|
ax.fill_between(1000*isis, pdf, facecolor=s.cell_color1)
|
||||||
|
ax.set_xlim(0, 20)
|
||||||
|
ax.set_xticks_delta(5)
|
||||||
|
ax.set_xticks_blank()
|
||||||
|
#ax.set_xlabel('ISI', 'ms')
|
||||||
|
ax.text(1, 1.1, f'CV$_{{\\rm base}}$={cv:.2f}', ha='right',
|
||||||
|
transform=ax.transAxes)
|
||||||
|
ax.text(1, 0.6, f'$r={rate:.0f}$Hz', ha='right', transform=ax.transAxes)
|
||||||
|
|
||||||
|
|
||||||
def plot_response_spectrum(ax, s, eodf, rate, freqs, prr):
|
def plot_response_spectrum(ax, s, eodf, rate, freqs, prr):
|
||||||
rate_i = np.argmax(prr[freqs < 0.7*eodf])
|
rate_i = np.argmax(prr[freqs < 0.7*eodf])
|
||||||
eod_i = np.argmax(prr[freqs > 500]) + np.argmax(freqs > 500)
|
eod_i = np.argmax(prr[freqs > 500]) + np.argmax(freqs > 500)
|
||||||
@ -222,15 +234,16 @@ if __name__ == '__main__':
|
|||||||
s.lsC2 = s.lsP2
|
s.lsC2 = s.lsP2
|
||||||
s.psC1 = s.psP1
|
s.psC1 = s.psP1
|
||||||
s.psC2 = s.psP2
|
s.psC2 = s.psP2
|
||||||
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, height_ratios=[3, 0, 3, 0.5, 3],
|
fig, (ax1, ax2, ax3) = \
|
||||||
cmsize=(s.plot_width, 0.8*s.plot_width))
|
plt.subplots(3, 1, height_ratios=[3, 0, 3, 0.2, 4.5],
|
||||||
|
cmsize=(s.plot_width, 0.85*s.plot_width))
|
||||||
fig.subplots_adjust(leftm=8, rightm=9, topm=2, bottomm=4,
|
fig.subplots_adjust(leftm=8, rightm=9, topm=2, bottomm=4,
|
||||||
wspace=0.4, hspace=0.5)
|
wspace=0.4, hspace=0.4)
|
||||||
axi, axp, axr = ax1.subplots(1, 3, width_ratios=[2, 3, 0, 10])
|
axi, axp, axr = ax1.subplots(1, 3, width_ratios=[2, 3, 0, 10])
|
||||||
axg, axc1, axc2, axd = ax2.subplots(1, 4, wspace=0.4)
|
axg, axc1, axc2, axd = ax2.subplots(1, 4, wspace=0.4)
|
||||||
axg = axg.subplots(1, 1, width_ratios=[1, 0.1])
|
axg = axg.subplots(1, 1, width_ratios=[1, 0.1])
|
||||||
axd = axd.subplots(1, 1, width_ratios=[0.2, 1])
|
axd = axd.subplots(1, 1, width_ratios=[0.2, 1])
|
||||||
axs = ax3.subplots(1, 4, wspace=0.4)
|
axs = ax3.subplots(2, 4, wspace=0.4, hspace=0.2, height_ratios=[1, 4])
|
||||||
|
|
||||||
plot_isih(axi, s, rate, cv, isis, pdf)
|
plot_isih(axi, s, rate, cv, isis, pdf)
|
||||||
plot_response_spectrum(axp, s, eodf, rate, freqs, prr)
|
plot_response_spectrum(axp, s, eodf, rate, freqs, prr)
|
||||||
@ -257,19 +270,25 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
print('Additional example cells:')
|
print('Additional example cells:')
|
||||||
for k, (cell, run) in enumerate(example_cells):
|
for k, (cell, run) in enumerate(example_cells):
|
||||||
eodf, rate, cv, _, _, _, _ = load_baseline(data_path, cell)
|
eodf, rate, cv, isis, pdf, _, _ = load_baseline(data_path, cell)
|
||||||
fcutoff, contrast, freqs, gain, chi2 = load_spectra(data_path, cell, run)
|
fcutoff, contrast, freqs, gain, chi2 = load_spectra(data_path, cell, run)
|
||||||
dfreqs, diag = diag_projection(freqs, chi2, 2*fcutoff)
|
dfreqs, diag = diag_projection(freqs, chi2, 2*fcutoff)
|
||||||
nli, nlif = peakedness(dfreqs, diag, rate, median=False)
|
nli, nlif = peakedness(dfreqs, diag, rate, median=False)
|
||||||
print(f' {cell:<22s}: run={run:2d}, fbase={rate:3.0f}Hz, CV={cv:.2f}, SI={nli:3.1f}')
|
print(f' {cell:<22s}: run={run:2d}, fbase={rate:3.0f}Hz, CV={cv:.2f}, SI={nli:3.1f}')
|
||||||
pc = plot_chi2(axs[k], s, contrast, freqs, chi2, fcutoff, 1.3)
|
plot_isih2(axs[0, k], s, rate, cv, isis, pdf)
|
||||||
axs[k].set_title(f'$r={rate:.0f}$Hz, CV$_{{\\rm base}}$={cv:.2f}', fontsize='medium')
|
pc = plot_chi2(axs[1, k], s, contrast, freqs, chi2, fcutoff, 1.3)
|
||||||
axs[k].text(0.95, 0.9, f'SI($r$)={nli:.1f}', ha='right', zorder=50,
|
#axs[k].set_title(f'$r={rate:.0f}$Hz, CV$_{{\\rm base}}$={cv:.2f}', fontsize='medium')
|
||||||
color='white', fontsize='medium',
|
axs[1, k].text(0.95, 0.9, f'SI($r$)={nli:.1f}', ha='right', zorder=50,
|
||||||
transform=axs[k].transAxes)
|
color='white', fontsize='medium',
|
||||||
plot_colorbar(axs[-1], pc)
|
transform=axs[1, k].transAxes)
|
||||||
fig.common_yticks(axs)
|
axs[0, 0].text(0, 1.6, 'P-units:', transform=axs[0, 0].transAxes,
|
||||||
fig.tag(axs, xoffs=-3, yoffs=2)
|
color=s.cell_color1,
|
||||||
|
fontsize='large')
|
||||||
|
axs[0, -1].text(1, 0, '5\\,ms', ha='right',
|
||||||
|
transform=axs[0, -1].transAxes)
|
||||||
|
plot_colorbar(axs[1, -1], pc)
|
||||||
|
fig.common_yticks(axs[1, :])
|
||||||
|
fig.tag([axs[0, :]], xoffs=-3, yoffs=1)
|
||||||
|
|
||||||
fig.savefig()
|
fig.savefig()
|
||||||
print()
|
print()
|
||||||
|
Loading…
Reference in New Issue
Block a user