Skip to content

Commit

Permalink
add single ch result plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
timonmerk committed Sep 12, 2024
1 parent e3fa53d commit 3e60480
Showing 1 changed file with 39 additions and 3 deletions.
42 changes: 39 additions & 3 deletions read_res_decoding_single_ch.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,55 @@

df_all = pd.concat(l_)

plt.figure()
sns.boxplot(data=df_all, x="loc", y="ba", hue="mod", palette="viridis")
plt.figure(figsize=(15, 12))
diseases_ = df_all.dout.unique()
locs_ = df_all["loc"].unique()

for disease_idx, disease in enumerate(diseases_):
for loc_idx, loc_ in enumerate(locs_):
df_disease = df_all[df_all["dout"] == disease]
df_disease = df_disease[df_disease["loc"] == loc_]
plt.subplot(len(diseases_), len(locs_) , len(locs_)*disease_idx + 1 + loc_idx)
sns.boxplot(data=df_disease, x="mod", y="ba", palette="viridis")
plt.title(f"{loc_} {disease}")
#df_disease = df_all[df_all["dout"] == disease]
#plt.subplot(1, len(diseases_), disease_idx + 1)
#sns.boxplot(data=df_all, x="loc", y="ba", hue="mod", palette="viridis")
plt.tight_layout()
plt.show(block=True)

df = pd.read_csv(os.path.join(PATH_, f"out_per_loc_mod_fft.csv"))
# melt the dataframe that all columns with coef_ become a column
df_melt = df.melt(id_vars=["ba", "loc", "sub", "dout"], value_vars=[c for c in df.columns if "coef_" in c])

plt.figure()
plt.figure(figsize=(15, 12))
# melt the dataframe that coef_ becomes a column
sns.boxplot(data=df_melt, x="variable", y="value", palette="viridis")
plt.xticks(rotation=90)
plt.ylabel("Coef")
plt.tight_layout()
plt.show(block=True)

plt.figure(figsize=(15, 12))
for disease_idx, disease in enumerate(diseases_):
for loc_idx, loc_ in enumerate(locs_):
df_disease = df_melt[df_melt["dout"] == disease]
df_disease = df_disease[df_disease["loc"] == loc_]
plt.subplot(len(diseases_), len(locs_) , len(locs_)*disease_idx + 1 + loc_idx)
sns.boxplot(data=df_disease, x="variable", y="value", palette="viridis")
plt.title(f"{loc_} {disease}")
#df_disease = df_all[df_all["dout"] == disease]
#plt.subplot(1, len(diseases_), disease_idx + 1)
#sns.boxplot(data=df_all, x="loc", y="ba", hue="mod", palette="viridis")
plt.tight_layout()
plt.show(block=True)


# .groupby(["sub"]).max()

plt.figure(figsize=(4, 3), dpi=300)
sns.boxplot(data=df.query("loc == 'STN'"), x="dout", y="ba")
sns.swarmplot(data=df.query("loc == 'STN'"), x="dout", y="ba", color="gray", alpha=0.5)
plt.tight_layout()
plt.savefig("STN_per_comp_location.svg")
plt.show(block=True)

0 comments on commit 3e60480

Please sign in to comment.