Skip to content

Commit c76860e

Browse files
committed
Added Greenwood function
1 parent 16e05f1 commit c76860e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

flamingo_tools/segmentation/cochlea_mapping.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,25 @@ def tonotopic_mapping(
117117

118118
path_list[c] = {"label_id": c, "tonotopic": path_list[nearest_node]["tonotopic"]}
119119

120+
# label in micrometer
120121
tonotopic = [0 for _ in range(len(table))]
121122
# be aware of 'label_id' of dataframe starting at 1
122123
for key in list(path_list.keys()):
123124
tonotopic[int(path_list[key]["label_id"] - 1)] = path_list[key]["tonotopic"] * total_distance
124125

125126
table.loc[:, "tonotopic_label"] = tonotopic
126127

128+
# map frequency using Greenwood function f(x) = A * (10 **(ax) - K), for humans: a=2.1, k=0.88, A = 165.4 [kHz]
129+
tonotopic_map = [0 for _ in range(len(table))]
130+
var_k = 0.88
131+
# calculate values to fit (assumed) minimal (1kHz) and maximal (80kHz) hearing range of mice at x=0, x=1
132+
fmin = 1
133+
fmax = 80
134+
var_A = fmin / (1 - var_k)
135+
var_exp = ((fmax + var_A * var_k) / var_A)
136+
for key in list(path_list.keys()):
137+
tonotopic_map[int(path_list[key]["label_id"] - 1)] = var_A * (var_exp ** path_list[key]["tonotopic"] - var_k)
138+
139+
table.loc[:, "tonotopic_value[kHz]"] = tonotopic_map
140+
127141
return table

0 commit comments

Comments
 (0)