-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Episode 3: Physics - Feynman Diagrams #65
Comments
Thanks for opening your first issue here! If you have any questions, feel free to mention one of the conveners, previous contributors, or attend our weekly meeting (see https://hepsoftwarefoundation.org/workinggroups/training.html). Also, sometimes issues go unnoticed, so don't hesitate to @mention some of us, if we do not come back to you within a few days. |
I have a couple of scripts here (for Higgs-strahlung) https://github.com/amanmdesai/Feynman-Diagrams/blob/master/higgs_strahlung.py or this one if you want to show decays of Higgs https://github.com/amanmdesai/Feynman-Diagrams/blob/master/higgs_cc.py |
Yes Aman, that would be the idea... |
How about adding this: import matplotlib.pyplot as plt
from feynman import Diagram
fig = plt.figure(figsize=(10.,10.))
ax = fig.add_axes([0,0,1,1], frameon=False)
diagram = Diagram(ax)
diagram.text(.5,0.9,"Higgs Strahlung with H -> cc~ and Z decay to l+ l-", fontsize=20)
in1 = diagram.vertex(xy=(.05,.75), marker='') #quark starting point (left up); xy- vertex coordinates (x,y); marker
in2 = diagram.vertex(xy=(.05,.25), marker='') # anti-quark starting point (left down)
v1 = diagram.vertex(xy=(.30,.5)) # Z boson starting point (left)
v2 = diagram.vertex(xy=(.60,.5)) # Z boson starting point (right)
higgsout = diagram.vertex(xy=(.8,.65)) # higgs boson
zhout = diagram.vertex(xy=(.8,.35),marker='') # produced Z boson in association with Higgs
c1 = diagram.vertex(xy=(.9,.75),marker='') # charm quark
c2 = diagram.vertex(xy=(.9,.55),marker='') # charm antiquark
l1 = diagram.vertex(xy=(.9,.25),marker='') # lepton 1
l2 = diagram.vertex(xy=(.9,.45),marker='') # lepton 2
q1 = diagram.line(in1, v1) #quark 1; line joining the points
q2 = diagram.line(v1, in2) #quark 2
wz1 = diagram.line(v1, v2, style='wiggly',nwiggles=6) # wiggles to represent Z boson
wz2 = diagram.line(v2, zhout, style='wiggly',nwiggles=6)
higgs = diagram.line(v2, higgsout, arrow=False, style='dashed') # dashed line to represent the higgs
charm1 = diagram.line(c1,higgsout)
charm2 = diagram.line(higgsout, c2)
lep1 = diagram.line(zhout, l1)
lep2 = diagram.line(zhout, l2)
# Text command adds text near the line
q1.text("q",fontsize=30)
q2.text(r"$\bar{\mathrm{q}}$",fontsize=30)
wz1.text("$Z$",t=0.5,y=0.1,fontsize=30)
wz2.text("$Z$",t=0.5,y=-0.15,fontsize=30)
higgs.text("H",fontsize=30)
charm2.text("c",fontsize=30)
charm1.text(r"$\bar{\mathrm{c}}$",fontsize=30)
lep2.text(r"$\mathcal{l}^{\pm}$",t=0.5,y=0.1,fontsize=30)
lep1.text(r"$\mathcal{l}^{\mp}$",t=0.5,y=-0.1,fontsize=30)
diagram.scale(0.6)
diagram.plot()
plt.savefig('zh_hcc.eps', format='eps') Here is the code with comments https://github.com/amanmdesai/Feynman-Diagrams/blob/master/higgs_ZH_production_hcc.py |
That looks great Aman. I think it is important to make everything clear, as much as we can. I don't know if you have had any problem with that, but in my case Feynman runs with python 2. |
I am using Python 3.10.4 |
Hi @amanmdesai @amorenobr Thanks a lot for starting this! I think we were discussing this a long time ago in one of our training meetings. I'm a bit wary of pushing too many "walls of code" on the students and I think that this will be more of a special use case of matplotlib. |
I agree with you @klieret. Maybe we could add these codes in hidden sections right below every diagram in this episode, so if anybody is interested in learning something fun can take a look :) |
Ah, I also really like that idea :) |
The idea sounds good. Codes to the Feynman diagrams could be found here: https://github.com/GkAntonius/feynman/tree/master/examples/Particle_Physics 1 . plot_VBF.py |
We could simply wrap it in a HTML details element like so: <details>
<summary>See More</summary>
This text will be hidden if your browser supports it.
</details> So feel free to open a PR for that. For consistency, please format your code with black |
Thanks @klieret and @amanmdesai. I'll open a PR as soon as I can... :) |
The Feynman package allows to draw Feynman diagrams using matplotlib. This could be included in this episode in order to show more examples and applications
The text was updated successfully, but these errors were encountered: