Skip to content

Commit f3cff52

Browse files
committed
Hotfix for Mephysto import
1 parent 3fa38e9 commit f3cff52

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

topasgraphsim/src/classes/ptw_import.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def __init__(self, filepath, plotlist, options):
7474
)
7575
== True
7676
):
77-
axes["INPLANE_PROFILE"] = line.split("=")[-1][0]
77+
axes["INPLANE_PROFILE"] = line.split("=")[-1].strip()
7878
elif (
7979
bool(
8080
re.match(
@@ -83,7 +83,7 @@ def __init__(self, filepath, plotlist, options):
8383
)
8484
== True
8585
):
86-
axes["CROSSPLANE_PROFILE"] = line.split("=")[-1][0]
86+
axes["CROSSPLANE_PROFILE"] = line.split("=")[-1].strip()
8787
elif (
8888
bool(
8989
re.match(
@@ -92,16 +92,15 @@ def __init__(self, filepath, plotlist, options):
9292
)
9393
== True
9494
):
95-
axes["PDD"] = line.split("=")[-1][0]
95+
axes["PDD"] = line.split("=")[-1].strip()
9696

9797
elif "SCAN_CURVETYPE" in line:
9898
direction = axes[line.split("=")[-1][:-1]]
99-
if direction == "x":
100-
direction = "X"
101-
elif direction == "y":
102-
direction = "Y"
103-
elif direction == "z":
104-
direction = "Z"
99+
if direction not in "xyzXYZ":
100+
rev_axes = {v: k for k, v in axes.items()}
101+
direcs = {"INPLANE_PROFILE":"X", "CROSSPLANE_PROFILE":"Y", "PDD":"Z"}
102+
103+
direction = direcs[rev_axes[direction]]
105104

106105
if "BEGIN_DATA" in line:
107106
xdata, ydata = [], []
@@ -116,7 +115,6 @@ def __init__(self, filepath, plotlist, options):
116115
unit = ""
117116
direction = ""
118117
axes = {}
119-
120118
self.plots = []
121119
self.frame = ScrollFrame(self.options.tab(Text().data[self.lang]))
122120
theme = ProfileHandler().get_attribute("color_scheme")
@@ -136,11 +134,8 @@ def __init__(self, filepath, plotlist, options):
136134
[var.set(False) for var in self.variables]
137135
textdict = {
138136
"X": f"{self.text.dp[self.lang]}" + " X",
139-
"x": f"{self.text.dp[self.lang]}" + " X",
140137
"Y": f"{self.text.dp[self.lang]}" + " Y",
141-
"y": f"{self.text.dp[self.lang]}" + " Y",
142138
"Z": f"{self.text.pdd[self.lang]}",
143-
"z": f"{self.text.pdd[self.lang]}",
144139
}
145140
self.buttons = [
146141
ctk.CTkCheckBox(

0 commit comments

Comments
 (0)