Lookup Tables
Simulations tend to require a large quantity of data to run. vivarium
provides the LookupTable
abstraction to ensure that accurate data can
be retrieved when it’s needed. It’s a callable object that takes in a
population index and returns data specific to the individuals represented by
that index. See the lookup concept note for more.
- class vivarium.framework.lookup.table.LookupTable(table_number, data, population_view_builder=None, key_columns=(), parameter_columns=(), value_columns=(), interpolation_order=0, clock=None, extrapolate=True, validate=True)[source]
A callable to produces values for a population index.
In
vivarium
simulations, the index is synonymous with the simulated population. The lookup system allows the user to provide different kinds of data and strategies for using that data. When the simulation is running, then, components can lookup parameter values based solely on the population index.Notes
These should not be created directly. Use the lookup method on the builder during setup.
- Parameters:
- data: Number | timedelta | datetime | DataFrame | List[Number | timedelta | datetime] | Tuple[Number | timedelta | datetime]
The data from which to build the interpolation.
- population_view_builder: Callable = None
Callable to get a population view to be used by the lookup table.
- key_columns: List[str] | Tuple[str] = ()
Column names to be used as categorical parameters in Interpolation to select between interpolation functions.
- class vivarium.framework.lookup.table.InterpolatedTable(table_number, data, population_view_builder, key_columns, parameter_columns, value_columns, interpolation_order, clock, extrapolate, validate)[source]
A callable that interpolates data according to a given strategy.
Notes
These should not be created directly. Use the lookup interface on the
builder
during setup.- Parameters:
- class vivarium.framework.lookup.table.CategoricalTable(table_number, data, population_view_builder, key_columns, value_columns, **kwargs)[source]
A callable that selects values from a table based on categorical parameters across an index.
Notes
These should not be created directly. Use the lookup interface on the
builder
during setup.- Parameters:
- class vivarium.framework.lookup.table.ScalarTable(table_number, data, population_view_builder=None, key_columns=(), parameter_columns=(), value_columns=(), interpolation_order=0, clock=None, extrapolate=True, validate=True)[source]
A callable that broadcasts a scalar or list of scalars over an index.
Notes
These should not be created directly. Use the lookup interface on the builder during setup.
- Parameters: