@@ -135,13 +135,15 @@ def check_implementation():
135135 analyze_cochlea (cochlea , plot = True )
136136
137137
138- def compare_cochleae (cochleae , animal , plot_density = True , plot_tonotopy = True ):
138+ def compare_cochleae (cochleae , animal , plot_density = True , plot_tonotopy = True , alias = None ):
139+ if alias is not None :
140+ assert len (alias ) == len (cochleae )
139141
140142 if plot_density :
141143 plt .figure (figsize = (6 , 3 ))
142- for cochlea in cochleae :
144+ for i , cochlea in enumerate ( cochleae ) :
143145 grid , density = analyze_cochlea (cochlea , plot = False )
144- plt .plot (grid , density , lw = 2 , label = cochlea )
146+ plt .plot (grid , density , lw = 2 , label = cochlea if alias is None else alias [ i ] )
145147
146148 plt .xlabel ("Length [µm]" )
147149 plt .ylabel ("Density [SGN/µm]" )
@@ -163,7 +165,7 @@ def compare_cochleae(cochleae, animal, plot_density=True, plot_tonotopy=True):
163165
164166 band_to_x = {band : i for i , band in enumerate (bin_labels )}
165167 x_positions = bin_labels .map (band_to_x )
166- ax .scatter (x_positions , binned_counts , marker = "o" , label = cochlea , s = 80 )
168+ ax .scatter (x_positions , binned_counts , marker = "o" , s = 80 , label = cochlea if alias is None else alias [ i ] )
167169
168170 ax .set_xticks (range (len (bin_labels )))
169171 ax .set_xticklabels (bin_labels )
@@ -228,18 +230,19 @@ def compare_cochlea_groups(cochlea_groups, animal, plot_density=True, plot_tonot
228230 plt .show ()
229231
230232
231- # The visualization has to be improved to make plots understandable.
232- def main ():
233- # check_implementation()
234-
233+ def density_analysis_gerbil ():
235234 # Comparison for Gerbil.
236- # cochleae = ["G_EK_000233_L", "G_EK_000049_L", "G_EK_000049_R"]
237- # compare_cochleae(cochleae, animal="gerbil", plot_density=True)
235+ cochleae = ["G_EK_000233_L" , "G_EK_000049_L" , "G_EK_000049_R" ]
236+ alias = ["G_1L" , "G_2L" , "G_2R" ]
237+ compare_cochleae (cochleae , animal = "gerbil" , plot_density = True , alias = alias )
238+
238239
240+ def density_analysis_mice ():
239241 # Comparison for Mouse.
242+ # This is for Aleyna's SFN talk.
243+
240244 # NOTE: There is some problem with M_LR_000143_L and "M_LR_000153_L"
241245 # I have removed the corresponding pairs for now, but we should investigate and add back.
242-
243246 # Healthy reference cochleae.
244247 reference_cochleae = [
245248 "M_LR_000226_L" , "M_LR_000226_R" , "M_LR_000227_L" , "M_LR_000227_R" ,
@@ -262,5 +265,12 @@ def main():
262265 )
263266
264267
268+ # The visualization has to be improved to make plots understandable.
269+ def main ():
270+ # check_implementation()
271+ density_analysis_gerbil ()
272+ # density_analysis_mice()
273+
274+
265275if __name__ == "__main__" :
266276 main ()
0 commit comments