GenerationProgress

Symbolica documentation for getting started, symbolic expressions, numerical evaluation, pattern matching, and APIs in Python and Rust.

GenerationProgress

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

Attributes

Name Description
completed Work items processed within this stage.
stage Pipeline stage: topologies, topology_filters, interactions, interaction_filters, numerators, selection, grouping_preparation, grouping_samples, grouping_comparison, grouping, complete or cancelled.
total Stage total, or None while the amount of work is unknown.

completed

GenerationProgress.completed: builtins.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)

stage

GenerationProgress.stage: builtins.str

Pipeline stage: topologies, topology_filters, interactions, interaction_filters, numerators, selection, 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)

total

GenerationProgress.total: typing.Optional[builtins.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)