campaign
You use this simple campaign builder by importing it, adding valid events via "add", and writing it out with "save".
add(event, name=None, first=False)
Add a complete campaign event to the campaign builder. The new event is assumed to be a Python dict, and a valid event. The new event is not validated here. Set the first flag to True if this is the first event in a campaign because it functions as an accumulator and in some situations like sweeps it might have been used recently.
Source code in emod_api/campaign.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
get_event(event, old=False)
Basic placeholder functionality for now. This will map new ad-hoc events to GP_EVENTs and manage that 'cache' If event in built-ins, return event, else if in adhoc map, return mapped event, else add to adhoc_map and return mapped event.
Source code in emod_api/campaign.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
|
get_recv_trigger(trigger, old=use_old_adhoc_handling)
Get the correct representation of a trigger (also called signal or even event) that is being listened to.
Source code in emod_api/campaign.py
131 132 133 134 135 136 |
|
get_send_trigger(trigger, old=use_old_adhoc_handling)
Get the correct representation of a trigger (also called signal or even event) that is being broadcast.
Source code in emod_api/campaign.py
139 140 141 142 143 144 |
|
save(filename='campaign.json')
Save 'campaign_dict' as file named 'filename'.
Source code in emod_api/campaign.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
set_schema(schema_path_in)
Set the (path to) the schema file. And reset all campaign variables. This is essentially a "start_building_campaign" function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schema_path_in
|
str
|
The path to a schema.json file |
required |
Returns:
Source code in emod_api/campaign.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|