class vivarium.framework.values.post_processors.PostProcessor(*args, **kwargs)[source]
class vivarium.framework.values.post_processors.AttributePostProcessor(*args, **kwargs)[source]

An attribute pipeline post-processor must return a pd.Series or pd.DataFrame.

vivarium.framework.values.post_processors.rescale_post_processor(index, value, manager)[source]

Rescales annual rates to time-step appropriate rates.

This should only be used with a simulation using a DateTimeClock or another implementation of a clock that traffics in pandas date-time objects.

Parameters:
  • index (pd.Index[int]) – The index of the population for which the attribute is being produced.

  • value (NumberLike) – Annual rates.

  • manager (ValuesManager) – The ValuesManager for this simulation.

Returns:

The annual rates rescaled to the size of the current time step size.

Return type:

pd.Series[float] | pd.DataFrame

vivarium.framework.values.post_processors.raw_union_post_processor(value, manager)[source]

Computes a probability on the union of the sample spaces in the values.

Given a list of values where each value is a probability of an independent event, this post processor computes the probability of the union of the events.

\(p_x\)

Probability of event x

\(1 - p_x\)

Probability of not event x

\(\prod_x(1 - p_x)\)

Probability of not any events x

\(1 - \prod_x(1 - p_x)\)

Probability of any event x

Parameters:
Returns:

The probability over the union of the sample spaces represented by the original probabilities.

Return type:

Union[ndarray[Any, dtype[number[NBitBase]]], Series, DataFrame, float, int]

vivarium.framework.values.post_processors.union_post_processor(index, value, manager)[source]

Computes a probability on the union of the sample spaces in the values.

Given a list of values where each value is a probability of an independent event, this post processor computes the probability of the union of the events.

\(p_x\)

Probability of event x

\(1 - p_x\)

Probability of not event x

\(\prod_x(1 - p_x)\)

Probability of not any events x

\(1 - \prod_x(1 - p_x)\)

Probability of any event x

Parameters:
  • values – A list of independent proportions or probabilities, either as numbers or as a something we can broadcast addition and multiplication over.

  • index (pd.Index[int])

  • value (list[NumberLike])

  • manager (ValuesManager)

Returns:

The probability over the union of the sample spaces represented by the original probabilities.

Return type:

pd.Series[Any] | pd.DataFrame