Skip to content

Commit

Permalink
spheroid use also common analysis widget
Browse files Browse the repository at this point in the history
  • Loading branch information
rgerum committed Dec 29, 2023
1 parent 3f66fb4 commit 35f7c00
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 1,043 deletions.
27 changes: 18 additions & 9 deletions saenopy/gui/common/plot_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self, parent=None):
super().__init__(parent)

# QSettings
self.settings = QtCore.QSettings("Saenopy", "Saenopy")
self.settings = QtCore.QSettings("Saenopy", self.settings_key)

self.setMinimumWidth(800)
self.setMinimumHeight(400)
Expand Down Expand Up @@ -221,7 +221,8 @@ def check_results_with_time(self):
print("time_values", time_values)
if time_values is False:
self.barplot()
self.agg.setEnabled(time_values)
if getattr(self, "agg", None) is not None:
self.agg.setEnabled(time_values)
self.button_run.setEnabled(time_values)
self.button_run2.setEnabled(time_values)

Expand Down Expand Up @@ -288,13 +289,16 @@ def barplot(self):
# get all the data as a pandas dataframe
res = self.getAllCurrentPandasData()

# limit the dataframe to the comparison time
res0 = res.groupby("filename").agg("max")
del res["group"]
res = res.groupby("filename").agg(self.agg.value())
res["group"] = res0["group"]
#index = self.get_comparison_index()
#res = res[res.index == index]
if getattr(self, "agg", None) is not None:
# limit the dataframe to the comparison time
res0 = res.groupby("filename").agg("max")
del res["group"]
res = res.groupby("filename").agg(self.agg.value())
res["group"] = res0["group"]
else:
# limit the dataframe to the comparison time
index = self.get_comparison_index()
res = res[res.index == index]

code_data = [res, ["group", mu_name]]

Expand Down Expand Up @@ -340,6 +344,11 @@ def plot_groups(self):

code_data = [res, ["t", "group", mu_name, "filename"]]

# add a vertical line where the comparison time is
if getattr(self, "input_tbar", None) and self.input_tbar.value() is not None:
comp_h = self.get_comparison_index() * (res.iloc[1]["t"] - res.iloc[0]["t"])
plt.axvline(comp_h, color="k")

color_dict = {d[0]: d[3] for d in self.data_folders}

def plot(res, mu_name, y_label, color_dict2):
Expand Down
2 changes: 1 addition & 1 deletion saenopy/gui/gui_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def timer():
self.orientation.tabs.setCurrentIndex(1)
self.orientation.plotting_window.load(file)
continue
except:
except (IndexError, KeyError):
continue
if file.endswith(".py"):
self.setTab(6)
Expand Down
Loading

0 comments on commit 35f7c00

Please sign in to comment.