[noisesplit] finished

This commit is contained in:
Jan Benda 2025-05-17 20:11:08 +02:00
parent 8d8b02d581
commit b3bfc45bf8

View File

@ -228,7 +228,7 @@ if __name__ == '__main__':
cell_name = ['2017-07-18-ai-invivo-1', 1] # Take this! at 3% model, 5% data
nsmall = 100
nlarge = 1000000
contrast = 0.03
contrast = 0.05
wdt = 0.0001
wnoise = whitenoise(0, 300, wdt, 0.05, rng=np.random.default_rng(51234))
@ -237,24 +237,26 @@ if __name__ == '__main__':
s = plot_style()
fig, axs = plt.subplots(3, 4, cmsize=(s.plot_width, 0.7*s.plot_width),
width_ratios=[1, 0, 1, 1, 0.15, 1])
fig.subplots_adjust(leftm=8, rightm=1.5, topm=3, bottomm=4,
fig.subplots_adjust(leftm=8, rightm=1.5, topm=4, bottomm=4,
wspace=0.25, hspace=0.8)
axs[0, 2].set_visible(False)
axs[0, 3].set_visible(False)
xt = -2.2
yt = 1.3
# data:
axs[0, 1].text(-2.42, 1.2, 'P-unit data', fontsize='large',
axs[0, 1].text(xt, yt, 'P-unit data', fontsize='large',
transform=axs[0, 1].transAxes, color=s.punit_color1)
data_contrast, ratebase, eodf = plot_chi2_data(axs[0, 1], s, cell_name[0],
cell_name[1])
plot_ram(axs[0, 0], data_contrast, eodf, wtime, wnoise)
axs[0, 1].text(-1.5, 1.2, f'$r={ratebase:.0f}$\\,Hz',
axs[0, 1].text(xt + 0.9, yt, f'$r={ratebase:.0f}$\\,Hz',
transform=axs[0, 1].transAxes, fontsize='large')
# model:
data_files = sims_path.glob(f'chi2-noisen-{cell_name[0]}-{1000*contrast:03.0f}-*.npz')
files, nums = sort_files(cell_name[0], data_files, 2)
axs[1, 1].text(-2.42, 1.2, 'P-unit model', fontsize='large',
axs[1, 1].text(xt, yt, 'P-unit model', fontsize='large',
transform=axs[1, 1].transAxes, color=s.model_color1)
plot_chi2_contrast(axs[1, 1], axs[1, 2], s, files, nums, nsmall, nlarge)
axr1 = plot_noise_split(axs[1, 0], contrast, 0, 1, wtime, wnoise)
@ -265,9 +267,9 @@ if __name__ == '__main__':
# model noise split:
data_files = sims_path.glob(f'chi2-split-{cell_name[0]}-*.npz')
files, nums = sort_files(cell_name[0], data_files, 1)
axs[2, 1].text(-2.42, 1.2, 'P-unit model', fontsize='large',
axs[2, 1].text(xt, yt, 'P-unit model', fontsize='large',
transform=axs[2, 1].transAxes, color=s.model_color1)
axs[2, 1].text(-1.5, 1.2, f'(noise split)', fontsize='large',
axs[2, 1].text(xt + 0.9, yt, f'(noise split)', fontsize='large',
transform=axs[2, 1].transAxes)
noise_contrast, noise_frac = plot_chi2_split(axs[2, 1], axs[2, 2], s,
files, nums, nsmall, nlarge)
@ -283,6 +285,6 @@ if __name__ == '__main__':
fig.tag([axs[0, :2],
[axr1] + axs[1, 1:].tolist(),
[axr2] + axs[2, 1:].tolist()],
xoffs=-4.5, yoffs=2)
xoffs=[-4.5, 1, 1, -4.5], yoffs=2)
fig.savefig()
print()