StoppingRule#

class uvex_transients.phase_space.sampling.base.StoppingRule(chunk_size: int, k_target: int, n_max: int)[source]#

Sample a point in chunks of tries until it has k_target successes or has used n_max tries.

Raises:

ValueError – If chunk_size or k_target is below 1, or n_max is below chunk_size.

Methods

expected_n(p)

Predict how many tries a point of success fraction p will get.

from_config(*[, chunk_size, k_target, ...])

Build the rule, taking what is not given from config["phase_space.stopping"].

run(sampler, x, seed)

Sample a point until the rule says to stop.

Attributes

chunk_size

The tries made at a time, and so the fewest a point gets.

k_target

Stop adding chunks to a point once it has this many successes.

n_max

Never make more than this many tries at a point (the last chunk may take it past).