FeynKit · latest
On this page

GenerationProgress

symbolica.community.hepkit Class

GenerationProgress()

A progress snapshot delivered on the Python thread running generation.

Counts restart at each stage and measure processed work, not retained diagrams. total is None when the amount of work is not yet known.

Examples

from symbolica import S, E
from symbolica.community import hepkit as hep
model = hep.Model.phi4()
process = model.process(["phi", "phi"], ["phi", "phi"])
snapshots = []
def report(progress):
    snapshots.append((progress.stage, progress.completed, progress.total))
result = process.generate_diagrams(loops=1, progress=report)
assert result.report.completed

Member details

stage

Property · read-only#
stage: str

Pipeline stage: topologies, topology_filters, interactions, interaction_filters, numerators, selection, filter_zero_color, grouping_preparation, grouping_samples, grouping_comparison, grouping, complete or cancelled.

Examples

Using the setup in the GenerationProgress class example:

stages = []
def report(progress):
    stages.append(progress.stage)
result = process.generate_diagrams(progress=report)

completed

Property · read-only#
completed: int

Work items processed within this stage.

Examples

Using the setup in the GenerationProgress class example:

counts = []
def report(progress):
    counts.append((progress.stage, progress.completed))
result = process.generate_diagrams(progress=report)

total

Property · read-only#
total: Optional[int]

Stage total, or None while the amount of work is unknown.

Examples

Using the setup in the GenerationProgress class example:

totals = []
def report(progress):
    totals.append((progress.stage, progress.total))
result = process.generate_diagrams(progress=report)

zero_numerator_count

Property · read-only#
zero_numerator_count: int

Zero numerators filtered so far in this generation run.

Examples

Using the setup in the GenerationProgress class example:

zeroes = []
result = process.generate_diagrams(
    filter_zero_color=True,
    progress=lambda progress: zeroes.append(progress.zero_numerator_count))
assert zeroes[-1] == result.report.zero_numerator_count