Skip to content

Commit

Permalink
Update to Version 19.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sebasj13 committed Feb 21, 2022
1 parent 9070c1f commit c7bd1e2
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 22 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ keywords:
- GUI
- Python
license: MIT
version: 19.0.0
version: 19.0.1
date-released: '2022-02-20'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="topasgraphsim",
version="19.0.0",
version="19.0.1",
author="Sebastian Schäfer",
author_email="sebastian.schaefer@student.uni-halle.de",
description="GUI to plot the results of a topas simulation",
Expand Down
15 changes: 13 additions & 2 deletions topasgraphsim/src/classes/dose_figure_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,23 @@ def add_plot_data(self, datanames):
if self.plots[0].direction == "Z":
self.half = False

print(self.normvalue)

for plotdata in self.plots:
if self.norm == True:
if self.normvalue == "max":
plotdata.normpoint = max(plotdata.dose[self.half])
elif self.normvalue == "flank":
plotdata.normpoint = max(plotdata.dose[self.half]) * 0.5
elif self.normvalue == "plateau":
plotdata.normpoint = np.average(
[
plotdata.dose[self.half][
len(plotdata.dose[self.half]) // 2
- 5 : len(plotdata.dose[self.half]) // 2
+ 5
]
]
)

else:
plotdata.normpoint = plotdata.dose[self.half][
len(plotdata.dose) // 2
Expand Down
12 changes: 6 additions & 6 deletions topasgraphsim/src/classes/main_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,9 @@ def __init__(self, parent):
command=self.change_normalization,
)
self.normalize_cascade.add_radiobutton(
label=self.text.flank[self.lang],
label=self.text.plateau[self.lang],
variable=self.normvaluemenu,
value="flank",
value="plateau",
command=self.change_normalization,
)
self.normalize_cascade.add_radiobutton(
Expand Down Expand Up @@ -922,8 +922,8 @@ def change_normalization(self):

if self.normvaluemenu.get() == "max":
self.DoseFigureHandler.normvalue = "max"
elif self.normvaluemenu.get() == "flank":
self.DoseFigureHandler.normvalue = "flank"
elif self.normvaluemenu.get() == "plateau":
self.DoseFigureHandler.normvalue = "plateau"
else:
self.DoseFigureHandler.normvalue = "center"

Expand Down Expand Up @@ -1080,10 +1080,10 @@ def show_preview(self):
self.parent.bind("<Down>", lambda boolean: self.change_order(False))

if len(self.DoseFigureHandler.plots) >= 2:
self.normmenu.entryconfig(14, state=tk.DISABLED)
self.normmenu.entryconfig(13, state=tk.DISABLED)

if len(self.DoseFigureHandler.plots) == 2:
self.normmenu.entryconfig(14, state=tk.NORMAL)
self.normmenu.entryconfig(13, state=tk.NORMAL)

if len(self.DoseFigureHandler.plots) > 5:
self.parammenu.entryconfig(0, state=tk.DISABLED)
Expand Down
1 change: 1 addition & 0 deletions topasgraphsim/src/classes/nameandstyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(self, parent, index) -> None:
self.top.overrideredirect(1)

self.top.bind("<Return>", self.submit)
self.top.bind("<Escape>", self.top.destroy)
self.enterlabel = ttk.Label(
self.top, text=Text().changefilename[self.parent.lang]
)
Expand Down
7 changes: 2 additions & 5 deletions topasgraphsim/src/classes/recent_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ def __init__(self, parent):

pop = []
for i, x in enumerate([file[0] for file in self.recent_files]):
if os.path.exists(x) != True:
if os.path.exists(x) == True:
pop.append(i)

for index, i in enumerate(pop):
self.recent_files.pop(i)
if index < len(pop) - 1:
pop[index + 1] -= 1
self.recent_files = [self.recent_files[i] for i in pop]

self.lambdas = [
lambda: self.add_recent_file_to_data(0),
Expand Down
2 changes: 1 addition & 1 deletion topasgraphsim/src/classes/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class CheckForUpdates:
def __init__(self):

currentVersion = "19.0.0"
currentVersion = "19.0.1"
try:
newestVersion = requests.get(
"https://api.github.com/repos/sebasj13/topasgraphsim/releases/latest"
Expand Down
11 changes: 7 additions & 4 deletions topasgraphsim/src/functions/dp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ def calculate_parameters(axis, dose, cax=False):
akima_dose_interpolator = interpolate.Akima1DInterpolator(axis, dose)
interpolated_dose = np.flip(akima_dose_interpolator.__call__(interpolated_axis))

Dose80 = [value for value in dose if value >= 0.8 * max(dose)]

D0 = (
interpolated_dose[int(len(interpolated_dose) / 2)]
+ interpolated_dose[int(len(interpolated_dose) / 2) - 1]
Expand Down Expand Up @@ -74,6 +72,11 @@ def calculate_parameters(axis, dose, cax=False):

HWB = round(abs(XR50 - XL50), 3)
CAXdev = round(XL50 + 0.5 * HWB, 3)

dose = [value + CAXdev for value in dose]

Dose80 = [value for value in dose if value >= 0.8 * max(dose)]

if cax == True:
return CAXdev

Expand All @@ -97,8 +100,8 @@ def calculate_parameters(axis, dose, cax=False):
3,
)

Lpenumbra = round(abs(XL80 - XL20), 3)
Rpenumbra = round(abs(XR80 - XR20), 3)
Lpenumbra = round(abs(XL80 - XL20 + CAXdev), 3)
Rpenumbra = round(abs(XR80 - XR20 + CAXdev), 3)

XL20index = np.where(interpolated_axis == XL20)[0][0]
XL80index = np.where(interpolated_axis == XL80)[0][0]
Expand Down
2 changes: 1 addition & 1 deletion topasgraphsim/src/resources/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, parent, lang, mode):
"de": "TopasGraphSim\n\nAutor: Sebastian Schäfer",
"en": "TopasGraphSim\n\nAuthor: Sebastian Schäfer",
}
version = {"de": "Version: 19.0.0\n ", "en": "Version: 19.0.0\n "}
version = {"de": "Version: 19.0.1\n ", "en": "Version: 19.0.1\n "}

if mode == True:
pic = "light"
Expand Down
2 changes: 1 addition & 1 deletion topasgraphsim/src/resources/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self):
self.errorbars = {"de": "Fehlerbalken anzeigen", "en": "Show error bars"}
self.errlimmenu = {"de": "Fehlergrenze einstellen", "en": "Change error limits"}
self.file = {"de": "Datei", "en": "File"}
self.flank = {"de": "Flanke", "en": "Flank"}
self.plateau = {"de": "Plateau", "en": "Plateau"}
self.fullscreen = {"de": "Vollbild", "en": "Fullscreen"}
self.fwhm = {"de": "HWB", "en": "FWHM"}
self.german = {"de": "Deutsch", "en": "German"}
Expand Down

0 comments on commit c7bd1e2

Please sign in to comment.