feynml.feynmandiagram.FeynmanDiagram
- class feynml.feynmandiagram.FeynmanDiagram(id: Optional[str] = None, style: cssutils.css.cssstyledeclaration.CSSStyleDeclaration = <factory>, clazz: Optional[str] = None, propagators: List[feynml.propagator.Propagator] = <factory>, vertices: List[feynml.vertex.Vertex] = <factory>, legs: List[feynml.leg.Leg] = <factory>, sheet: cssutils.css.cssstylesheet.CSSStyleSheet = <factory>)[source]
Bases:
SheetHandler
,XML
,Styled
,Identifiable
- __init__(id: str | None = None, style: ~cssutils.css.cssstyledeclaration.CSSStyleDeclaration = <factory>, clazz: str | None = None, propagators: ~typing.List[~feynml.propagator.Propagator] = <factory>, vertices: ~typing.List[~feynml.vertex.Vertex] = <factory>, legs: ~typing.List[~feynml.leg.Leg] = <factory>, sheet: ~cssutils.css.cssstylesheet.CSSStyleSheet = <factory>) None
Methods
__init__
([id, style, clazz, propagators, ...])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, ...])copy
([new_vertex_ids, new_leg_ids, ...])deepcopy
()follow_anti_fermion_line
(leg)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_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)has
(obj)has_id
(id)has_leg
(leg)has_pdgid
(pdgid)has_propagator
(propagator)has_vertex
(vertex)has_vertex_id
(vertexid)put_style
(key, value)Deprecated since version 0.0.0.
put_styles
(**kwargs)Deprecated since version 0.0.0.
raw_style
()remove_propagator
(propagator)render
([render, show, file, auto_position, ...])scale_positions
(scale)Scale the positions of the vertices and legs.
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_sheet
id
parent_fml
propagators
vertices
legs
sheet
CSS 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.
- 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 = None) CSSStyleDeclaration [source]
Get the style of an object.
This is prefered over accessing the style attribute directly, since it includes class and pdgid definitions.
- get_style_property(obj, property_name, xml: XML | None = None) str
Get a style property of an object.
- put_style(key, value)
Deprecated since version 0.0.0.
- put_styles(**kwargs)
Deprecated since version 0.0.0.
- 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.