changed example punit
This commit is contained in:
@@ -7,9 +7,8 @@ from spectral import diag_projection, peakedness
|
||||
from plotstyle import plot_style
|
||||
|
||||
|
||||
cell_name = '2020-10-27-ag-invivo-1'
|
||||
run1 = 0
|
||||
run2 = 1
|
||||
example_cell = [['2020-10-27-ag-invivo-1', 0],
|
||||
['2020-10-27-ag-invivo-1', 1]]
|
||||
|
||||
example_cells = [
|
||||
['2021-06-18-ae-invivo-1', 3], # 98Hz, 1%, ok
|
||||
@@ -22,10 +21,12 @@ example_cells = [
|
||||
##['2020-10-27-ae-invivo-1', 4], # 375Hz, 0.5%, 4.3, nice, additional low freq line
|
||||
###['2020-10-27-ag-invivo-1', 2], # 405Hz, 5%, 3.9, strong, is already the example
|
||||
##['2021-08-03-ab-invivo-1', 1], # 140Hz, 0.5%, ok
|
||||
['2020-10-29-ag-invivo-1', 2], # 164Hz, 5%, 1.6, no diagonal
|
||||
##['2010-08-31-ag', 1], # 269Hz, 5%, no diagonal
|
||||
#['2020-10-29-ag-invivo-1', 2], # 164Hz, 5%, 1.6, no diagonal
|
||||
['2018-08-24-ak', 1], # 145Hz, 5%, no diagonal
|
||||
['2018-08-14-ac', 0], # 239Hz, 10%, no diagonal
|
||||
##['2010-08-31-ag', 1], # 269Hz, 5%, no diagonal
|
||||
##['2018-08-29-af', 1], # 383Hz, 5%, no diagonal
|
||||
|
||||
]
|
||||
|
||||
data_path = Path('data') / 'cells'
|
||||
@@ -95,9 +96,10 @@ 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.set_xticks_delta(5)
|
||||
#ax.set_xticks_blank()
|
||||
#ax.set_xticks_fixed([0, 5, 10, 15, 20], ['0', '', '', '', '20\\,ms'])
|
||||
ax.set_xticks_fixed([0, 5, 10, 15, 20], ['0', '5', '10', '15', '20\\,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)
|
||||
@@ -218,14 +220,36 @@ def plot_diagonals(ax, s, fbase, contrast1, freqs1, chi21, contrast2, freqs2, ch
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
"""
|
||||
from thunderlab.tabledata import TableData
|
||||
data = TableData('data/Apteronotus_leptorhynchus-Punit-data.csv')
|
||||
data = data[(data['nli'] > 0) & (data['nli'] <= 1.2), :]
|
||||
data = data[(data['respmod2'] > 150) & (data['respmod2'] < 200), :]
|
||||
data = data[(data['cvbase'] > 0.4) & (data['cvbase'] < 0.8), :]
|
||||
data = data[(data['ratebase'] > 300) & (data['ratebase'] < 400), :]
|
||||
for k in range(data.rows()):
|
||||
print(f'{data[k, "cell"]:<22s} s{data[k, "stimindex"]:02.0f}: '
|
||||
f'{100*data[k, "contrast"]:3g}%, r={data[k, "ratebase"]:3.0f}Hz, '
|
||||
f'CV={data[k, "cvbase"]:4.2f}, '
|
||||
f'rmod={data[k, "respmod2"]:3.0f}Hz, '
|
||||
f'nli={data[k, "nli"]:5.2f}')
|
||||
print()
|
||||
#exit()
|
||||
"""
|
||||
|
||||
cell_name = example_cell[0][0]
|
||||
print('Example P-unit:', cell_name)
|
||||
eodf, rate, cv, isis, pdf, freqs, prr = load_baseline(data_path, cell_name)
|
||||
print(f' baseline firing rate: {rate:.0f}Hz')
|
||||
print(f' baseline firing CV : {cv:.2f}')
|
||||
contrast1, time1, stimulus1, spikes1 = load_noise(data_path, cell_name, run1)
|
||||
contrast2, time2, stimulus2, spikes2 = load_noise(data_path, cell_name, run2)
|
||||
fcutoff1, contrast1, freqs1, gain1, chi21 = load_spectra(data_path, cell_name, run1)
|
||||
fcutoff2, contrast2, freqs2, gain2, chi22 = load_spectra(data_path, cell_name, run2)
|
||||
contrast1, time1, stimulus1, spikes1 = load_noise(data_path,
|
||||
*example_cell[0])
|
||||
contrast2, time2, stimulus2, spikes2 = load_noise(data_path,
|
||||
*example_cell[1])
|
||||
fcutoff1, contrast1, freqs1, gain1, chi21 = load_spectra(data_path,
|
||||
*example_cell[0])
|
||||
fcutoff2, contrast2, freqs2, gain2, chi22 = load_spectra(data_path,
|
||||
*example_cell[1])
|
||||
|
||||
s = plot_style()
|
||||
s.cell_color1 = s.punit_color1
|
||||
@@ -235,7 +259,7 @@ if __name__ == '__main__':
|
||||
s.psC1 = s.psP1
|
||||
s.psC2 = s.psP2
|
||||
fig, (ax1, ax2, ax3) = \
|
||||
plt.subplots(3, 1, height_ratios=[3, 0, 3, 0.2, 4.5],
|
||||
plt.subplots(3, 1, height_ratios=[3, 0, 3, 0.2, 4.7],
|
||||
cmsize=(s.plot_width, 0.85*s.plot_width))
|
||||
fig.subplots_adjust(leftm=8, rightm=9, topm=2, bottomm=4,
|
||||
wspace=0.4, hspace=0.4)
|
||||
@@ -243,7 +267,7 @@ if __name__ == '__main__':
|
||||
axg, axc1, axc2, axd = ax2.subplots(1, 4, wspace=0.4)
|
||||
axg = axg.subplots(1, 1, width_ratios=[1, 0.1])
|
||||
axd = axd.subplots(1, 1, width_ratios=[0.2, 1])
|
||||
axs = ax3.subplots(2, 4, wspace=0.4, hspace=0.2, height_ratios=[1, 4])
|
||||
axs = ax3.subplots(2, 4, wspace=0.4, hspace=0.35, height_ratios=[1, 4])
|
||||
|
||||
plot_isih(axi, s, rate, cv, isis, pdf)
|
||||
plot_response_spectrum(axp, s, eodf, rate, freqs, prr)
|
||||
@@ -276,16 +300,15 @@ if __name__ == '__main__':
|
||||
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}')
|
||||
plot_isih2(axs[0, k], s, rate, cv, isis, pdf)
|
||||
pc = plot_chi2(axs[1, k], s, contrast, freqs, chi2, fcutoff, 1.3)
|
||||
#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.0)
|
||||
axs[1, k].text(0.95, 0.9, f'SI($r$)={nli:.1f}', ha='right', zorder=50,
|
||||
color='white', fontsize='medium',
|
||||
transform=axs[1, k].transAxes)
|
||||
axs[0, 0].text(0, 1.6, 'P-units:', transform=axs[0, 0].transAxes,
|
||||
color=s.cell_color1,
|
||||
fontsize='large')
|
||||
axs[0, -1].text(0.97, -0.45, '5\\,ms', ha='right',
|
||||
transform=axs[0, -1].transAxes)
|
||||
#axs[0, -1].text(0.97, -0.45, '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)
|
||||
|
||||
Reference in New Issue
Block a user