Began writing results :)

This commit is contained in:
j-hartling
2026-02-23 16:48:53 +01:00
parent 1ea2081eab
commit c700e1723c
10 changed files with 197 additions and 118 deletions

View File

@@ -117,32 +117,12 @@ def reorder_traces(handles, signal, zlow=2, zhigh=2.5):
return None
def choose_kernels(kern_specs, features, kern_types, per_type=2, thresh=0.01):
embed()
mean_feat = features.mean(axis=0)
feat_diff = np.abs(mean_feat[:, None] - mean_feat[None, :])
feat_diff[features.max(axis=0) < thresh, :] = np.nan
feat_diff = np.nanmean(feat_diff, axis=0)
ranking = np.argsort(feat_diff)
kern_inds = []
for type_id in kern_types:
type_inds = np.nonzero(kern_specs[:, 0] == type_id)[0]
rank_inds = np.nonzero(np.isin(ranking, type_inds))[0][-per_type:]
kern_inds.extend(ranking[rank_inds])
return np.array(kern_inds)
mean_feat = features.mean(axis=0)
mean_feat -= mean_feat.min()
mean_feat /= mean_feat.max()
feat_diff = np.abs(mean_feat[:, None] - mean_feat[None, :]).mean(axis=0)
feat_diff -= feat_diff.min()
feat_diff /= feat_diff.max()
ranking = np.argsort(mean_feat + feat_diff)
kern_inds = []
for type_id in kern_types:
type_inds = np.nonzero(kern_specs[:, 0] == type_id)[0]
@@ -162,7 +142,7 @@ def letter_subplots(axes, labels='abcd', x=0.02, y=1, ha='left', va='bottom',
target = 'Omocestus_rufipes'
data_paths = glob.glob(f'../data/processed/{target}*.npz')
stages = ['filt', 'env', 'log', 'inv', 'conv', 'bi', 'feat']
save_path = None#'../figures/'
save_path = '../figures/'
# PLOT SETTINGS:
fig_kwargs = dict(
@@ -194,8 +174,8 @@ lw_full = dict(
log=0.5,
inv=0.5,
conv=0.25,
bi=0,
feat=2
bi=0.2,
feat=1.5
)
lw_zoom = dict(
filt=0.5,
@@ -203,8 +183,8 @@ lw_zoom = dict(
log=1,
inv=1,
conv=1.5,
bi=0,
feat=2
bi=0.2,
feat=1.5
)
loc_full = dict(
filt=0.2,
@@ -228,27 +208,27 @@ zoom_kwargs = dict(
zorder=0,
linewidth=0
)
kernels = np.array([
[1, 0.002],
[1, 0.016],
[-1, 0.002],
[-1, 0.016],
[2, 0.004],
[2, 0.032],
[-2, 0.004],
[-2, 0.032],
[3, 0.004],
[3, 0.032],
[-3, 0.004],
[-3, 0.032],
[4, 0.004],
[4, 0.032],
[-4, 0.004],
[-4, 0.032]
])
# t = [1, 2, 3, 4]
# s = [0.001, 0.002, 0.004, 0.008, 0.032]
# kernels = np.array([[i, j] for i in t for j in s])
# kernels = np.array([
# [1, 0.002],
# [1, 0.016],
# [-1, 0.004],
# [-1, 0.032],
# [2, 0.004],
# [2, 0.016],
# [-2, 0.002],
# [-2, 0.032],
# [3, 0.008],
# [3, 0.032],
# [-3, 0.008],
# [-3, 0.032],
# [4, 0.004],
# [4, 0.032],
# [-4, 0.004],
# [-4, 0.032]
# ])
t = [1, -1, 2, -2, 3, -3, 4, -4]
s = [0.004, 0.032]
kernels = np.array([[i, j] for i in t for j in s])
conv_colors = load_colors('../data/conv_colors.npz')
bi_colors = load_colors('../data/bi_colors.npz')
feat_colors = load_colors('../data/feat_colors.npz')