RepeatedExperiment: Repeating an experiment experiment

class epyc.RepeatedExperiment(ex: epyc.experiment.Experiment, N: int)

Bases: epyc.experimentcombinator.ExperimentCombinator

A experiment combinator that takes a “base” experiment and runs it several times. This means you can define a single experiment separate from its repeating logic.

When run, a repeated experiment runs a number of repetitions of the underlying experiment at the same point in the parameter space. The result of the repeated experiment is the list of results from the underlying experiment. If the underlying experiment itself returns a list of results, these are all flattened into a single list.

Parameters:ex – the underlying experiment
Pamam N:the number of repetitions to perform

Performing repetitions

RepeatedExperiment.__init__(ex: epyc.experiment.Experiment, N: int)

Create a combinator based on the given experiment.

ex: the underlying experiment

RepeatedExperiment.repetitions() → int

Return the number of repetitions of the underlying experiment we expect to perform.

Returns:the number of repetitions

Extra metadata elements in the results dict

RepeatedExperiment.REPETITIONS

Metadata element for number of repetitions performed.

Running the experiment

RepeatedExperiment.do(params: Dict[str, Any]) → List[Dict[str, Dict[str, Any]]]

Perform the number of repetitions we want. The results returned will be a list of the results dicts generated by the repeated experiments. The metadata for each experiment will include an entry RepeatedExperiment.REPETITIONS for the number of repetitions that occurred (which will be the length of this list) and an entry RepeatedExperiment.I for the index of the result in that sequence.

Parameters:params – the parameters to the experiment
Returns:a list of result dicts