GenerationResult
GenerationResult
class GenerationResultFeynman diagrams and diagnostics produced for one process.
The result retains generated diagrams in deterministic order and may also contain numerator-equivalence groups for efficient downstream evaluation.
Examples
from symbolica import S, E
from symbolica.community import hepkit as hep
model = hep.Model.phi4()
process = model.process(["phi", "phi"], ["phi", "phi"])
result = process.generate_diagrams(loops=1)
diagram = result.diagrams[0]
diagrams = result.diagrams
assert result.report.retained_count == len(diagrams)Attributes
| Name | Description |
|---|---|
diagrams |
Return every retained diagram in generated order. |
groups |
Return the numerator groups in deterministic master-index order. |
report |
Return generation counts and completion status. |
diagrams
GenerationResult.diagrams: builtins.list[FeynmanDiagram]Return every retained diagram in generated order.
Examples
Using the setup in the GenerationResult class example:
numerators = [diagram.numerator_expression() for diagram in result.diagrams]groups
GenerationResult.groups: builtins.list[DiagramGroup]Return the numerator groups in deterministic master-index order.
Examples
Using the setup in the GenerationResult class example:
masters = [result.diagrams[group.master] for group in result.groups]report
GenerationResult.report: GenerationReportReturn generation counts and completion status.
Examples
Using the setup in the GenerationResult class example:
assert result.report.completedMethods
| Name | Description |
|---|---|
__getitem__ |
Return one retained diagram by generated-order index. |
__iter__ |
Iterate over retained diagrams in deterministic generated order. |
__len__ |
Return the number of retained diagrams. |
__repr__ |
Return a concise summary of the retained diagrams and groups. |
_repr_html_ |
Render a thumbnail strip and one shared interactive diagram viewer |
_repr_pretty_ |
Write a concise result summary to an IPython pretty printer. |
__getitem__
GenerationResult.__getitem__(index: builtins.int) -> FeynmanDiagramReturn one retained diagram by generated-order index.
Examples
Using the setup in the GenerationResult class example:
first_diagram = result[0]Parameters
index(int) Zero-based index; negative indices count from the end.
__iter__
GenerationResult.__iter__() -> collections.abc.Iterator[FeynmanDiagram]Iterate over retained diagrams in deterministic generated order.
Examples
Using the setup in the GenerationResult class example:
one_loop = [diagram for diagram in result if diagram.loop_count == 1]__len__
GenerationResult.__len__() -> builtins.intReturn the number of retained diagrams.
Examples
Using the setup in the GenerationResult class example:
number_of_diagrams = len(result)__repr__
GenerationResult.__repr__() -> builtins.strReturn a concise summary of the retained diagrams and groups.
Examples
Using the setup in the GenerationResult class example:
print(result)_repr_html_
GenerationResult._repr_html_() -> builtins.strRender a thumbnail strip and one shared interactive diagram viewer.
At most six diagrams are rendered so that displaying a large generation result remains responsive. Access result.diagrams to inspect the complete collection.
Examples
Using the setup in the GenerationResult class example:
from IPython.display import display
display(result)_repr_pretty_
GenerationResult._repr_pretty_(pretty: typing.Any, cycle: builtins.bool) -> NoneWrite a concise result summary to an IPython pretty printer.
Examples
Using the setup in the GenerationResult class example:
from IPython.lib.pretty import pretty
text = pretty(result)Parameters
pretty(object) The IPython pretty-printer object.cycle(bool) Whether this object is part of a recursive formatting cycle.