Skip to content

Commit ba124ba

Browse files
committed
Unify equation for tonotopic mapping
1 parent 5e65009 commit ba124ba

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

flamingo_tools/segmentation/cochlea_mapping.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,15 @@ def map_frequency(table: pd.DataFrame, animal: str = "mouse", otof: bool = False
562562
var_a = 100 / 82.5
563563
var_k = 1.565
564564
var_A = 1
565-
table.loc[table['offset'] >= 0, 'frequency-mueller[kHz]'] = var_A * (10 ** (var_a * (var_k - (1 - table["length_fraction"])))) # noqa
565+
# bring it into same format as previous equation:
566+
# f(x) = 10 ** (a * (k - (1-x)))
567+
# f(x) = 10 ** (ax - (-a * (k-1)))
568+
# f(x) = 10 ** (ax - c) with c = (-a * (k-1))
569+
var_a = 100 / 82.5
570+
var_k = -0.684848485
571+
var_A = 1
572+
table.loc[table['offset'] >= 0, 'frequency[kHz]'] = var_A * (10 ** (var_a * table["length_fraction"]) - var_k)
573+
566574
table.loc[table['offset'] < 0, 'frequency-mueller[kHz]'] = 0
567575

568576
return table

0 commit comments

Comments
 (0)