Randomness IndexMap

The IndexMap is an internal abstraction used by the randomness system to help align random numbers for the same simulants across multiple simulations. It’s key idea is to take a set of static identifying characteristics about a simulant and hash them to a consistent positional index within a stream of seeded random numbers.

class vivarium.framework.randomness.index_map.IndexMap(key_columns=None, size=1000000)[source]

A key-index mapping with a vectorized hash and vectorized lookups.

SIM_INDEX_COLUMN = 'simulant_index'
TEN_DIGIT_MODULUS = 10000000000
update(new_keys, clock_time)[source]

Adds the new keys to the mapping.

  • new_keys (DataFrame) – A pandas DataFrame indexed by the simulant index and columns corresponding to the randomness system key columns.

  • clock_time (Timestamp) – The simulation clock time. Used as the salt during hashing to minimize inter-simulation collisions.

Return type: