serialization
Serialization configuration helpers for EMOD burnin/pickup workflows.
Typical workflow:
- Burnin phase -- call
configure_serialization_writeto save population state at specified time steps. - Pickup phase -- call
get_burnin_sim_outpathsto resolve output paths, thenconfigure_serialization_readto load state.
See emodpy_malaria.serialization for inspecting and modifying
.dtk files after they have been written.
configure_serialization_read(config, *, path, filenames, mask_node_read=0, enable_random_generator_from_serialized=False)
Configure a simulation to read a serialized population at startup.
Sets Serialized_Population_Reading_Type = "READ" and disables
writing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
object
|
The config object ( |
required |
path
|
str
|
Root directory containing the |
required |
filenames
|
list[str]
|
|
required |
mask_node_read
|
int
|
Bitmask controlling what data is loaded.
|
0
|
enable_random_generator_from_serialized
|
bool
|
If |
False
|
Source code in emodpy_malaria/utils/serialization.py
configure_serialization_write(config, *, time_steps=None, times=None, precision=SerializationPrecision.REDUCED, mask_node_write=0, max_humans_per_collection=2000)
Configure a simulation to write serialized population files.
Sets Serialized_Population_Writing_Type to TIMESTEP or TIME
and disables reading. Provide exactly one of time_steps or times.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
object
|
The config object ( |
required |
time_steps
|
list[int]
|
Simulation time steps at which to serialize.
|
None
|
times
|
list[float]
|
Absolute simulation times at which to serialize (rounded
up to the nearest time step internally by EMOD).
Sets |
None
|
precision
|
Union[SerializationPrecision, str]
|
Floating-point precision for the serialized file.
|
REDUCED
|
mask_node_write
|
int
|
Bitmask controlling what data is saved.
|
0
|
max_humans_per_collection
|
int
|
Maximum number of human agents saved per collection in the serialized file. Higher values are faster to read/write but use more memory. Default 2000. |
2000
|
Source code in emodpy_malaria/utils/serialization.py
get_burnin_sim_outpaths(experiment_id, platform, *, tag_columns=None)
Resolve platform-correct output paths for each simulation in a burnin experiment.
Returns a DataFrame with at least sim_id and outpath columns.
outpath is the value to pass as path to
configure_serialization_read() — it already points to each
simulation's output/ directory using a path that the pickup
simulation's EMOD process can reach (container-mapped, COMPS working
directory, or local filesystem path as appropriate).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
experiment_id
|
str
|
The burnin experiment ID. |
required |
platform
|
object
|
The idmtools
|
required |
tag_columns
|
list[str]
|
Optional simulation tag names to include as extra
columns in the returned DataFrame (e.g. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame sorted by |