_inspect
Read-only inspection and query functions for serialized populations.
count_humans(ser_pop, *, node_index=None)
Count individuals across all nodes or in a specific node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ser_pop
|
SerializedPopulation
|
A loaded SerializedPopulation. |
required |
node_index
|
int
|
If provided, count only in this node (0-based index). |
None
|
Returns:
| Type | Description |
|---|---|
int
|
Number of individuals. |
Source code in emodpy_malaria/serialization/_inspect.py
count_infections(ser_pop, *, node_index=None)
Count total infections across all nodes or in a specific node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ser_pop
|
SerializedPopulation
|
A loaded SerializedPopulation. |
required |
node_index
|
int
|
If provided, count only in this node. |
None
|
Returns:
| Type | Description |
|---|---|
int
|
Number of infections. |
Source code in emodpy_malaria/serialization/_inspect.py
count_vectors(ser_pop, *, node_index=None, queue=None)
Count vector cohorts across all nodes or in a specific node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ser_pop
|
SerializedPopulation
|
A loaded SerializedPopulation. |
required |
node_index
|
int
|
If provided, count only in this node. |
None
|
queue
|
str
|
If provided, count only in this queue (e.g.,
|
None
|
Returns:
| Type | Description |
|---|---|
int
|
Number of vector cohorts. |
Source code in emodpy_malaria/serialization/_inspect.py
find_parameter(ser_pop, name, *, cutoff=0.6)
Search for parameters matching the given name using fuzzy matching.
Improved version of emod_api's find() that returns results as a list
of dot-path strings instead of printing them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ser_pop
|
SerializedPopulation
|
A loaded SerializedPopulation. |
required |
name
|
str
|
Parameter name to search for (e.g., |
required |
cutoff
|
float
|
Similarity threshold for fuzzy matching (0.0-1.0). |
0.6
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of dot-notation paths where the parameter was found. |
Source code in emodpy_malaria/serialization/_inspect.py
get_all_parameters(ser_pop)
Return the set of all parameter paths in the serialized population.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ser_pop
|
SerializedPopulation
|
A loaded SerializedPopulation. |
required |
Returns:
| Type | Description |
|---|---|
set[str]
|
Set of dot-notation parameter paths. |
Source code in emodpy_malaria/serialization/_inspect.py
list_node_ids(ser_pop)
Return the external IDs of all nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ser_pop
|
SerializedPopulation
|
A loaded SerializedPopulation. |
required |
Returns:
| Type | Description |
|---|---|
list[int]
|
List of node external IDs. |
Source code in emodpy_malaria/serialization/_inspect.py
read_header(file_path)
Read only the header of a .dtk file without loading node data.
Useful for quickly checking file version, compression, node count, and EMOD build info without the cost of decompressing population data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str | Path
|
Path to the .dtk file. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Header dict with keys like |
dict
|
|
Source code in emodpy_malaria/serialization/_inspect.py
summarize(ser_pop)
Return a comprehensive summary of the serialized population.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ser_pop
|
SerializedPopulation
|
A loaded SerializedPopulation. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Dict with |
dict
|
and a |