Skip to content

Commit

Permalink
add more proton baryon
Browse files Browse the repository at this point in the history
  • Loading branch information
APN-Pucky committed Oct 26, 2023
1 parent 46a7d65 commit 98a8f5f
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 18 deletions.
14 changes: 7 additions & 7 deletions debug/proton_baryon_meson.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyfeyn2/render/latex/tikzfeynman.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def stylize_connect(fd: FeynmanDiagram, c: Connector):
double_distance = (
style.getProperty("double-distance").value
if style.getProperty("double-distance") is not None
else "3pt"
)
else "3"
) + "pt"
rets = []
frets = []
if style.getProperty("line") is not None:
Expand Down
30 changes: 21 additions & 9 deletions pyfeyn2/render/mpl/feynmanrender.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,29 @@
{"style": "wiggly"},
{"style": "simple"},
],
"meson": [{"style": "double"}],
"baryon": [
{"style": "simple", "zorder": -2, "linewidth": 8.0},
{"style": "simple", "zorder": -1, "linewidth": 4.0, "color": "w"},
{"style": "simple", "zorder": 0, "linewidth": 2.0},
],
"anti baryon": [
{"style": "simple", "zorder": -2, "linewidth": 8.0},
{"style": "simple", "zorder": -1, "linewidth": 4.0, "color": "w"},
{"style": "simple", "zorder": 0, "linewidth": 2.0},
],
"phantom": [{"style": "simple", "alpha": 0.0}],
}


def get_styled_lines(fd: FeynmanDiagram, p: Union[Propagator, Leg]) -> List[dict]:
ret = []
style = fd.get_style(p)
double_distance = float(
style.getProperty("double-distance").value
if style.getProperty("double-distance") is not None
else "3"
)
if style.getProperty("line") is not None:
lname = style.getProperty("line").value
else:
Expand All @@ -58,18 +74,14 @@ def get_styled_lines(fd: FeynmanDiagram, p: Union[Propagator, Leg]) -> List[dict
d["arrow"] = False
else:
d["arrow"] = False
if d["style"] == "double":
d["linewidth"] = double_distance
# copy css style to feynman kwargs dict
for k in [
"xamp",
"yamp",
]:
if style.getProperty(k) is not None:
d[k] = float(style.getProperty(k).value)
for k in ["nloops"]:
if style.getProperty(k) is not None:
for k in ["xamp", "yamp", "nloops"]:
if style.getProperty(k) is not None and k not in d:
d[k] = float(style.getProperty(k).value)
for k in ["color"]:
if style.getProperty(k) is not None:
if style.getProperty(k) is not None and k not in d:
d[k] = style.getProperty(k).value
ret.append(d)
return ret
Expand Down
46 changes: 46 additions & 0 deletions pyfeyn2/render/text/ascii.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,49 @@ def __init__(self, **kwargs):
)


class Baryon(ASCIILine):
def __init__(self, **kwargs):
super().__init__(
begin="*",
end="*",
style=Cross(
left="BB<BB",
right="BB>BB",
up="BB^BB",
down="BBvBB",
),
**kwargs,
)


class AntiBaryon(ASCIILine):
def __init__(self, **kwargs):
super().__init__(
begin="*",
end="*",
style=Cross(
left="BB>BB",
right="BB<BB",
up="BBvBB",
down="BB^BB",
),
**kwargs,
)


class Meson(ASCIILine):
def __init__(self, **kwargs):
super().__init__(
begin="*",
end="*",
style=Cross(
vert="M",
horz="M",
),
**kwargs,
)


class Gluino(ASCIILine):
def __init__(self, **kwargs):
super().__init__(
Expand Down Expand Up @@ -159,6 +202,9 @@ class ASCIIRender(Render):
"gluino": Gluino,
"gaugino": Gaugino,
"phantom": Phantom,
"baryon": Baryon,
"anti baryon": Baryon,
"meson": Meson,
"line": Line,
# TODO what is this?
"label": Label,
Expand Down

0 comments on commit 98a8f5f

Please sign in to comment.