added simulation data

This commit is contained in:
2025-05-16 09:41:11 +02:00
parent 273b7a04ae
commit f1883a834b
239 changed files with 69 additions and 22 deletions

View File

@@ -6,7 +6,8 @@ from pathlib import Path
from plotstyle import plot_style, labels_params, significance_str
data_path = Path('newdata3')
data_path = Path('data')
sims_path = data_path / 'simulations'
def sort_files(cell_name, all_files, n):
@@ -72,12 +73,12 @@ def plot_chi2(ax, s, data_file):
def plot_chi2_contrasts(axs, s, cell_name, n=None):
print(cell_name)
files, nums = sort_files(cell_name,
data_path.glob(f'chi2-split-{cell_name}-*.npz'), 1)
sims_path.glob(f'chi2-split-{cell_name}-*.npz'), 1)
idx = -1 if n is None else nums.index(n)
plot_chi2(axs[0], s, files[idx])
for k, alphastr in enumerate(['010', '030', '100']):
files, nums = sort_files(cell_name,
data_path.glob(f'chi2-noisen-{cell_name}-{alphastr}-*.npz'), 2)
sims_path.glob(f'chi2-noisen-{cell_name}-{alphastr}-*.npz'), 2)
idx = -1 if n is None else nums.index(n)
plot_chi2(axs[k + 1], s, files[idx])
@@ -138,8 +139,8 @@ def plot_nli_diags(ax, s, data, alphax, alphay, xthresh, ythresh, cell_name):
ax.set_yticks_delta(4)
ax.set_minor_xticks_delta(1)
ax.set_minor_yticks_delta(1)
ax.text(0, 0.9, f'$r={r:.2f}$', transform=ax.transAxes, fontsize='small')
ax.text(0, 0.7, significance_str(p), transform=ax.transAxes,
ax.text(0, 0.9, f'$R={r:.2f}$', transform=ax.transAxes, fontsize='small')
ax.text(0, 0.75, significance_str(p), transform=ax.transAxes,
fontsize='small')
if alphax == 0 and alphay == 0.01:
ax.legend(loc='upper left', bbox_to_anchor=(-1.5, 1),
@@ -157,7 +158,7 @@ def plot_nli_diags(ax, s, data, alphax, alphay, xthresh, ythresh, cell_name):
def plot_summary_contrasts(axs, s, xthresh, ythresh, cell_name):
print(f'against contrast with thresholds: x={xthresh} and y={ythresh}')
data = TableData('summarychi2noise.csv')
data = TableData(data_path / 'Apteronotus_leptorhynchus-Punit-models.csv')
for i, a in enumerate([0.01, 0.03, 0.1]):
print(f'contrast {100*a:2g}%:')
plot_nli_diags(axs[1 + i], s, data, a, a, xthresh, ythresh, cell_name)
@@ -166,7 +167,7 @@ def plot_summary_contrasts(axs, s, xthresh, ythresh, cell_name):
def plot_summary_diags(axs, s, xthresh, ythresh, cell_name):
print(f'against split with thresholds: x={xthresh} and y={ythresh}')
data = TableData('summarychi2noise.csv')
data = TableData(data_path / 'Apteronotus_leptorhynchus-Punit-models.csv')
for i, a in enumerate([0.01, 0.03, 0.1]):
print(f'contrast {100*a:2g}%:')
plot_nli_diags(axs[1 + i], s, data, 0, a, xthresh, ythresh, cell_name)
@@ -178,7 +179,7 @@ if __name__ == '__main__':
s = plot_style()
fig, axs = plt.subplots(6, 4, cmsize=(s.plot_width, 0.85*s.plot_width),
height_ratios=[1, 1, 0, 1, 0, 1])
fig.subplots_adjust(leftm=7, rightm=8, topm=2, bottomm=3.5,
fig.subplots_adjust(leftm=7, rightm=9, topm=2, bottomm=4,
wspace=1, hspace=1)
for ax in axs.flat:
ax.set_visible(False)
@@ -195,5 +196,4 @@ if __name__ == '__main__':
fig.common_yticks(axs[5, 1:])
fig.tag(axs, xoffs=-4.5, yoffs=1.8)
axs[1, 0].set_visible(False)
#plt.show()
fig.savefig()