ASCII
Characters/String
[1]:
from pyfeyn2.feynmandiagram import FeynmanDiagram, Leg, Propagator, Vertex
from pyfeyn2.render.text.ascii import ASCIIRender
from pyfeyn2.render.latex.dot import feynman_adjust_points
[2]:
fd = FeynmanDiagram()
v1 = Vertex("v1")
v2 = Vertex("v2")
v3 = Vertex("v3")
v4 = Vertex("v4")
p1 = Propagator("p1").connect(v2, v1).with_type("fermion")
p2 = Propagator("p2").connect(v1, v3).with_type("fermion")
p3 = Propagator("p3").connect(v3, v2).with_type("fermion")
p4 = Propagator("p4").connect(v4, v3).with_type("gluon")
p5 = Propagator("p5").connect(v4, v2).with_type("gluon")
l1 = Leg("l1").with_target(v1).with_type("gluon").with_incoming().with_xy(-2, 1)
l2 = Leg("l2").with_target(v1).with_type("gluon").with_incoming().with_xy(-2, -1)
l3 = Leg("l3").with_target(v2).with_type("gluon").with_outgoing().with_xy(2, -2)
l4 = Leg("l4").with_target(v3).with_type("gluon").with_outgoing().with_xy(2, 2)
l5 = Leg("l5").with_target(v4).with_type("gluon").with_outgoing().with_xy(2, 1)
l6 = Leg("l6").with_target(v4).with_type("gluon").with_outgoing().with_xy(2, -1)
fd.propagators.extend([p1, p2, p3, p4, p5])
fd.vertices.extend([v1, v2, v3, v4])
fd.legs.extend([l1, l2, l3, l4, l5, l6])
fd= feynman_adjust_points(fd)
[3]:
tfd = ASCIIRender(fd)
s= tfd.render(show=False,height=30,width=80)
print(s)
OO*
OOOOOO
OOOOOO
OOOOO
*OOOO OOOOOO OO*
OOOOOOOOO ----*OOO OOOO
OOOOOOOOOO -->----> | OOOOOOOO OOOO
OOOO*->-- v OOO*OO
OOOOOOO <----<-- | OOOOOOOO OOO
OOOOOOO --<-*OOO OOOO
OOOOOOO OOOOO OOO
*OOO OOOO O*
OOOOO
OOOO
OOOOO
OO*
PDF
[4]:
from pyfeyn2.render.text.asciipdf import ASCIIPDFRender
tfd = ASCIIPDFRender(fd)
tfd.render(show=True,height=30,width=40)
O*
OOO
OOO
OO
*OO OOO O*
OOOO >-*O OO
OOOO ---- | OOOO OO
OO*-> v O*O
OOO ---- | OOOO OO
OOOO <-*O OO
OOO OO OO
*O OO *
OOO
OO
OO
O*
[ ]: