GenerationProgress
GenerationProgress
class GenerationProgressA 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.completedAttributes
| Name | Description |
|---|---|
completed |
Work items processed within this stage. |
stage |
Pipeline stage: topologies, topology_filters, interactions, interaction_filters, numerators, selection, filter_zero_color, grouping_preparation, grouping_samples, grouping_comparison, grouping, complete or cancelled. |
total |
Stage total, or None while the amount of work is unknown. |
zero_numerator_count |
Zero numerators filtered so far in this generation run. |
completed
GenerationProgress.completed: builtins.intWork 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.strPipeline 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)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)zero_numerator_count
GenerationProgress.zero_numerator_count: builtins.intZero 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