plot_timeseries.py
annual_timeseries(fdir, df, channel, sweepvar='modelname', facet_var='seasonality', agegrp='0-100')
Parameters: |
|
---|
Returns: None (plots are saved to disk).
Source code in plotter\plot_timeseries.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
|
color_selector(i, s)
Select a color index based on the model name.
This function returns a color index based on the specified model name. If the model name is recognized, a predefined index is returned; otherwise, the input index is returned.
Parameters: |
|
---|
Returns: |
|
---|
Source code in plotter\plot_helper.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
|
convert_to_date(x)
Convert a number of days since January 1, 2005, to a date.
This function takes an integer representing the number of days since January 1, 2005, and returns the corresponding date.
Parameters: |
|
---|
Returns: |
|
---|
Source code in plotter\plot_helper.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
|
custom_sort_key(age_group)
Custom sort key function for sorting age groups.
This function extracts the lower bound of an age group represented as a string in the format ‘X-Y’ and returns it as an integer. It is primarily used for sorting age groups in ascending order based on their lower bounds.
Parameters: |
|
---|
Returns: |
|
---|
Source code in plotter\plot_helper.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
get_output_df(wdir, modelname, yr=False, mth=False, daily=False, custom_name=None, save_combined=False)
Load and combine data from the model output files.
This function reads model output files from a specified working directory and combines the data into a single DataFrame. It supports different data formats based on the specified parameters for yearly, monthly, or daily data.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in plotter\plot_helper.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
|
get_x_y(df, grpvar, x_channel, y_channel)
Calculate x-axis and y-axis values for each plot.
This function groups the input DataFrame by a specified variable and calculates the mean values for the specified x and y channels. It also computes the 95% confidence interval for the y values.
Parameters: |
|
---|
Returns: |
|
---|
Source code in plotter\plot_helper.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
|
get_ylab(channel)
Retrieve the y-axis label for a given channel.
This function returns a formatted string representing the y-axis label based on the specified channel name. The labels correspond to specific epidemiological measures.
Parameters: |
|
---|
Returns: |
|
---|
Source code in plotter\plot_helper.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
|
monthly_timeseries(fdir, df, channel, sweepvar='modelname', facet_var='ageGroup', agegrp='0-100')
Parameters: |
|
---|
Returns: None (plots are saved to disk).
Source code in plotter\plot_timeseries.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
monthly_trends(fdir, df, channel, sweepvar='modelname', facet_var='output_target', agegrp='0-100')
Generate line plots for monthly trends for channel (yaxis) by sweepvar for selected age groups. Note, assumed single occurence per month, i.e. aggregated across years (reads in mmmpy_mth.csv) Parameters: fdir (str): Directory where the plot will be saved. df (pandas dataframe): Dataframe that includes combined model results. channel (str): Variable representing the y-axis data to be plotted. sweepvar (str, optional): Variable to group the data and create multiple lines on the plot. Default is ‘output_target’. agegrp (str, optional): Age group filter for the data. Default is ‘0-5’. Returns: None (plots are saved to disk). Raises: ValueError: If no seasonal transmission pattern is specified in the data.
Source code in plotter\plot_timeseries.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
parse_args()
Parses command-line arguments for simulation specifications.
This function uses the argparse library to handle command-line inputs required for running simulation experiments. It defines required and optional arguments, including the job directory and model names.
Returns: |
|
---|
Command Line Arguments
-d/–directory (str): The job directory where the exp.obj file is located. This argument is required. -m/–modelname (str): One or more model names to compare. This argument is optional and defaults to [‘EMOD’, ‘OpenMalaria’, ‘malariasimulation’].
Source code in plotter\plot_helper.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
subset_dataframe_for_plot(df, figure_vars, agegrp=None, filter_target=True)
Filter the input DataFrame for plotting based on specified criteria.
This function filters the DataFrame according to the provided figure variables, optional age groups, and other selection criteria to prepare the data for visualization. It also returns a string summarizing the filtering applied.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in plotter\plot_helper.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
|