emodpy.emod_campaign module

class emodpy.emod_campaign.EMODCampaign(name='Campaign', events=None, use_defaults=True, **kwargs)

Bases: object

Class representing an EMOD Campaign. It contains: - events: a list of events for the given campaign - name: campaign name - use_defaults: EMOD flag to use defaults for unspecified parameters - extra_parameters: parameters set by the user that will be added to the campaign JSON

property json

Property to transform the object in JSON

static load_from_file(filename: str) object

Load a campaign from a JSON file.


filename – Path to the campaign file

Returns: an initialized EMODCampaign instance

static load_from_dict(data: Dict) object

Create a campaign object from a dict. :param data: The dictionary containing the data

Returns: an initialized EMODCampaign instance

clear() NoReturn

Clear all campaign events

get_events_at(timestep: int) List[Dict]

Get a list of events happening at the specified timestep. Does not take into account recurrence and only consider start timestep. :param timestep: selected timestep

Returns: list of events

get_events_with_name(name: str) List[Dict]

Get a list of events with the given name. This search is based on the Event_Name key of events. :param name: Name of the events

Returns: list of events

add_event(event: Dict) NoReturn

Add the given event to the campaign event. :param event: The event to add

add_events(events: List[Dict]) NoReturn

Add a list of events to the campaign events. :param events: List of events to add