emodpy.analyzers.timeseries_analyzer module

class emodpy.analyzers.timeseries_analyzer.TimeseriesAnalyzer(filenames=['output/InsetChart.json'], channels=('Statistical Population', 'Infectious Population', 'Infected', 'Waning Population'), save_output=True)[source]

Bases: IAnalyzer

data_group_names = ['group', 'sim_id', 'channel']
ordered_levels = ['channel', 'group', 'sim_id']
output_file = 'timeseries.csv'
initialize()[source]

Call once after the analyzer has been added to the AnalyzeManager.

Add everything depending on the working directory or unique ID here instead of in __init__.

default_select_fn(ts)[source]
default_group_fn(k, v)[source]
default_plot_fn(df, ax)[source]
default_filter_fn(md)[source]
filter(simulation)[source]

Decide whether the analyzer should process a simulation/work item.

Parameters:

item – An IItem to be considered for processing with this analyzer.

Returns:

A Boolean indicating whether simulation/work item should be analyzed by this analyzer.

get_channel_data(data_by_channel, selected_channels)[source]
map(data, simulation)[source]

In parallel for each simulation/work item, consume raw data from filenames and emit selected data.

Parameters:
  • data – A dictionary associating filename with content for simulation data.

  • itemIItem object that the passed data is associated with.

Returns:

Selected data for the given simulation/work item.

plot_by_channel(channels, plot_fn)[source]
reduce(all_data)[source]

Combine the map() data for a set of items into an aggregate result.

Parameters:

all_data – A dictionary with entries for the item ID and selected data.