@@ -205,7 +205,7 @@ def measure_run_length_ihcs(centroids, max_edge_distance=50):
205205 return total_distance , path , path_dict
206206
207207
208- def map_frequency (table : pd .DataFrame ):
208+ def map_frequency (table : pd .DataFrame , cell_type : str , animal : str = "mouse" ):
209209 """Map the frequency range of SGNs in the cochlea
210210 using Greenwood function f(x) = A * (10 **(ax) - K).
211211 Values for humans: a=2.1, k=0.88, A = 165.4 [kHz].
@@ -217,12 +217,42 @@ def map_frequency(table: pd.DataFrame):
217217 Returns:
218218 Dataframe containing frequency in an additional column 'frequency[kHz]'.
219219 """
220- var_k = 0.88
221- fmin = 1
222- fmax = 80
223- var_A = fmin / (1 - var_k )
224- var_exp = ((fmax + var_A * var_k ) / var_A )
225- table .loc [table ['offset' ] >= 0 , 'frequency[kHz]' ] = var_A * (var_exp ** table ["length_fraction" ] - var_k )
220+ if animal == "mouse" :
221+ if cell_type == "ihc" :
222+ # freq_min = 5.16 kHz
223+ # freq_max = 81.38 kHz
224+ var_A = 4.232
225+ var_a = 1.279
226+ var_k = - 0.22
227+ if cell_type == "sgn" :
228+ # freq_min = 0.0095 kHz
229+ # freq_max = 47.47 kHz
230+ var_A = 0.38
231+ var_a = 2.1
232+ var_k = 0.975
233+
234+ elif animal == "gerbil" :
235+ if cell_type == "ihc" :
236+ # freq_min = 0.0105 kHz
237+ # freq_max = 43.82 kHz
238+ var_A = 0.35
239+ var_a = 2.1
240+ var_k = 0.7
241+ if cell_type == "sgn" :
242+ # freq_min = 0.0105 kHz
243+ # freq_max = 43.82 kHz
244+ var_A = 0.35
245+ var_a = 2.1
246+ var_k = 0.7
247+
248+ # alternative Gerbil Greenwood function according to Mueller1995
249+ # var_A = 0.398
250+ # var_a = 2.2
251+ # var_k = 0.631
252+ else :
253+ raise ValueError ("Animal not supported. Use either 'mouse' or 'gerbil'." )
254+
255+ table .loc [table ['offset' ] >= 0 , 'frequency[kHz]' ] = var_A * (10 ** (var_a * table ["length_fraction" ]) - var_k )
226256 table .loc [table ['offset' ] < 0 , 'frequency[kHz]' ] = 0
227257
228258 return table
@@ -273,7 +303,8 @@ def equidistant_centers(
273303def tonotopic_mapping (
274304 table : pd .DataFrame ,
275305 component_label : List [int ] = [1 ],
276- cell_type : str = "ihc"
306+ cell_type : str = "ihc" ,
307+ animal : str = "mouse" ,
277308) -> pd .DataFrame :
278309 """Tonotopic mapping of IHCs by supplying a table with component labels.
279310 The mapping assigns a tonotopic label to each IHC according to the position along the length of the cochlea.
@@ -329,6 +360,6 @@ def tonotopic_mapping(
329360 table .loc [:, "length_fraction" ] = length_fraction
330361 table .loc [:, "length[µm]" ] = table ["length_fraction" ] * total_distance
331362
332- table = map_frequency (table )
363+ table = map_frequency (table , cell_type = cell_type , animal = animal )
333364
334365 return table
0 commit comments