pyfeyn2.feynmandiagram.FeynmanDiagram
- class pyfeyn2.feynmandiagram.FeynmanDiagram(*args, **kwargs)[source]
Bases:
FeynmanDiagramMethods
__init__(*args, **kwargs)add(*fd_all)add_rule(rule)Add a rule to the style.
add_rules(rules)Add rules to the style.
are_neighbours(vertex1, vertex2)conjugated([new_vertex_ids, new_leg_ids, ...])Warning: This does not mathematically conjugate the diagram, but only switches directions.
copy([new_vertex_ids, new_leg_ids, ...])decay(leg, *new_legs)deepcopy()emission(leg_or_propagator[, new, start, ...])fastcopy()find_vertex_in_model(vertex, model)Finds the model vertex corresponding to the given FeynmanDiagram vertex
follow_anti_fermion_line(leg)from_matrix(matrix, li, lo)from_xml(xml)Load self from XML.
from_xml_file(file)Load self from XML file.
get(lmbda)Get the bounding box of the diagram, i.e. the smallest rectangle that contains all vertices and legs.
get_connections(vertex)get_externals_size()get_fermion_factor(fd)get_fermion_line_ends()get_fermion_lines()get_incoming()get_leg(idd)get_leg_by_pdgid(pdgid)get_loose_vertices()get_neighbours(vertex)get_number_of_incoming()get_number_of_outgoing()get_outgoing()get_point(idd)Return the sheet.
Return the sheet.
get_style(obj[, xml])Get the style of an object.
get_style_property(obj, property_name[, xml])Get a style property of an object.
get_unpositioned_vertices()get_vertex(idd)get_vertex_index(vertex)has(obj)has_id(id)has_leg(leg)has_pdgid(pdgid)has_propagator(propagator)has_vertex(vertex)has_vertex_id(vertexid)insert_bubble(leg_or_propagator[, ...])Adds a bubble loop to a propagator or leg.
insert_tadpole(leg_or_propagator[, ...])insert_vertex_loop(vertex, *new_propagators)is_isomorphic(fd)is_valid(fm[, only_vertex])merge(*obj)Merges objects together
merge_legs(leg1, leg2)Merges two legs to a single propagator.
merge_vertices(*vertices[, tadpole])Merges vertices to a single vertex.
put_style(key, value)put_styles(**kwargs)raw_style()remove(*fd_all)remove_propagator(propagator)render([render, show, file, auto_position, ...])scale_positions(scale)Scale the positions of the vertices and legs.
to_graph()to_matrix()to_xml()Return self as XML.
with_class(clazz)with_color(color)with_id(id)set id
with_legs(value[, k])Set legs to value and return self.
generate new id
with_propagators(value[, k])Set propagators to value and return self.
with_rule(rule)Replace rules of the style.
with_rules(rules)Replace rules of the style.
with_sheet(sheet)Return the object with the sheet.
with_style(style)with_style_properties(**kwargs)with_style_property(key, value)with_vertices(value[, k])Set vertices to value and return self.
Attributes
CSS class string.
default_sheetidparent_fmlpropagatorsverticeslegssheetCSS style string.
- add_rule(rule: str)
Add a rule to the style.
- add_rules(rules: str)
Add rules to the style.
- clazz: str | None = None
CSS class string.
- conjugated(new_vertex_ids=True, new_leg_ids=True, new_propagator_ids=True)[source]
Warning: This does not mathematically conjugate the diagram, but only switches directions. Differences to the mathematical conjugation are missing complex conjugation of i’s and wrong momenta for e.g. 3g-vertex.
- emission(leg_or_propagator: Leg | Propagator, new: Leg | int | None = None, start=None, end=None, sense='outgoing', position_ratio=0.5, inplace=True)[source]
- Parameters:
inplace – If true keeps the original propagator/leg line, else the new intermediate Vertex can be located anywhere.
position_ratio – The position of the new vertex on the line between the source and target of the propagator/leg.
- find_vertex_in_model(vertex: Vertex, model: FeynModel)[source]
Finds the model vertex corresponding to the given FeynmanDiagram vertex
Note: Sorting is to check for the correct particles in a vertex given they can be in any order and have duplicates
- classmethod from_xml(xml: str)
Load self from XML.
- classmethod from_xml_file(file: str)
Load self from XML file.
- get_bounding_box()[source]
Get the bounding box of the diagram, i.e. the smallest rectangle that contains all vertices and legs.
- Returns:
The bounding box
- Return type:
(min_x, min_y, max_x, max_y)
- get_style(obj, xml: XML = None) CSSStyleDeclaration[source]
Get the style of an object.
This is preferred over accessing the style attribute directly, since it includes class and pdgid definitions.
- insert_bubble(leg_or_propagator: Leg | Propagator, new_propagator1: None | int | Propagator = None, new_propagator2: None | int | Propagator = None)[source]
Adds a bubble loop to a propagator or leg.
TODO add ascii example diagram here for documentation (also emission() etc.) TODO add tests, needs testing
- put_style(key, value)
Deprecated since version use: with_style_property
- put_styles(**kwargs)
Deprecated since version use: with_style_properties
- style: CSSString
CSS style string.
- to_xml() str
Return self as XML.
- with_id(id: str)
set id
- with_legs(value, k='legs')
Set legs to value and return self.
- with_new_id()
generate new id
- with_propagators(value, k='propagators')
Set propagators to value and return self.
- with_rule(rule: str)
Replace rules of the style.
- with_rules(rules: str)
Replace rules of the style.
- with_vertices(value, k='vertices')
Set vertices to value and return self.