Skip to content

Commit 543d828

Browse files
committed
Support new tonotopic mapping of OTOF
1 parent 033d628 commit 543d828

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

scripts/figures/plot_fig6.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
# The cochlea for the CHReef analysis.
2020
COCHLEAE_DICT = {
21-
"LaVision-OTOF23R": {"alias": "01", "component": [4, 18, 7], "color":"#9C5027"},
21+
"LaVision-OTOF23R": {"alias": "01", "component": [4, 18, 7], "color": "#9C5027"},
2222
"LaVision-OTOF25R": {"alias": "02", "component": [1], "color": "#67279C"},
2323
}
2424

@@ -54,7 +54,8 @@ def get_otof_data():
5454
table = table[table.component_labels.isin(component_labels)]
5555
# The relevant values for analysis.
5656
try:
57-
values = table[["label_id", "length[µm]", "frequency[kHz]", "expression_classification"]]
57+
values = table[["label_id", "length[µm]", "frequency[kHz]", "frequency-mueller[kHz]",
58+
"expression_classification"]]
5859
except KeyError:
5960
print("Could not find the values for", cochlea, "it will be skippped.")
6061
continue
@@ -135,7 +136,7 @@ def _get_trendline_params(trend_dict):
135136
return x_values, y_values_center, y_values_upper, y_values_lower
136137

137138

138-
def fig_06e_octave(otof_data, save_path, plot=False, use_alias=True, trendline_mode=None):
139+
def fig_06e_octave(otof_data, save_path, plot=False, use_alias=True, trendline_mode=None, mapping="default"):
139140
prism_style()
140141
label_size = 20
141142
tick_label_size = 14
@@ -150,7 +151,12 @@ def fig_06e_octave(otof_data, save_path, plot=False, use_alias=True, trendline_m
150151
alias = name.replace("_", "").replace("0", "")
151152

152153
color_dict[alias] = COCHLEAE_DICT[name]["color"]
153-
freq = values["frequency[kHz]"].values
154+
if mapping == "default":
155+
freq = values["frequency[kHz]"].values
156+
elif mapping == "mueller":
157+
freq = values["frequency-mueller[kHz]"].values
158+
else:
159+
raise ValueError("Choose either 'default' or 'mueller' for tonotopic mapping.")
154160
marker_labels = values["expression_classification"].values
155161
marker_pos = len([1 for i in marker_labels if i == 1])
156162
marker_neg = len([1 for i in marker_labels if i == 2])
@@ -188,7 +194,7 @@ def fig_06e_octave(otof_data, save_path, plot=False, use_alias=True, trendline_m
188194
}
189195
# central line
190196
if trendline_mode == "filled":
191-
#mean, std = _get_trendline_params(y_values)
197+
# mean, std = _get_trendline_params(y_values)
192198
x_sorted, y_sorted, y_sorted_upper, y_sorted_lower = _get_trendline_params(trend_dict)
193199
trend_center, = ax.plot(
194200
x_sorted,
@@ -282,10 +288,11 @@ def main():
282288
args = parser.parse_args()
283289
plot = False
284290

291+
tonotopic_mapping = "mueller"
285292
otof_data = get_otof_data()
286293
plot_legend_fig06e(save_path=os.path.join(args.figure_dir, f"fig_06e_legend.{FILE_EXTENSION}"))
287294
fig_06e_octave(otof_data, save_path=os.path.join(args.figure_dir, f"fig_06e.{FILE_EXTENSION}"), plot=plot,
288-
trendline_mode="mean")
295+
trendline_mode="mean", mapping=tonotopic_mapping)
289296

290297
# fig_06d(save_path=os.path.join(args.figure_dir, f"fig_06d.{FILE_EXTENSION}"), plot=plot)
291298

0 commit comments

Comments
 (0)