emod_api.channelreports.channels module

Module for reading InsetChart.json channels.

class emod_api.channelreports.channels.Header(**kwargs)[source]

Bases: object

property num_channels: int
property dtk_version: str
property time_stamp: str
property report_type: str
property report_version: str
property step_size: int

>= 1

property start_time: int

>= 0

property num_time_steps: int

>= 1

as_dictionary() Dict[source]
class emod_api.channelreports.channels.Channel(title: str, units: str, data: List)[source]

Bases: object

property title: str
property units: str
property data
as_dictionary() Dict[source]
class emod_api.channelreports.channels.ChannelReport(filename: str | None = None, **kwargs)[source]

Bases: object

property header: Header
property dtk_version: str
property time_stamp: str
property report_type: str
property report_version: str

major.minor

property step_size: int

>= 1

property start_time: int

>= 0

property num_time_steps: int

> 0

property num_channels: int
property channel_names: List
property channels: Dict

Channel objects keyed on channel name/title

as_dataframe() DataFrame[source]

Return underlying data as a Pandas DataFrame

write_file(filename: str, indent: int = 0, separators=(',', ':')) None[source]

Write inset chart to specified text file.

to_csv(filename: str | Path, channel_names: List[str] | None = None, transpose: bool = False) None[source]

Write each channel from the report to a row, CSV style, in the given file.

Channel name goes in the first column, channel data goes into subsequent columns.

Parameters:
  • filename – string or path specifying destination file

  • channel_names – optional list of channels (by name) to write to the file

  • transpose – write channels as columns rather than rows