ChannelEventGenerator

class madspace.ChannelEventGenerator(self: madspace._madspace_py.ChannelEventGenerator, contexts: collections.abc.Sequence[madspace._madspace_py.Context], integrand: madspace._madspace_py.Integrand, event_file: str, weight_file: str, config: madspace._madspace_py.GeneratorConfig, subprocess_index: SupportsInt, name: str, histograms: madspace._madspace_py.ObservableHistograms | None)

Bases: pybind11_object

Event generation and integration for one integration channel.

Owns one channel’s compiled integrand, unweighter and (optional) histogram runtimes, one set per Context passed to the constructor, and runs its survey, VEGAS/channel-weight optimization and unweighting. EventGenerator coordinates one ChannelEventGenerator per channel of a subprocess.

Parameters:
  • contexts – One context per device to run on.

  • integrand – The channel’s compiled integrand.

  • event_file – Path of the weighted event file.

  • weight_file – Path of the max-weight tracking file.

  • config – Generator configuration.

  • subprocess_index – Index of the owning subprocess.

  • name – Human-readable channel name.

  • histograms – Optional observable histograms filled alongside integration.

static load(channel_file: str, contexts: collections.abc.Sequence[madspace._madspace_py.Context], event_file: str, weight_file: str, config: madspace._madspace_py.GeneratorConfig) → madspace._madspace_py.ChannelEventGenerator

Reconstruct a generator previously written with save, reopening event_file and weight_file.

static load_json(channel_json: str, contexts: collections.abc.Sequence[madspace._madspace_py.Context], event_file: str, weight_file: str, config: madspace._madspace_py.GeneratorConfig) → madspace._madspace_py.ChannelEventGenerator

Like load, from the JSON text produced by to_json instead of a file.

save(self: madspace._madspace_py.ChannelEventGenerator, save: str) → None

Serialize this generator’s state to file_name; see load.

set_fixed_max_weight(self: madspace._madspace_py.ChannelEventGenerator, max_weight: SupportsFloat) → None

Use max_weight for unweighting from now on, instead of estimating it from the generated events.

Must be positive.

status(self: madspace._madspace_py.ChannelEventGenerator) → madspace._madspace_py.GeneratorStatus

Current progress snapshot.

to_json(self: madspace._madspace_py.ChannelEventGenerator, include_estimates: bool = False) → str

The JSON text that save writes; see load_json.

With include_estimates, the current maximum weight and the integral of the absolute weights are stored as well. load_json then keeps the maximum weight fixed and uses the integral as a prior, see abs_integral_estimate.