changed example punit

This commit is contained in:
2025-05-20 00:12:23 +02:00
parent 2e3d373100
commit ee2b8f98b7
18 changed files with 232 additions and 149 deletions

View File

@@ -6,6 +6,8 @@ from pathlib import Path
from plotstyle import plot_style, labels_params, significance_str
model_cell = '2012-12-21-ak-invivo-1'
data_path = Path('data')
sims_path = data_path / 'simulations'
@@ -71,7 +73,7 @@ def plot_chi2(ax, s, data_file):
def plot_chi2_contrasts(axs, s, cell_name, n=None):
print(cell_name)
print(f' {cell_name}')
files, nums = sort_files(cell_name,
sims_path.glob(f'chi2-split-{cell_name}-*.npz'), 1)
idx = -1 if n is None else nums.index(n)
@@ -84,10 +86,10 @@ def plot_chi2_contrasts(axs, s, cell_name, n=None):
def plot_nli_diags(ax, s, data, alphax, alphay, xthresh, ythresh, cell_name):
datax = data[data('contrast') == alphax, :]
datay = data[data('contrast') == alphay, :]
nlix = datax('dnli')
nliy = datay('dnli100')
datax = data[data['contrast'] == alphax, :]
datay = data[data['contrast'] == alphay, :]
nlix = datax['dnli']
nliy = datay['dnli100']
nfp = np.sum((nliy > ythresh) & (nlix < xthresh))
ntp = np.sum((nliy > ythresh) & (nlix > xthresh))
ntn = np.sum((nliy < ythresh) & (nlix < xthresh))
@@ -106,13 +108,13 @@ def plot_nli_diags(ax, s, data, alphax, alphay, xthresh, ythresh, cell_name):
ax.axhline(ythresh, **s.lsLine)
ax.axvline(xthresh, 0, 0.5, **s.lsLine)
if alphax == 0:
mask = datax('triangle') > 0.5
mask = datax['triangle'] > 0.5
ax.plot(nlix[mask], nliy[mask], zorder=30, label='strong', **s.psA1m)
mask = datax('border') > 0.5
mask = datax['border'] > 0.5
ax.plot(nliy[mask], nliy[mask], zorder=20, label='weak', **s.psA2m)
ax.plot(nlix, nliy, zorder=10, label='none', **s.psB1m)
# mark cell:
mask = datax('cell') == cell_name
mask = datax['cell'] == cell_name
color = s.psB1m['color']
if alphax == 0:
if datax[mask, 'border']:
@@ -183,15 +185,16 @@ if __name__ == '__main__':
wspace=1, hspace=1)
for ax in axs.flat:
ax.set_visible(False)
cell_name = '2012-12-21-ak-invivo-1'
plot_chi2_contrasts(axs[0], s, cell_name)
plot_chi2_contrasts(axs[1], s, cell_name, 10)
print('Example cells:')
plot_chi2_contrasts(axs[0], s, model_cell)
plot_chi2_contrasts(axs[1], s, model_cell, 10)
for k in range(2):
fig.common_yticks(axs[k, :])
for k in range(4):
fig.common_xticks(axs[:2, k])
plot_summary_contrasts(axs[3], s, xthresh, ythresh, cell_name)
plot_summary_diags(axs[5], s, xthresh, ythresh, cell_name)
print()
plot_summary_contrasts(axs[3], s, xthresh, ythresh, model_cell)
plot_summary_diags(axs[5], s, xthresh, ythresh, model_cell)
fig.common_yticks(axs[3, 1:])
fig.common_yticks(axs[5, 1:])
fig.tag(axs, xoffs=-4.5, yoffs=1.8)