Skip to content

Commit 82f7036

Browse files
Update alias in density and volume scripts
1 parent 76b6699 commit 82f7036

File tree

2 files changed

+34
-20
lines changed

2 files changed

+34
-20
lines changed

scripts/measurements/density_analysis.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
265275
if __name__ == "__main__":
266276
main()

scripts/measurements/volume_analysis.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ def compute_ihc_volumes_lavision():
9797

9898
def compare_sgn_volumes():
9999
cochleae_flamingo = ["M_LR_000226_L", "M_LR_000226_R", "M_LR_000227_L", "M_LR_000227_R"]
100+
alias_flamingo = ["M_01L", "M_01LR", "M_02L", "M_02R"]
100101
cochleae_lavision = ["LaVision-M02", "LaVision-M03"]
102+
alias_lavision = ["LV_M_01", "LV_M_02"]
101103

102104
folder_flamingo = "./data/volumes_flamingo"
103105
folder_lavision = "./data/volumes_lavision"
@@ -119,19 +121,21 @@ def compare_sgn_volumes():
119121
fig, axes = plt.subplots(2, sharey=True)
120122

121123
ax = axes[0]
122-
ax.boxplot(data_flamingo, tick_labels=cochleae_flamingo)
124+
ax.boxplot(data_flamingo, tick_labels=alias_flamingo)
123125
ax.set_ylabel("SGN Volume [µm^3]")
124126

125127
ax = axes[1]
126-
ax.boxplot(data_lavision, tick_labels=cochleae_lavision)
128+
ax.boxplot(data_lavision, tick_labels=alias_lavision)
127129
ax.set_ylabel("SGN Volume [µm^3]")
128130

129131
plt.show()
130132

131133

132134
def compare_ihc_volumes():
133135
cochleae_flamingo = ["M_LR_000226_L", "M_LR_000226_R", "M_LR_000227_L", "M_LR_000227_R"]
136+
alias_flamingo = ["M_01L", "M_01LR", "M_02L", "M_02R"]
134137
cochleae_lavision = ["LaVision-M02", "LaVision-M03"]
138+
alias_lavision = ["LV_M_01", "LV_M_02"]
135139

136140
folder_flamingo = "./data/ihc_volumes_flamingo"
137141
folder_lavision = "./data/ihc_volumes_lavision"
@@ -156,23 +160,23 @@ def compare_ihc_volumes():
156160
fig, axes = plt.subplots(2, sharey=True)
157161

158162
ax = axes[0]
159-
ax.boxplot(data_flamingo, tick_labels=cochleae_flamingo)
163+
ax.boxplot(data_flamingo, tick_labels=alias_flamingo)
160164
ax.set_ylabel("IHC Volume [µm^3]")
161165

162166
ax = axes[1]
163-
ax.boxplot(data_lavision, tick_labels=cochleae_lavision)
167+
ax.boxplot(data_lavision, tick_labels=alias_lavision)
164168
ax.set_ylabel("IHC Volume [µm^3]")
165169

166170
plt.show()
167171

168172

169173
def main():
170-
compute_sgn_volumes_flamingo()
171-
compute_sgn_volumes_lavision()
172-
# compare_sgn_volumes()
174+
# compute_sgn_volumes_flamingo()
175+
# compute_sgn_volumes_lavision()
176+
compare_sgn_volumes()
173177

174-
compute_ihc_volumes_flamingo()
175-
compute_ihc_volumes_lavision()
178+
# compute_ihc_volumes_flamingo()
179+
# compute_ihc_volumes_lavision()
176180
compare_ihc_volumes()
177181

178182

0 commit comments

Comments
 (0)