added correlation with baseline rate

This commit is contained in:
2025-05-26 18:11:08 +02:00
parent 04578fd77e
commit d56c0c7c7e
4 changed files with 67 additions and 20 deletions

View File

@@ -30,20 +30,21 @@ def load_chi2(file_path, cell_name, contrast=None, n=None):
return freqs, chi2, fcutoff, contrast, n
def plot_chi2_contrasts(axs, s, cell_name):
def plot_chi2_contrasts(axs, s, cell_name, vmax):
d = sims_path / f'{cell_name}-baseline.npz'
data = np.load(d)
rate = float(data['rate'])
cv = float(data['cv'])
print(f' {cell_name}: r={rate:3.0f}Hz, CV={cv:4.2f}')
freqs, chi2, fcutoff, contrast, n = load_chi2(sims_path, cell_name)
cax = plot_chi2(axs[0], s, freqs, chi2, fcutoff, rate)
cax = plot_chi2(axs[0], s, freqs, chi2, fcutoff, rate, vmax)
cax.set_ylabel('')
axs[0].set_title(r'$c$=0\,\%', fontsize='medium')
for k, alpha in enumerate([0.01, 0.03, 0.1]):
freqs, chi2, fcutoff, contrast, n = load_chi2(sims_path, cell_name,
alpha)
cax = plot_chi2(axs[k + 1], s, freqs, chi2, fcutoff, rate)
cax = plot_chi2(axs[k + 1], s, freqs, chi2, fcutoff, rate, vmax)
vmax /= 2
if alpha < 0.1:
cax.set_ylabel('')
axs[k + 1].set_title(f'$c$={100*alpha:g}\\,\\%', fontsize='medium')
@@ -142,8 +143,9 @@ if __name__ == '__main__':
fig.subplots_adjust(leftm=7, rightm=9, topm=2, bottomm=3.5,
wspace=1, hspace=0.5)
print('Example cells:')
vmax = [2, 6, 8, 40]
for k in range(len(model_cells)):
plot_chi2_contrasts(axs[k], s, model_cells[k])
plot_chi2_contrasts(axs[k], s, model_cells[k], vmax[k])
for k in range(4):
fig.common_yticks(axs[k, :])
fig.common_xticks(axs[:4, k])