cleaned up for new data
This commit is contained in:
@@ -3,7 +3,7 @@ import matplotlib.pyplot as plt
|
||||
from scipy.stats import pearsonr, linregress, gaussian_kde
|
||||
from thunderlab.tabledata import TableData
|
||||
from pathlib import Path
|
||||
from spectral import whitenoise, diag_projection, peakedness
|
||||
from spectral import whitenoise, diag_projection, peak_size
|
||||
from plotstyle import plot_style, labels_params, significance_str
|
||||
|
||||
|
||||
@@ -66,8 +66,8 @@ def plot_chi2(ax, s, data_file, rate):
|
||||
ax.set_xlabel('$f_1$', 'Hz')
|
||||
ax.set_ylabel('$f_2$', 'Hz')
|
||||
dfreqs, diag = diag_projection(freqs, chi2, 2*fcutoff)
|
||||
nli, nlif = peakedness(dfreqs, diag, rate, median=False)
|
||||
ax.text(0.95, 0.88, f'SI($r$)={nli:.1f}', ha='right', zorder=50,
|
||||
sinorm, sirel, sif = peak_size(dfreqs, diag, rate, median=False)
|
||||
ax.text(0.95, 0.88, f'SI($r$)={sinorm:.1f}', ha='right', zorder=50,
|
||||
color='white', fontsize='medium', transform=ax.transAxes)
|
||||
cax = ax.inset_axes([1.04, 0, 0.05, 1])
|
||||
cax.set_spines_outward('lrbt', 0)
|
||||
@@ -95,7 +95,7 @@ def plot_chi2_contrasts(axs, s, cell_name):
|
||||
plot_chi2(axs[k + 1], s, files[-1], rate)
|
||||
|
||||
|
||||
def plot_nli_cv(ax, s, data, alpha, cells):
|
||||
def plot_si_cv(ax, s, data, alpha, cells):
|
||||
data = data[data['contrast'] == alpha, :]
|
||||
r, p = pearsonr(data['cvbase'], data['dnli'])
|
||||
l = linregress(data['cvbase'], data['dnli'])
|
||||
@@ -151,7 +151,7 @@ def plot_nli_cv(ax, s, data, alpha, cells):
|
||||
def plot_summary_contrasts(axs, s, cells):
|
||||
nli_thresh = 1.2
|
||||
data = TableData(data_path / 'Apteronotus_leptorhynchus-Punit-models.csv')
|
||||
plot_nli_cv(axs[0], s, data, 0, cells)
|
||||
plot_si_cv(axs[0], s, data, 0, cells)
|
||||
print('noise split:')
|
||||
cdata = data[data['contrast'] == 0, :]
|
||||
nli_split = cdata['dnli']
|
||||
|
||||
Reference in New Issue
Block a user