@@ -383,14 +383,15 @@ def measure_run_length_ihcs(
383383 return total_distance , path , path_dict
384384
385385
386- def map_frequency (table : pd .DataFrame , cell_type : str , animal : str = "mouse" ) -> pd .DataFrame :
386+ def map_frequency (table : pd .DataFrame , animal : str = "mouse" ) -> pd .DataFrame :
387387 """Map the frequency range of SGNs in the cochlea
388388 using Greenwood function f(x) = A * (10 **(ax) - K).
389389 Values for humans: a=2.1, k=0.88, A = 165.4 [kHz].
390390 For mice: fit values between minimal (1kHz) and maximal (80kHz) values
391391
392392 Args:
393393 table: Dataframe containing the segmentation.
394+ animal: Select the Greenwood function parameters specific to a species. Either "mouse" or "gerbil".
394395
395396 Returns:
396397 Dataframe containing frequency in an additional column 'frequency[kHz]'.
@@ -569,6 +570,7 @@ def tonotopic_mapping(
569570 component_mapping : Optional [List [int ]] = None ,
570571 cell_type : str = "ihc" ,
571572 animal : str = "mouse" ,
573+ apex_higher : bool = True ,
572574) -> pd .DataFrame :
573575 """Tonotopic mapping of IHCs by supplying a table with component labels.
574576 The mapping assigns a tonotopic label to each IHC according to the position along the length of the cochlea.
@@ -591,19 +593,25 @@ def tonotopic_mapping(
591593 component_mapping = component_label
592594
593595 if cell_type == "ihc" :
594- total_distance , _ , path_dict = measure_run_length_ihcs (centroids , component_label = component_label )
596+ total_distance , _ , path_dict = measure_run_length_ihcs (
597+ centroids , component_label = component_label , apex_higher = apex_higher ,
598+ )
595599
596600 else :
597601 if len (component_mapping ) == 1 :
598- total_distance , _ , path_dict = measure_run_length_sgns (centroids )
602+ total_distance , _ , path_dict = measure_run_length_sgns (
603+ centroids , apex_higher = apex_higher ,
604+ )
599605
600606 else :
601607 centroids_components = []
602608 for label in component_mapping :
603609 subset = table [table ["component_labels" ] == label ]
604610 subset_centroids = list (zip (subset ["anchor_x" ], subset ["anchor_y" ], subset ["anchor_z" ]))
605611 centroids_components .append (subset_centroids )
606- total_distance , _ , path_dict = measure_run_length_sgns_multi_component (centroids_components )
612+ total_distance , _ , path_dict = measure_run_length_sgns_multi_component (
613+ centroids_components , apex_higher = apex_higher ,
614+ )
607615
608616 node_dict = node_dict_from_path_dict (path_dict , label_ids , centroids )
609617
@@ -622,6 +630,6 @@ def tonotopic_mapping(
622630
623631 table .loc [:, "length[µm]" ] = table ["length_fraction" ] * total_distance
624632
625- table = map_frequency (table , cell_type = cell_type , animal = animal )
633+ table = map_frequency (table , animal = animal )
626634
627635 return table
0 commit comments