analyze_sim.py¶
AnnualAgebinAnalyzer(exp, mmi, start_year, survey_step_days, grp_channels=['ageGroup', 'index'], age_groups_aggregates=None)
¶
Run the AnnualAgebinAnalyzer for OpenMalaria experiments to generate and save a results dataframe for defined age groups over time (years).
Parameters: |
|
---|
Saves
mmmpy_yr.csv
Returns: |
|
---|
Source code in OpenMalaria\analyze_sim.py
576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 |
|
BaseAnalyzer(exp, mm, saveExtract=False, compr='infer')
¶
Run the BaseAnalyzer for OpenMalaria experiments (optional for i.e. troubleshooting). Args: exp: The experiment object. mm: The measure map object. saveExtract: Whether to save the raw survey output DataFrame (default: False). compr: The compression method for saving the output CSV files (default: ‘gzip’). Saves: Surveyoutput_base.csv
Returns: |
|
---|
Source code in OpenMalaria\analyze_sim.py
FiveDayAgebinAnalyzer(exp, mmi, start_year, grp_channels=['ageGroup', 'index'], age_groups_aggregates=None)
¶
Run the FiveDayAgebinAnalyzer for OpenMalaria experiments to generate and save a results dataframe for defined age groups over time (5day and years).
Parameters: |
|
---|
Saves
mmmpy_5day.csv
Returns: |
|
---|
Source code in OpenMalaria\analyze_sim.py
829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 |
|
InputEIRAnalyzer(exp, mm, start_year, survey_step_days=30, compr='infer')
¶
Run the InputEIRAnalyzer for OpenMalaria experiments.
Parameters: |
|
---|
Saves
One or more CSV files based on the daily
flag:
- EIR_daily.csv
: Contains daily EIR data, if daily=True
.
- EIR_mth.csv
: Contains monthly aggregated EIR data, if daily=False
.
- EIR_yr.csv
: Contains yearly aggregated EIR data, if daily=False
.
- EIR.csv
: Contains mean EIR over the monitoring period, if daily=False
.
Returns: None
Source code in OpenMalaria\analyze_sim.py
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 253 254 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 |
|
MonthlyAgebinAnalyzer(exp, mmi, start_year, survey_step_days, grp_channels=['ageGroup', 'index'], age_groups_aggregates=None)
¶
Run the MonthlyAgebinAnalyzer for OpenMalaria experiments to generate and save a results dataframe for defined age groups over time (month and years).
Parameters: |
|
---|
Saves
mmmpy_mth.csv
Returns: |
|
---|
Source code in OpenMalaria\analyze_sim.py
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 |
|
SurveyAllAgeAnalyzer(exp, mm, start_year=2020, survey_step_days=30, compr='infer')
¶
Run the SurveyAllAgeAnalyzer for OpenMalaria experiments. Args: exp: The experiment object. mm: The measure map object. start_year: The start year for the survey (default: 2020). survey_step_days: The survey step size in days (default: 30). compr: The compression method for saving the output CSV files (default: ‘infer’). Saves: All_Age_Outputs.csv Returns: None
Source code in OpenMalaria\analyze_sim.py
TimeavrgAgebinAnalyzer(exp, mmi, survey_step_days, grp_channels=['ageGroup', 'index'], age_groups_aggregates=None)
¶
Run the TimeavrgAgebinAnalyzer for OpenMalaria experiments to generate and save a results dataframe for defined age groups aggregated over the monitoring period.
Parameters: |
|
---|
Saves
mmmpy_timeavrg.csv interpolation_data.csv (if exp.run_mode == ‘calibration’)
Returns: |
|
---|
Source code in OpenMalaria\analyze_sim.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 |
|
add_measure_names(df, mm)
¶
Adds measure names to a DataFrame based on a measure dictionary specific to OpenMalaria. Args: df (pandas.DataFrame): The input DataFrame to annotate with measure names. mm (dict): The measure dictionary mapping measure IDs to measure names. Returns: pandas.DataFrame: The annotated DataFrame with measure names.
Source code in OpenMalaria\analyze_sim.py
format_df(df)
¶
Format the DataFrame containing OpenMalaria experiment output.
Source code in OpenMalaria\analyze_sim.py
parse_args()
¶
Parse command-line arguments for simulation specifications.
This function sets up the argument parser to handle command-line inputs,
specifically for specifying the job directory and an optional experiment ID.
The job directory is required to locate the exp.obj
file.
Returns: |
|
---|
Source code in OpenMalaria\analyze_sim.py
pivot_wider(df, index_cols=None, names_from=None, values_from=None)
¶
Pivot a DataFrame from long to wide format. Args: df: The DataFrame to be pivoted. index_cols: Columns to use as index (default: [‘index’, ‘survey’, ‘ageGroup’]). names_from: Columns to use as column names in the wide format (default: [‘measure_name’]). values_from: Columns to use as values in the wide format (default: [‘value’]). Returns: A pivoted DataFrame in wide format.
Source code in OpenMalaria\analyze_sim.py
survey_to_date(df, survey_step_days=30, start_year=0)
¶
Converts OpenMalaria survey timesteps to dates based on the survey step size and simulation start year. Note: In OpenMalaria survey results are always written into a single file of the same format, in contrast to EMOD where multiple files may be specified Args: df (pandas.DataFrame): The input DataFrame per timestep survey_step_days (int): The number of days between surveys. Default is 30. start_year (int): The starting year for the surveys. Default is 0. Returns: pandas.DataFrame: The DataFrame with added ‘date’ column representing the survey dates. Raises: ValueError: If survey_step_days is not 30 or 365.
Source code in OpenMalaria\analyze_sim.py
to_df(exp)
¶
Combined single OpenMalaria experiment outputs across scenarios into a DataFrame. Args: exp: The experiment object including information about the job_directory where outputs are stored and number of scenarios to expect Returns: A DataFrame containing the standard experiment output for all OpenMalaria scenarios.