Skip to content

Commit

Permalink
fix #7361 improve grammar for watchpont titles
Browse files Browse the repository at this point in the history
  • Loading branch information
moellep committed Nov 13, 2024
1 parent 10927b1 commit c895c1d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sirepo/template/srw.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
units=["m", "m", "m"],
),
multiElectronAnimation=PKDict(
title="Intensity After {name}, {position} (E={photonEnergyWithUnits})",
title="Intensity {name}, {position} (E={photonEnergyWithUnits})",
filename="res_int_pr_me.dat",
dimensions=3,
),
Expand All @@ -115,7 +115,7 @@
dimensions=2,
),
watchpointReport=PKDict(
title="Intensity After {name}, {position} (E={photonEnergyWithUnits})",
title="Intensity {name}, {position} (E={photonEnergyWithUnits})",
subtitle="{characteristic}",
filename="res_int_pr_se.dat",
dimensions=3,
Expand Down Expand Up @@ -1517,7 +1517,12 @@ def _element_name(sim_in, watchpoint_id):
watchpoint_id = sim_in.models.multiElectronAnimation.get("watchpointId", 0)
for e in sim_in.models.beamline:
if e.id == watchpoint_id:
return e.title
# use "at {title}" unless the watchpoint name contains a common preposition
if re.search(
r"\b(after|at|before|in|near)\b", e.title, re.IGNORECASE
) or re.search(r"\b(pre|post)", e.title, re.IGNORECASE):
return e.title
return f"at {e.title}"
return ""


Expand Down

0 comments on commit c895c1d

Please sign in to comment.