emod_api.spatialreports.spatial module

emod-api spatial report module. Exposes SpatialReport and SpatialNode objects.

class emod_api.spatialreports.spatial.SpatialNode(node_id: int, data)[source]

Bases: object

Class representing a single node of a spatial report.

property id: int

Node ID

property data

Time series data for this node.

class emod_api.spatialreports.spatial.SpatialReport(filename: str | None = None, node_ids: List[int] | None = None, data: array | None = None, start: int = 0, interval: int = 1)[source]

Bases: object

Class for reading (and, optionally, writing) spatial reports in EMOD/DTK format. “Filtered” reports will have start > 0 and/or reporting interval > 1.

property data: array

Returns full 2 dimensional NumPy array with report data. Shape is (#values, #nodes).

property node_ids: List[int]

Returns list of node IDs (integers) for nodes in the report.

property nodes: Dict[int, SpatialNode]

Returns dictionary of SpatialNodes keyed on node ID.

property node_count: int

Number of nodes in the report.

property time_steps: int

Number of samples in the report.

property start: int

Time step of first sample.

property interval: int

Interval, in time steps, between samples.

write_file(filename: str)[source]

Save current nodes and timeseries data to given file.