Skip to content

Commit ec95398

Browse files
committed
Added cax correction
1 parent ae8f6d7 commit ec95398

9 files changed

Lines changed: 39 additions & 19 deletions

File tree

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ keywords:
1919
- GUI
2020
- Python
2121
license: MIT
22-
version: 23.0.2
23-
date-released: '2023-03-21'
22+
version: 23.1.0
23+
date-released: '2023-03-25'

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="topasgraphsim",
8-
version="23.0.2",
8+
version="23.1.0",
99
author="Sebastian Schäfer",
1010
author_email="sebastian.schaefer@student.uni-halle.de",
1111
description="GUI to analyze the results of a Monte-Carlo radiation simulation",

topasgraphsim/src/classes/options.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ def __init__(self, parent, index, lang):
5959
self.dataframe2.pack_propagate(False)
6060
self.dataframe2.columnconfigure(0, weight=1, minsize=144)
6161
self.dataframe2.columnconfigure(1, weight=1)
62-
self.dataframe2.rowconfigure(1, weight=1)
63-
self.dataframe2.rowconfigure(5, weight=1)
62+
6463

6564
self.graphlist = ScrollFrame(self.dataframe1)
6665
path = os.path.join(os.path.dirname(os.path.abspath(__file__)),"..","resources", "images")
@@ -76,26 +75,31 @@ def __init__(self, parent, index, lang):
7675
self.graphlist.grid(column=0, row=0, rowspan=5, sticky="nsew", padx=5, pady=5)
7776

7877
self.load_topas_button = ctk.CTkButton(self.dataframe2, text = Text().loadsim[self.lang], command = self.load_topas, width=20)
79-
self.load_topas_button.grid(row=0, column=0, sticky="nsew", pady=5, padx=5)
78+
self.load_topas_button.grid(row=0, column=0, sticky="nsew", pady=(5,2), padx=5)
8079

8180
self.load_mcc_button = ctk.CTkButton(self.dataframe2, text = Text().loadmeasurement[self.lang], command = self.load_measurement, width=20)
82-
self.load_mcc_button.grid(row=0, column=1, sticky="nsew", padx=5, pady=5)
81+
self.load_mcc_button.grid(row=0, column=1, sticky="nsew", padx=5, pady=(5,2))
8382

8483
self.normalize=ctk.BooleanVar(value=self.p.get_attribute("normalize"))
8584
normtypedict = {"maximum":Text().maximum[self.lang], "plateau":Text().plateau[self.lang], "centeraxis":Text().centeraxis[self.lang]}
8685
self.normalization = ctk.StringVar(value=normtypedict[self.p.get_attribute("normtype")])
8786
self.normalize_button = ctk.CTkCheckBox(self.dataframe2, text=Text().normalize[self.lang], variable=self.normalize, command=self.change_normalization, font=("Bahnschrift", 12, "bold"))
8887
self.normalize_options = ctk.CTkOptionMenu(self.dataframe2, values=[Text().maximum[self.lang], Text().plateau[self.lang], Text().centeraxis[self.lang]], variable=self.normalization, command=self.change_normalization)
89-
self.normalize_button.grid(row=2, column=0, sticky="nsew", pady=5, padx=5)
90-
self.normalize_options.grid(row=2, column=1, sticky="ew", pady=5, padx=5)
88+
self.normalize_button.grid(row=2, column=0, sticky="nsew", pady=2, padx=5)
89+
self.normalize_options.grid(row=2, column=1, sticky="ew", pady=2, padx=5)
90+
91+
self.caxcorrection = ctk.BooleanVar(value=self.p.get_attribute("caxcorrection"))
92+
93+
self.cax_button = ctk.CTkCheckBox(self.dataframe2, text=Text().caxcorrection[self.lang], variable=self.caxcorrection, onvalue=True, offvalue=False, command = self.toggle_cax_correction, font=("Bahnschrift",12, "bold"))
94+
self.cax_button.grid(column=0, columnspan=2, row=3, padx=5, pady=2, sticky = "w")
9195

9296
self.showgrid = ctk.BooleanVar(value=self.p.get_attribute("grid"))
9397

9498
self.gridoptions = ctk.StringVar(value=Text().gridoptions1[self.lang])
9599
self.showgrid_button = ctk.CTkCheckBox(self.dataframe2, text=Text().showgrid[self.lang], variable=self.showgrid, onvalue=True, offvalue=False, command = self.toggle_grid_options, font=("Bahnschrift",12, "bold"))
96100
self.showgrid_options = ctk.CTkOptionMenu(self.dataframe2, variable=self.gridoptions, values=[Text().gridoptions1[self.lang], Text().gridoptions2[self.lang]], command = lambda x: self.toggle_grid_options())
97-
self.showgrid_button.grid(column=0, row=3, padx=5, pady=2, sticky = "w")
98-
self.showgrid_options.grid(column=1, row=3, padx=5, pady=2, sticky = "w")
101+
self.showgrid_button.grid(column=0, row=4, padx=5, pady=2, sticky = "w")
102+
self.showgrid_options.grid(column=1, row=4, padx=5, pady=2, sticky = "w")
99103

100104
self.showlegend = ctk.BooleanVar(value = self.p.get_attribute("legend"))
101105
self.legendoptions = ctk.StringVar(value=Text().legendoptions1[self.lang]) ##
@@ -110,13 +114,13 @@ def __init__(self, parent, index, lang):
110114
Text().legendoptions5[self.lang]],
111115
command = lambda x: self.toggle_legend_options())
112116

113-
self.showlegend_button.grid(column=0, row=4, padx=5, pady=2, sticky="w")
114-
self.showlegend_options.grid(column=1, row=4, padx=5, pady=2, sticky="w")
117+
self.showlegend_button.grid(column=0, row=5, padx=5, pady=2, sticky="w")
118+
self.showlegend_options.grid(column=1, row=5, padx=5, pady=2, sticky="w")
115119

116120
self.change_name_button = ctk.CTkButton(self.dataframe2, text=Text().edittabname[self.lang], command = self.change_name, width=20)
117121
self.close_tab_button = ctk.CTkButton(self.dataframe2, text=Text().closetab1[self.lang], command = lambda: self.parent.master.master.remove_tab(self.parent.master.master.tabnames.index(self.parent.name)), width=20, fg_color="red")
118-
self.close_tab_button.grid(row=6, column=1, sticky="nsew", pady=5, padx=5)
119-
self.change_name_button.grid(row=6, column=0, sticky="nsew", pady=5, padx=5)
122+
self.close_tab_button.grid(row=6, column=1, sticky="new", pady=(5,2), padx=5)
123+
self.change_name_button.grid(row=6, column=0, sticky="new", pady=(5,2), padx=5)
120124

121125

122126
#######################################################################################################################
@@ -432,7 +436,12 @@ def remove_plot(self):
432436
if len(self.parent.plots) == 0:
433437
self.disable_all_buttons()
434438
self.parent.update()
435-
439+
440+
def toggle_cax_correction(self, event=None):
441+
self.parent.saved = False
442+
for plot in self.parent.plots:
443+
plot.caxcorrection = self.caxcorrection.get()
444+
self.parent.update()
436445

437446
def change_normalization(self, event=None):
438447
self.parent.saved = False

topasgraphsim/src/classes/settings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def __init__(self, parent, name, index, lang):
9797
self.axshift = ctk.StringVar(value= "0")
9898
self.dosescale = ctk.StringVar(value="1")
9999
self.flip = ctk.BooleanVar(value=False)
100+
self.caxcorrection = ctk.BooleanVar(value=self.p.get_attribute("caxcorrection"))
100101

101102
self.linethicknesslabel = ctk.CTkLabel(self.plotframe, text=Text().linethickness[self.lang], font=("Bahnschrift",16))
102103
self.linethicknesslabel.grid(column=0, row=1, padx=5, pady=5, sticky="w")
@@ -121,6 +122,7 @@ def __init__(self, parent, name, index, lang):
121122
self.axshift = ctk.StringVar(value=self.p.get_attribute("axshift"))
122123
self.axshiftentry = ctk.CTkEntry(self.plotframe, textvariable=self.axshift, width=130)
123124
self.flipbutton = ctk.CTkCheckBox(self.plotframe, variable=self.flip, text=Text().flip[self.lang], font=("Bahnschrift",16))
125+
self.caxbutton = ctk.CTkCheckBox(self.plotframe, variable=self.caxcorrection, text=Text().cax[self.lang], font=("Bahnschrift",16))
124126

125127
self.dosescalelabel.grid(column=0, row=3, padx=5, pady=5, sticky="w")
126128
self.dosescaleentry.grid(column=1, row=3, padx=5, pady=5, sticky="nsew")
@@ -129,6 +131,7 @@ def __init__(self, parent, name, index, lang):
129131
self.axshiftlabel.grid(column=0, row=5, padx=5, pady=5, sticky="w")
130132
self.axshiftentry.grid(column=1, row=5, padx=5, pady=5, sticky="nsew")
131133
self.flipbutton.grid(column=0, row=6, columnspan=2, padx=5, pady=5, sticky="nsew")
134+
self.caxbutton.grid(column=0, row=7, columnspan=2, padx=5, pady=5, sticky="nsew")
132135

133136

134137
############################
@@ -197,6 +200,7 @@ def save(self):
197200
try: self.p.set_attribute("axshift", float(self.axshift.get()))
198201
except ValueError: pass
199202
self.p.set_attribute("flip", self.flip.get())
203+
self.p.set_attribute("caxcorrection", self.caxcorrection.get())
200204

201205
self.p.set_attribute("gammatype", self.gammatype.get())
202206
self.p.set_attribute("dd", self.percent.get())
@@ -224,6 +228,7 @@ def reset(self):
224228
self.doseshift.set(self.p.get_attribute("doseoffset"))
225229
self.axshift.set(self.p.get_attribute("axshift"))
226230
self.flip.set(self.p.get_attribute("flip"))
231+
self.caxcorrection.set(self.p.get_attribute("caxcorrection"))
227232

228233
self.gammatype.set(self.p.get_attribute("gammatype"))
229234
self.percent.set(self.p.get_attribute("dd"))

topasgraphsim/src/classes/tab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(self, parent, name, index, lang):
4343
self.navbar.grid(row=1, column=0, sticky="nsew")
4444

4545
def config(self, event=None):
46-
self.figure.subplots_adjust(left=0.08, right=0.92, top=0.92, bottom=0.1, wspace=0.2, hspace=0.2)
46+
self.figure.subplots_adjust(left=0.09, right=0.92, top=0.92, bottom=0.1, wspace=0.2, hspace=0.2)
4747

4848
def update(self):
4949
self.ax.clear()

topasgraphsim/src/classes/tgs_graph.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def __init__(self, Options, ImportedData):
1313
self.p = ProfileHandler()
1414

1515
self.normalize = self.p.get_attribute("normalize")
16+
self.caxcorrection = self.p.get_attribute("caxcorrection")
1617
self.normalization = self.p.get_attribute("normtype")
1718
self.points = self.p.get_attribute("show_points")
1819
self.error = self.p.get_attribute("show_error")
@@ -76,6 +77,10 @@ def data(self):
7677
def plot(self, ax):
7778

7879
axis, dose, error = self.data()
80+
if self.caxcorrection:
81+
if self.direction != "Z":
82+
axis = np.add(axis, self.dataObject.params()[1])
83+
7984
if self.error:
8085
ax.errorbar(axis, dose, label="_", yerr=error, fmt="none", ecolor="red", elinewidth=0.625, capsize=1.25, capthick=0.25)
8186
ax.plot(axis, dose, label=self.label, lw=self.linethickness, color=self.linecolor, linestyle = self.linestyle)

topasgraphsim/src/classes/update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class CheckForUpdates:
1010
def __init__(self):
1111

12-
currentVersion = "23.0.2"
12+
currentVersion = "23.1.0"
1313
try:
1414
newestVersion = requests.get(
1515
"https://api.github.com/repos/sebasj13/topasgraphsim/releases/latest"

topasgraphsim/src/resources/profile.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"grid": true,
1111
"legend": true,
1212
"normalize": true,
13+
"caxcorrection": true,
1314
"normtype": "maximum",
1415
"show_points": false,
1516
"show_error": true,

topasgraphsim/topasgraphsim.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self):
2525
super().__init__()
2626

2727
self.appname = "TopasGraphSim"
28-
self.version = "23.0.2"
28+
self.version = "23.1.0"
2929
self.author = "Sebastian Schäfer"
3030
self.affiliation = "UK Halle\nMLU Halle-Wittenberg\nUK Hamburg-Eppendorf"
3131
self.title(f"{self.appname} - v.{self.version}")

0 commit comments

Comments
 (0)