GammaLoop · latest
On this page

ObservableAccumulator

gammaloop Class

ObservableAccumulator()

Independent observable statistics compiled from one integrand's definitions.

Construct with api.observable_accumulator() and add exactly one evaluation record per independent draw. The coefficient is the complete outer weight; zero keeps the attempted sample count without fills. Event groups stay unmodified.

Examples

accumulator = api.observable_accumulator()
batch = api.evaluate_samples(points)
for sample in batch.samples:
    accumulator.add_sample(sample, sample.integrator_weight)
histograms = accumulator.snapshot()

Member details

add_sample

Method#
add_sample(sample: EvaluationResult, coefficient: float) -> None

Commit one sample with an explicit outer weight, including zero-weight misses.

Parameters

NameTypeDefaultDescription
sampleEvaluationResult——
coefficientfloat——

merge_in_place

Method#
merge_in_place(other: ObservableAccumulator) -> None

Merge independent sample statistics without changing the source accumulator.

Parameters

NameTypeDefaultDescription
otherObservableAccumulator——

sum_independent_estimates

Static method#
sum_independent_estimates(accumulators: Sequence[ObservableAccumulator]) -> Any

Sum means and variances of independent populations, preserving their separate counts. Merge batches within a stratum before passing its accumulator here.

Parameters

NameTypeDefaultDescription
accumulatorsSequence[ObservableAccumulator]——

snapshot

Method#
snapshot() -> dict

Return mergeable raw histogram statistics, without clearing or committing them.