|
@@ -107,7 +107,7 @@ def plot_baseline_properties(axes, df, markersize, correctionFactor):
|
|
|
twinAx.set_ylim([0, 1.5])
|
|
|
twinAx.patch.set_visible(False)
|
|
|
despine(twinAx, ["top","right", "bottom", "left"], True)
|
|
|
-
|
|
|
+
|
|
|
ax = axes[0]
|
|
|
ax.set_xticks(np.arange(0, 1.1, 0.2))
|
|
|
ax.set_xlim([0, 1.])
|
|
@@ -117,8 +117,9 @@ def plot_baseline_properties(axes, df, markersize, correctionFactor):
|
|
|
ax.set_ylim([0, 60])
|
|
|
ax.set_yticks([0, 20, 40])
|
|
|
ax.set_yticks([0, 10, 20, 30, 40], minor=True)
|
|
|
- ax.yaxis.set_label_coords(-0.28, 0.5)
|
|
|
+ ax.yaxis.set_label_coords(-0.15, 0.5)
|
|
|
|
|
|
+ # firing rate
|
|
|
y_values = df.firing_rate.values
|
|
|
remove_bounds(xPositions.copy(), y_values.copy())
|
|
|
ax = axes[1]
|
|
@@ -135,14 +136,9 @@ def plot_baseline_properties(axes, df, markersize, correctionFactor):
|
|
|
ax.set_xticks(np.arange(0.0, 1.01, 0.2))
|
|
|
ax.set_xticks(np.arange(0.0, 1.0, 0.1), minor=True)
|
|
|
ax.set_xticklabels([])
|
|
|
- ax.yaxis.set_label_coords(-0.35, 0.5)
|
|
|
-
|
|
|
- box_axis = axes[7]
|
|
|
- box_axis.boxplot(y_values, positions=[0.6], widths=[0.2], showfliers=False,
|
|
|
- boxprops=boxprops, whiskerprops=whiskerprops, capprops=capprops)
|
|
|
- box_axis.set_xlim([0.35, 1])
|
|
|
- box_axis.set_ylim(ax.get_ylim())
|
|
|
+ ax.yaxis.set_label_coords(-0.15, 0.5)
|
|
|
|
|
|
+ # CV of the interspike interval
|
|
|
y_values = df.cv.values
|
|
|
ax = axes[2]
|
|
|
plotMeanProperty(ax, posBins, xPositions, y_values)
|
|
@@ -156,14 +152,9 @@ def plot_baseline_properties(axes, df, markersize, correctionFactor):
|
|
|
ax.set_xticks(np.arange(0.0, 1.01, 0.2))
|
|
|
ax.set_xticks(np.arange(0.0, 1.0, 0.1), minor=True)
|
|
|
ax.set_xticklabels([])
|
|
|
- ax.yaxis.set_label_coords(-0.28, 0.5)
|
|
|
-
|
|
|
- box_axis = axes[8]
|
|
|
- box_axis.boxplot(y_values, positions=[0.6], widths=[0.2], showfliers=False,
|
|
|
- boxprops=boxprops, whiskerprops=whiskerprops, capprops=capprops)
|
|
|
- box_axis.set_xlim([0.35, 1])
|
|
|
- box_axis.set_ylim(ax.get_ylim())
|
|
|
+ ax.yaxis.set_label_coords(-0.15, 0.5)
|
|
|
|
|
|
+ # burst fraction
|
|
|
y_values = df.burst_fraction.values
|
|
|
ax = axes[3]
|
|
|
remove_bounds(xPositions.copy(), y_values.copy(), label="burst fraction")
|
|
@@ -178,21 +169,16 @@ def plot_baseline_properties(axes, df, markersize, correctionFactor):
|
|
|
ax.set_xticks(np.arange(0.0, 1.01, 0.2))
|
|
|
ax.set_xticks(np.arange(0.0, 1.0, 0.1), minor=True)
|
|
|
ax.set_xticklabels([])
|
|
|
- ax.yaxis.set_label_coords(-0.35, 0.5)
|
|
|
-
|
|
|
- box_axis = axes[9]
|
|
|
- box_axis.boxplot(y_values, positions=[0.6], widths=[0.2], showfliers=False,
|
|
|
- boxprops=boxprops, whiskerprops=whiskerprops, capprops=capprops)
|
|
|
- box_axis.set_xlim([0.35, 1])
|
|
|
- box_axis.set_ylim(ax.get_ylim())
|
|
|
+ ax.yaxis.set_label_coords(-0.15, 0.5)
|
|
|
|
|
|
+ # Vector strength
|
|
|
y_values = df.vector_strength.values
|
|
|
ax = axes[4]
|
|
|
plotMeanProperty(ax, posBins, xPositions, y_values)
|
|
|
plotLinregress(ax, xPositions, y_values, bonferroni_factor=correctionFactor, feature="vector strength")
|
|
|
ax.scatter(xPositions, y_values, color="tab:blue", s=markersize)
|
|
|
ax.set_ylabel('vector strength', fontsize=7)
|
|
|
- ax.yaxis.set_label_coords(-0.28, 0.5)
|
|
|
+ ax.yaxis.set_label_coords(-0.15, 0.5)
|
|
|
ax.set_ylim(0.6, 1.0)
|
|
|
ax.set_yticks(np.arange(0.6, 1.01, 0.2))
|
|
|
ax.set_yticks(np.arange(0.6, 1.01, 0.1), minor=True)
|
|
@@ -200,44 +186,14 @@ def plot_baseline_properties(axes, df, markersize, correctionFactor):
|
|
|
ax.set_xticks(np.arange(0.0, 1.01, 0.2))
|
|
|
ax.set_xticks(np.arange(0.0, 1.0, 0.1), minor=True)
|
|
|
ax.set_xlabel("receptor position [rel.]", fontsize=7)
|
|
|
- ax.xaxis.set_label_coords(0.5, -0.45)
|
|
|
-
|
|
|
- box_axis = axes[10]
|
|
|
- box_axis.boxplot(y_values, positions=[0.6], widths=[0.2], showfliers=False,
|
|
|
- boxprops=boxprops, whiskerprops=whiskerprops, capprops=capprops)
|
|
|
- box_axis.set_xlim([0.35, 1])
|
|
|
- box_axis.set_ylim(ax.get_ylim())
|
|
|
-
|
|
|
- absolute_positions = df.receptor_pos_absolute.values
|
|
|
- delay_times = df.phase_time.values * 1000
|
|
|
- ax = axes[5]
|
|
|
- ax.scatter(absolute_positions, delay_times, color="tab:blue", s=markersize)
|
|
|
- m, n = plotLinregress(ax, absolute_positions, delay_times, bonferroni_factor=correctionFactor, feature="phase")
|
|
|
- plotMeanProperty(ax, np.linspace(0, 120, 12), absolute_positions, delay_times)
|
|
|
-
|
|
|
- print(f"Inverse slope of delay and position regression: {1./m} mm/ms")
|
|
|
- ax.set_xlim([0, 140])
|
|
|
- ax.set_xticks(range(0, 141, 40), minor=False)
|
|
|
- ax.set_xticks(range(0, 141, 20), minor=True)
|
|
|
- ax.set_ylim([0, 3])
|
|
|
- ax.set_yticks(range(0, 4, 1))
|
|
|
- ax.set_ylabel("delay [ms]", fontsize=7)
|
|
|
- ax.set_xlabel("receptor position [mm]", fontsize=7)
|
|
|
- ax.yaxis.set_major_formatter(FormatStrFormatter('%.1f'))
|
|
|
- ax.yaxis.set_label_coords(-0.35, 0.5)
|
|
|
- ax.xaxis.set_label_coords(0.5, -0.425)
|
|
|
-
|
|
|
- box_axis = axes[11]
|
|
|
- box_axis.boxplot( delay_times[delay_times >= 0], positions=[0.6], widths=[0.2], showfliers=False,
|
|
|
- boxprops=boxprops, whiskerprops=whiskerprops, capprops=capprops)
|
|
|
- box_axis.set_xlim([0.35, 1])
|
|
|
- box_axis.set_ylim(ax.get_ylim())
|
|
|
+ ax.xaxis.set_label_coords(0.5, -0.35)
|
|
|
|
|
|
|
|
|
def plot_driven_properties(axes, df, markersize, correctionFactor):
|
|
|
xPositions = df.receptor_pos_relative.values
|
|
|
posBins = np.linspace(0, 1, 10)
|
|
|
|
|
|
+ # response modulation
|
|
|
y_values = df.response_modulation.values
|
|
|
ax = axes[0]
|
|
|
ax.scatter(xPositions, y_values, color="tab:blue", s=markersize)
|
|
@@ -250,13 +206,9 @@ def plot_driven_properties(axes, df, markersize, correctionFactor):
|
|
|
ax.set_yticks(np.arange(0, 301, 100))
|
|
|
ax.set_yticks(np.arange(0, 300, 50), minor=True)
|
|
|
ax.set_ylabel("modulation [Hz]", fontsize=7)
|
|
|
- ax.yaxis.set_label_coords(-0.35, 0.5)
|
|
|
- box_axis = axes[6]
|
|
|
- box_axis.boxplot(y_values, positions=[0.6], widths=[0.2], showfliers=False,
|
|
|
- boxprops=boxprops, whiskerprops=whiskerprops, capprops=capprops)
|
|
|
- box_axis.set_xlim([0.35, 1])
|
|
|
- box_axis.set_ylim(ax.get_ylim())
|
|
|
+ ax.yaxis.set_label_coords(-0.15, 0.5)
|
|
|
|
|
|
+ # response variability
|
|
|
y_values = df.response_variability.values
|
|
|
ax = axes[1]
|
|
|
ax.scatter(xPositions, y_values, color="tab:blue", s=markersize)
|
|
@@ -269,13 +221,9 @@ def plot_driven_properties(axes, df, markersize, correctionFactor):
|
|
|
ax.set_yticks(np.arange(0, 301, 100))
|
|
|
ax.set_yticks(np.arange(0, 300, 50), minor=True)
|
|
|
ax.set_ylabel("variability [Hz]", fontsize=7)
|
|
|
- ax.yaxis.set_label_coords(-0.28, 0.5)
|
|
|
- box_axis = axes[7]
|
|
|
- box_axis.boxplot(y_values, positions=[0.6], widths=[0.2], showfliers=False,
|
|
|
- boxprops=boxprops, whiskerprops=whiskerprops, capprops=capprops)
|
|
|
- box_axis.set_xlim([0.35, 1])
|
|
|
- box_axis.set_ylim(ax.get_ylim())
|
|
|
+ ax.yaxis.set_label_coords(-0.15, 0.5)
|
|
|
|
|
|
+ # lower and upper cutoff
|
|
|
ax = axes[2]
|
|
|
ax.scatter(xPositions, df.gain_cutoff_lower.values, color="tab:blue", s=markersize)
|
|
|
plotLinregress(ax, xPositions, df.gain_cutoff_lower.values, correctionFactor, color="tab:blue", label="lower", feature="lower cutoff")
|
|
@@ -290,38 +238,11 @@ def plot_driven_properties(axes, df, markersize, correctionFactor):
|
|
|
ax.set_yticks(np.arange(0, 301, 100))
|
|
|
ax.set_yticks(np.arange(0, 300, 50), minor=True)
|
|
|
ax.set_ylabel("cutoff [Hz]", fontsize=7)
|
|
|
- ax.yaxis.set_label_coords(-0.35, 0.5)
|
|
|
- box_axis = axes[8]
|
|
|
- box_axis.boxplot(df.gain_cutoff_lower.values, boxprops=boxprops, whiskerprops=whiskerprops,
|
|
|
- capprops=capprops, positions=[0.45], widths=[0.2], showfliers=False)
|
|
|
- box_axis.boxplot(df.gain_cutoff_upper.values, positions=[0.75], widths=[0.2],
|
|
|
- boxprops={"color": "tab:red","linewidth": 0.75},
|
|
|
- whiskerprops={"color": "tab:red","linewidth": 0.75},
|
|
|
- capprops={"color": "tab:red","linewidth": 0.75}, showfliers=False)
|
|
|
- box_axis.set_xlim([0.30, 1])
|
|
|
- box_axis.set_ylim(ax.get_ylim())
|
|
|
-
|
|
|
- ax = axes[3]
|
|
|
- y_values = df.gain_pass_band.values
|
|
|
- ax.scatter(xPositions, y_values , color="tab:blue", s=markersize)
|
|
|
- plotLinregress(ax, xPositions, y_values, correctionFactor, color="tab:red",feature="width")
|
|
|
- plotMeanProperty(ax, posBins, xPositions, y_values)
|
|
|
- ax.set_xticks(np.arange(0, 1.1, 0.2))
|
|
|
- ax.set_xticks(np.arange(0, 1.01, 0.1), minor=True)
|
|
|
- ax.set_xticklabels([])
|
|
|
- ax.set_ylim([0, 200])
|
|
|
- ax.set_yticks(np.arange(0, 201, 100))
|
|
|
- ax.set_yticks(np.arange(0, 201, 50), minor=True)
|
|
|
- ax.set_ylabel("width [Hz]", fontsize=7)
|
|
|
- ax.yaxis.set_label_coords(-0.28, 0.5)
|
|
|
- box_axis = axes[9]
|
|
|
- box_axis.boxplot(y_values, positions=[0.6], widths=[0.2], showfliers=False, boxprops=boxprops,
|
|
|
- whiskerprops=whiskerprops, capprops=capprops,)
|
|
|
- box_axis.set_xlim([0.35, 1])
|
|
|
- box_axis.set_ylim(ax.get_ylim())
|
|
|
+ ax.yaxis.set_label_coords(-0.15, 0.5)
|
|
|
|
|
|
+ # maximum gain
|
|
|
y_values = df.gain_maximum.values / 1000 # convert ot kHz/mV
|
|
|
- ax = axes[4]
|
|
|
+ ax = axes[3]
|
|
|
ax.scatter(xPositions, y_values, color="tab:blue", s=markersize)
|
|
|
plotLinregress(ax, xPositions, y_values, correctionFactor, color="tab:red", feature="gain")
|
|
|
plotMeanProperty(ax, posBins, xPositions, y_values)
|
|
@@ -332,17 +253,12 @@ def plot_driven_properties(axes, df, markersize, correctionFactor):
|
|
|
ax.set_yticks(np.arange(0, 4.1, 2))
|
|
|
ax.set_yticks(np.arange(0, 4.1, 1), minor=True)
|
|
|
ax.set_ylabel("gain [kHz/mV]", fontsize=7)
|
|
|
- ax.yaxis.set_label_coords(-0.35, 0.5)
|
|
|
+ ax.yaxis.set_label_coords(-0.15, 0.5)
|
|
|
ax.yaxis.set_major_formatter(FormatStrFormatter('%.1f'))
|
|
|
- box_axis = axes[10]
|
|
|
- box_axis.boxplot(y_values, positions=[0.6], widths=[0.2], showfliers=False,
|
|
|
- boxprops=boxprops, whiskerprops=whiskerprops, capprops=capprops)
|
|
|
- box_axis.set_xlim([0.35, 1])
|
|
|
- box_axis.set_ylim(ax.get_ylim())
|
|
|
|
|
|
+ # mututal information
|
|
|
y_values = df.mi.values
|
|
|
-
|
|
|
- ax = axes[5]
|
|
|
+ ax = axes[4]
|
|
|
ax.scatter(xPositions, y_values, color="tab:blue", s=markersize)
|
|
|
plotLinregress(ax, xPositions, y_values, correctionFactor, color="tab:red", feature="mutual info.")
|
|
|
plotMeanProperty(ax, posBins, xPositions, y_values)
|
|
@@ -353,52 +269,37 @@ def plot_driven_properties(axes, df, markersize, correctionFactor):
|
|
|
ax.set_yticks(np.arange(0, 601, 100), minor=True)
|
|
|
ax.set_ylabel("mutual info. [bit/s]", fontsize=7)
|
|
|
ax.set_xlabel("receptor position [rel.]", fontsize=7)
|
|
|
- ax.yaxis.set_label_coords(-0.28, 0.5)
|
|
|
+ ax.yaxis.set_label_coords(-0.15, 0.5)
|
|
|
ax.yaxis.set_major_formatter(FormatStrFormatter('%i'))
|
|
|
- ax.xaxis.set_label_coords(0.5, -0.425)
|
|
|
- box_axis = axes[11]
|
|
|
- box_axis.boxplot(y_values, positions=[0.6], widths=[0.2], showfliers=False,
|
|
|
- boxprops=boxprops, whiskerprops=whiskerprops, capprops=capprops)
|
|
|
- box_axis.set_xlim([0.35, 1])
|
|
|
- box_axis.set_ylim(ax.get_ylim())
|
|
|
+ ax.xaxis.set_label_coords(0.5, -0.35)
|
|
|
|
|
|
|
|
|
def layout_figure():
|
|
|
- driven_axes = list(range(12))
|
|
|
- baseline_axes = list(range(12))
|
|
|
+ baseline_subfig_labels = ["A", "B", "C", "D", "E"]
|
|
|
+ driven_subfig_labels = ["F", "G", "H", "I", "J"]
|
|
|
+ subplots_per_col = max([len(baseline_subfig_labels), len(driven_subfig_labels)])
|
|
|
|
|
|
- fig = plt.figure(figsize=(5.7, 5.0))
|
|
|
- subfigs = fig.subfigures(1, 2, wspace=0.07)
|
|
|
- gr = gridspec.GridSpec(25, 2, width_ratios=[3, 1], wspace=0.0)
|
|
|
+ driven_axes = list(range(len(baseline_subfig_labels)))
|
|
|
+ baseline_axes = list(range(len(driven_subfig_labels)))
|
|
|
|
|
|
- baseline_subfig_labels = ["A", "B", "C", "D", "E", "F"]
|
|
|
- driven_subfig_labels = ["G", "H", "I", "J", "K", "L"]
|
|
|
- subplots_per_col = max([len(baseline_subfig_labels), len(driven_subfig_labels)])
|
|
|
+ fig = plt.figure(figsize=(5.7, 5.5))
|
|
|
+ subfigs = fig.subfigures(1, 2, wspace=0.05)
|
|
|
+ gr = gridspec.GridSpec(subplots_per_col, 1, hspace=0.5)
|
|
|
|
|
|
for i in range(subplots_per_col):
|
|
|
- if i < subplots_per_col-1:
|
|
|
- rowstart = i * subplots_per_col // 2 + i
|
|
|
- rowend = rowstart + subplots_per_col // 2
|
|
|
- else:
|
|
|
- rowstart = i * subplots_per_col // 2 + i + 1
|
|
|
- rowend = rowstart + subplots_per_col // 2
|
|
|
baseline_label = baseline_subfig_labels[i]
|
|
|
driven_label = driven_subfig_labels[i]
|
|
|
- baseline_axes[i] = subfigs[0].add_subplot(gr[rowstart:rowend, 0])
|
|
|
- baseline_axes[subplots_per_col + i] = subfigs[0].add_subplot(gr[rowstart:rowend, 1])
|
|
|
- driven_axes[i] = subfigs[1].add_subplot(gr[rowstart:rowend, 0])
|
|
|
- driven_axes[subplots_per_col + i] = subfigs[1].add_subplot(gr[rowstart:rowend, 1])
|
|
|
+ baseline_axes[i] = subfigs[0].add_subplot(gr[i, 0])
|
|
|
+ driven_axes[i] = subfigs[1].add_subplot(gr[i, 0])
|
|
|
|
|
|
- baseline_axes[i].text(-0.5, 1.0, baseline_label, fontsize=subfig_labelsize, fontweight=subfig_labelweight,
|
|
|
+ baseline_axes[i].text(-0.225, 1.05, baseline_label, fontsize=subfig_labelsize, fontweight=subfig_labelweight,
|
|
|
transform=baseline_axes[i].transAxes, ha="center", va="bottom")
|
|
|
- driven_axes[i].text(-0.55, 1.0, driven_label, fontsize=subfig_labelsize, fontweight=subfig_labelweight,
|
|
|
+ driven_axes[i].text(-0.225, 1.05, driven_label, fontsize=subfig_labelsize, fontweight=subfig_labelweight,
|
|
|
transform=driven_axes[i].transAxes, ha="center", va="bottom")
|
|
|
despine(baseline_axes[i], ["top", "right"], False)
|
|
|
despine(driven_axes[i], ["top", "right"], False)
|
|
|
- baseline_axes[i + subplots_per_col].axis("off")
|
|
|
- driven_axes[i + subplots_per_col].axis("off")
|
|
|
|
|
|
- pic_ax = subfigs[0].add_axes((0.325, 0.88, 0.5, 0.15))
|
|
|
+ pic_ax = subfigs[0].add_axes((0.095, 0.88, 1.0, 0.155))
|
|
|
if os.path.exists("figures/fishsketch.png"):
|
|
|
img = mpimg.imread("figures/fishsketch.png")
|
|
|
pic_ax.imshow(img)
|
|
@@ -412,6 +313,7 @@ def layout_figure():
|
|
|
def plot_position_correlations(args):
|
|
|
if not os.path.exists(args.driven_frame) or not os.path.exists(args.baseline_frame):
|
|
|
raise ValueError(f"Results data frame(s) not found! ({args.driven_frame} or {args.baseline_frame})")
|
|
|
+
|
|
|
driven_df = pd.read_csv(args.driven_frame, sep=";", index_col=0)
|
|
|
baseline_df = pd.read_csv(args.baseline_frame, sep=";", index_col=0)
|
|
|
markersize = 0.5
|
|
@@ -422,7 +324,7 @@ def plot_position_correlations(args):
|
|
|
print("Driven response:")
|
|
|
plot_driven_properties(driven_axes, driven_df, markersize, correctionFactor=5)
|
|
|
|
|
|
- fig.subplots_adjust(left=0.3, right=0.995, top=0.95, hspace=0.5, wspace=0.7, bottom=0.025 )
|
|
|
+ fig.subplots_adjust(left=0.2, right=0.975, top=0.95, bottom=0.075)
|
|
|
if args.nosave:
|
|
|
plt.show()
|
|
|
else:
|