plot_relationship.py
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 |
|
eir_to_outcome(fdir, df, sweepvar='cm_clinical', facet_var='seasonality', eir_val='simulatedEIR', channel='prevalence_2to10', agegrp='0-5')
Generate line plots for EIR (Entomological Inoculation Rate) and a requested outcome variable, with models represented as colors and sweep variables as panels.
This function creates line plots where the x-axis represents the EIR and the y-axis represents an outcome variable, with different models indicated by color and organized into panels based on specified facets.
Parameters: |
|
---|
Returns: |
|
---|
Source code in plotter\plot_relationship.py
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 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
|
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 |
|
input_to_simulated_eir(fdir, df, sweepvar='cm_clinical', facet_var='seasonality')
Generate line plots comparing input EIR to simulated EIR.
This function creates line plots where the x-axis represents the input EIR values and the y-axis represents the simulated annual EIR. Different models are represented by different lines on the plot, and the plots are organized into panels based on specified facets.
Parameters: |
|
---|
Returns: |
|
---|
Source code in plotter\plot_relationship.py
255 256 257 258 259 260 261 262 263 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 294 295 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 |
|
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 |
|
prevalence2to10_to_incidence(fdir, df, sweepvar='modelname', facet_var='seasonality', channel='clinical_incidence', agegrps=None)
Generate line plots for PfPR2to10 and either clinical or severe incidence, grouped by the specified sweep variable and faceted by another variable.
This function creates a series of line plots where the x-axis represents the prevalence of PfPR2to10, and the y-axis represents either clinical or severe incidence. Each line corresponds to a model, and the plots can be faceted by a specified variable (e.g., seasonality).
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in plotter\plot_relationship.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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
prevalence2to10_to_incidence_by_age_and_model(fdir, df, sweepvar='modelname', channel='clinical_incidence')
Generate line plots for PfPR2to10 and either clinical or severe incidence, separated by model (columns) and age groups (rows).
This function creates a grid of line plots where each plot corresponds to a specific model and age group for the prevalence of PfPR2to10 on the x-axis and either clinical or severe incidence on the y-axis.
Parameters: |
|
---|
Returns: |
|
---|
Source code in plotter\plot_relationship.py
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 180 181 182 |
|
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 |
|