-
Notifications
You must be signed in to change notification settings - Fork 0
Create art module #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mmcleod89
wants to merge
69
commits into
development
Choose a base branch
from
create_art_module
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Create art module #215
Changes from all commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
0de3ed0
Add initial ART module
mmcleod89 fca5661
Merge branch 'development' into create_art_module
mmcleod89 6a949e1
add art data reading
mmcleod89 f38078d
Ignore output types
mmcleod89 280ce96
Merge branch 'development' into create_art_module
mmcleod89 084519b
Ignore graph folders
mmcleod89 f3e0ca1
Add more ART fields
mmcleod89 fdfd6cb
Merge branch 'development' into create_art_module
mmcleod89 379320b
Add HIV/ART monitoring variables
mmcleod89 90ee71b
Implement additional art param updates and begin regimens
mmcleod89 158e609
Update ART regimens
mmcleod89 8bef887
Initialise ART variables and add beta distributions
mmcleod89 3f75e70
Renaming and refactoring
mmcleod89 c95319c
Add clinic visit column
mmcleod89 679b398
begin adding clinic visits
mmcleod89 3c6c286
Fix data reading / initialisation
mmcleod89 79bda93
Temp fix for testing issue (to be investigated)
mmcleod89 1228bdb
Fix beta distributions
mmcleod89 4e5fad3
Simplest fix for df fragmentation
mmcleod89 cefc37a
Style (imports)
mmcleod89 cb9226f
style fixes
mmcleod89 59f8e51
Cases for initialisation of ART
mmcleod89 fe3530b
Apply art initiatlisation
mmcleod89 11e420e
reformatting
mmcleod89 ce63d68
Move PMTCT to pregnancy
mmcleod89 03e6a82
Bug fix and adapt ANC test
mmcleod89 f6e573e
Add mutations to PMTCT
mmcleod89 a26456d
sort includes
mmcleod89 9f885df
auto-formatting
mmcleod89 5468822
unused imports
mmcleod89 8402019
Tools cannot agree on import formatting
mmcleod89 3095e03
start art interrupt
mmcleod89 c133a28
update histories explicitly
mmcleod89 3becf0a
Resistance module has reference to population
mmcleod89 2cceef8
Discard unneeded get col dt
mmcleod89 c76bc1a
Formatting
mmcleod89 46726c3
Merge pull request #223 from UCL/module_restructure
mmcleod89 c2fc7fe
Update ON_ART to have a history
mmcleod89 e5c9d94
Fix data access for prep, circumcision, and resistance
mmcleod89 486b259
Fix data access
mmcleod89 059e9a5
Fix data access
mmcleod89 3617993
Fix range based access
mmcleod89 69a4f1b
Fixing data access
mmcleod89 86139b5
fix data access
mmcleod89 027cdd6
Fix data access
mmcleod89 8ea61d3
Fudging data access because tests mess with the past
mmcleod89 2e10ed1
Data access tweak
mmcleod89 b238bf9
Fixing circumcision data access and consequences
mmcleod89 323bd33
Adding history to prep values
mmcleod89 2229036
Auto formatting
mmcleod89 5eae080
Reference population in art module
mmcleod89 c75ac79
Adding fields to art and implementing interruption
mmcleod89 65a5bf2
Updating Date / TimeDelta to use capitals
mmcleod89 bacafec
Fix lencab update
mmcleod89 a881c3f
Formatting
mmcleod89 8c8e7e4
Add interruption of supply
mmcleod89 cfdcd5d
Move ARVs to ART module and implement adh dists
mmcleod89 68040bf
Finish adherence patterns
mmcleod89 5babe88
Finish interruptions and adherence
mmcleod89 32421aa
Formatting and new columns
mmcleod89 0e91ec3
ART restart
mmcleod89 d03eec3
reinitiate ART
mmcleod89 f4c0306
First line regimen
mmcleod89 746a749
Updating compatibility and dependency list
mmcleod89 8e16f55
Simplified ART implementation
mmcleod89 44a0fba
Update LTP risk test
mmcleod89 ce6ac52
Add second line therapy switch and fix some pandas issues
mmcleod89 6190a20
Fixing output warnings
mmcleod89 63e4597
Style fixes
mmcleod89 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| EXPERIMENT: | ||
| population: 1000 | ||
| population: 100000 | ||
| start_year: 1989 | ||
| end_year: 2021 | ||
| time_interval_days: 90 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| from itertools import product | ||
|
|
||
| import matplotlib.pyplot as plt | ||
| import numpy as np | ||
| import pandas as pd | ||
|
|
||
| # files = ["output\simulation_output_20240205-230047\simulation_output_20240205-230047.csv", | ||
| # "output\simulation_output_20240205-231331\simulation_output_20240205-231331.csv", | ||
| # "output\simulation_output_20240206-104041\simulation_output_20240206-104041.csv", | ||
| # "output\simulation_output_20240206-104444\simulation_output_20240206-104444.csv", | ||
| # "output\simulation_output_20240206-104524\simulation_output_20240206-104524.csv", | ||
| # "output\simulation_output_20240206-104650\simulation_output_20240206-104650.csv", | ||
| # "output\simulation_output_20240206-105003\simulation_output_20240206-105003.csv", | ||
| # "output\simulation_output_20240206-134436\simulation_output_20240206-134436.csv", | ||
| # "output\simulation_output_20240206-135429\simulation_output_20240206-135429.csv", | ||
| # "output\simulation_output_20240206-135605\simulation_output_20240206-135605.csv"] | ||
| files = ["output\simulation_output_20240220-154213\simulation_output_20240220-154213.csv"] | ||
| data = [pd.read_csv(file) for file in files] | ||
|
|
||
| men_15_24 = np.array([d["Short term partners (15-64)"] for d in data]).transpose() | ||
| medians = np.array([np.median(tstep) for tstep in men_15_24]) | ||
| plt.plot(medians) | ||
| plt.show() | ||
|
|
||
| def psb(i, sex): | ||
| if(sex == 0): | ||
| sex_string = "male" | ||
| else: | ||
| sex_string = "female" | ||
| return f"Partner sex balance ({i}-{i+9}, {sex_string})" | ||
|
|
||
| def pps(i, sex): | ||
| if(sex == 0): | ||
| sex_string = "male" | ||
| else: | ||
| sex_string = "female" | ||
| return f"Short term partners ({i}-{i+9}, {sex})" | ||
|
|
||
| sexes = [0, 1] | ||
| ages = [15, 25, 35, 45, 55] | ||
|
|
||
| for (a,s) in product(ages, sexes): | ||
| for d in data: | ||
| plt.plot(1989 + 0.25 * d["Time Step"], d[psb(a, s)]) | ||
| plt.plot(1989 + 0.25 * data[0]["Time Step"], np.zeros(len(data[0]))) | ||
| print(psb(a,s), f"mean = {np.mean(d[psb(a,s)])}", f"std = {np.std(d[psb(a,s)])}", 10**(np.mean(d[psb(a,s)]))) | ||
| plt.title(psb(a, s)) | ||
| plt.show() | ||
|
|
||
| # Create a figure with subplots | ||
| fig, axs = plt.subplots(len(ages), len(sexes), figsize=(12, 8)) | ||
| fig.suptitle("Short Term Partners and Partner Sex Balance") | ||
|
|
||
| # Iterate over ages and sexes | ||
| # for i, a in enumerate(ages): | ||
| # for j, s in enumerate(sexes): | ||
| # ax = axs[i, j] | ||
| # ax.plot(1989 + 0.25 * data[0]["Time Step"], data[0][psb(a, s)], label=pps(a, s)) | ||
| # ax.plot(1989 + 0.25 * data[0]["Time Step"], np.zeros(len(data[0])), linestyle="--", color="gray") | ||
| # ax.set_title(f"{psb(a, s)}") | ||
| # ax.set_xlabel("Year") | ||
| # ax.set_ylabel("Log Partner Balance") | ||
| # ax.set_aspect(1.0 / ax.get_data_ratio(), adjustable='box') | ||
| # vals = np.ma.masked_invalid(data[0][psb(a,s)]) | ||
| # print(psb(a,s), f"mean = {np.mean(vals)}", f"std = {np.std(vals)}", f"average unbalance = {np.round((10**(np.mean(vals))-1)*100,2)}%") | ||
|
|
||
| # Add legend | ||
| axs[0, 0].legend() | ||
|
|
||
| # Adjust spacing between subplots | ||
| plt.tight_layout() | ||
|
|
||
| # Show the combined plot | ||
| plt.show() | ||
|
|
||
| # for (a,s) in product(ages, sexes): | ||
| # for d in data: | ||
| # plt.scatter(1989 + 0.25 * d["Time Step"], d[pps(a, s)]) | ||
| # plt.plot(1989 + 0.25 * data[0]["Time Step"], np.zeros(len(data[0]))) | ||
| # print(pps(a,s), np.mean(d[pps(a,s)]), np.std(d[pps(a,s)]), np.exp(np.mean(d[pps(a,s)]))) | ||
| # plt.title(pps(a, s)) | ||
| # plt.show() | ||
|
|
||
| # for d in data: | ||
| # plt.scatter(d["Time Step"], d["Partner sex balance (15-24, male)"]) | ||
| # plt.plot(data[0]["Time Step"], np.zeros(len(data[0]))) | ||
| # plt.show() | ||
| # | ||
| # for d in data: | ||
| # plt.scatter(d["Time Step"], d["Partner sex balance (25-34, male)"]) | ||
| # plt.plot(data[0]["Time Step"], np.zeros(len(data[0]))) | ||
| # plt.show() | ||
| # | ||
| # for d in data: | ||
| # plt.scatter(d["Time Step"], d["Partner sex balance (35-44, male)"]) | ||
| # plt.plot(data[0]["Time Step"], np.zeros(len(data[0]))) | ||
| # plt.show() | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.