Data storage#
The policyengine_core.data_storage
module contains two classes that are used to handle the storage of data in simulations.
InMemoryStorage#
- class policyengine_core.data_storage.in_memory_storage.InMemoryStorage(is_eternal: bool)[source]#
Bases:
object
Low-level class responsible for storing and retrieving calculated vectors in memory
- delete(period: Optional[policyengine_core.periods.period_.Period] = None, branch_name: str = 'default') None [source]#
- get(period: policyengine_core.periods.period_.Period, branch_name: str = 'default') Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]] [source]#
- is_eternal: bool#
- put(value: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], period: policyengine_core.periods.period_.Period, branch_name: str = 'default') None [source]#
OnDiskStorage#
- class policyengine_core.data_storage.on_disk_storage.OnDiskStorage(storage_dir: str, is_eternal: bool = False, preserve_storage_dir: bool = False)[source]#
Bases:
object
Low-level class responsible for storing and retrieving calculated vectors on disk
- delete(period: Optional[policyengine_core.periods.period_.Period] = None, branch_name: str = 'default') None [source]#
- get(period: policyengine_core.periods.period_.Period, branch_name: str = 'default') Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]] [source]#
- put(value: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], period: policyengine_core.periods.period_.Period, branch_name: str = 'default') None [source]#