Skip to content
Open
Show file tree
Hide file tree
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 Jun 17, 2024
fca5661
Merge branch 'development' into create_art_module
mmcleod89 Jun 20, 2024
6a949e1
add art data reading
mmcleod89 Jun 24, 2024
f38078d
Ignore output types
mmcleod89 Jun 25, 2024
280ce96
Merge branch 'development' into create_art_module
mmcleod89 Nov 26, 2024
084519b
Ignore graph folders
mmcleod89 Nov 26, 2024
f3e0ca1
Add more ART fields
mmcleod89 Feb 3, 2025
fdfd6cb
Merge branch 'development' into create_art_module
mmcleod89 Jun 10, 2025
379320b
Add HIV/ART monitoring variables
mmcleod89 Jun 12, 2025
90ee71b
Implement additional art param updates and begin regimens
mmcleod89 Jun 17, 2025
158e609
Update ART regimens
mmcleod89 Jul 13, 2025
8bef887
Initialise ART variables and add beta distributions
mmcleod89 Jul 13, 2025
3f75e70
Renaming and refactoring
mmcleod89 Jul 13, 2025
c95319c
Add clinic visit column
mmcleod89 Jul 13, 2025
679b398
begin adding clinic visits
mmcleod89 Jul 14, 2025
3c6c286
Fix data reading / initialisation
mmcleod89 Jul 14, 2025
79bda93
Temp fix for testing issue (to be investigated)
mmcleod89 Jul 14, 2025
1228bdb
Fix beta distributions
mmcleod89 Jul 14, 2025
4e5fad3
Simplest fix for df fragmentation
mmcleod89 Jul 14, 2025
cefc37a
Style (imports)
mmcleod89 Jul 14, 2025
cb9226f
style fixes
mmcleod89 Jul 14, 2025
59f8e51
Cases for initialisation of ART
mmcleod89 Jul 15, 2025
fe3530b
Apply art initiatlisation
mmcleod89 Jul 15, 2025
11e420e
reformatting
mmcleod89 Jul 15, 2025
ce63d68
Move PMTCT to pregnancy
mmcleod89 Jul 21, 2025
03e6a82
Bug fix and adapt ANC test
mmcleod89 Jul 21, 2025
f6e573e
Add mutations to PMTCT
mmcleod89 Jul 21, 2025
a26456d
sort includes
mmcleod89 Jul 21, 2025
9f885df
auto-formatting
mmcleod89 Jul 21, 2025
5468822
unused imports
mmcleod89 Jul 21, 2025
8402019
Tools cannot agree on import formatting
mmcleod89 Jul 21, 2025
3095e03
start art interrupt
mmcleod89 Jul 23, 2025
c133a28
update histories explicitly
mmcleod89 Jul 23, 2025
3becf0a
Resistance module has reference to population
mmcleod89 Jul 23, 2025
2cceef8
Discard unneeded get col dt
mmcleod89 Jul 23, 2025
c76bc1a
Formatting
mmcleod89 Jul 23, 2025
46726c3
Merge pull request #223 from UCL/module_restructure
mmcleod89 Jul 23, 2025
c2fc7fe
Update ON_ART to have a history
mmcleod89 Jul 23, 2025
e5c9d94
Fix data access for prep, circumcision, and resistance
mmcleod89 Jul 23, 2025
486b259
Fix data access
mmcleod89 Jul 23, 2025
059e9a5
Fix data access
mmcleod89 Jul 23, 2025
3617993
Fix range based access
mmcleod89 Jul 23, 2025
69a4f1b
Fixing data access
mmcleod89 Jul 23, 2025
86139b5
fix data access
mmcleod89 Jul 23, 2025
027cdd6
Fix data access
mmcleod89 Jul 23, 2025
8ea61d3
Fudging data access because tests mess with the past
mmcleod89 Jul 23, 2025
2e10ed1
Data access tweak
mmcleod89 Jul 23, 2025
b238bf9
Fixing circumcision data access and consequences
mmcleod89 Jul 23, 2025
323bd33
Adding history to prep values
mmcleod89 Jul 23, 2025
2229036
Auto formatting
mmcleod89 Jul 24, 2025
5eae080
Reference population in art module
mmcleod89 Jul 24, 2025
c75ac79
Adding fields to art and implementing interruption
mmcleod89 Jul 24, 2025
65a5bf2
Updating Date / TimeDelta to use capitals
mmcleod89 Jul 24, 2025
bacafec
Fix lencab update
mmcleod89 Jul 24, 2025
a881c3f
Formatting
mmcleod89 Jul 24, 2025
8c8e7e4
Add interruption of supply
mmcleod89 Jul 24, 2025
cfdcd5d
Move ARVs to ART module and implement adh dists
mmcleod89 Jul 24, 2025
68040bf
Finish adherence patterns
mmcleod89 Jul 24, 2025
5babe88
Finish interruptions and adherence
mmcleod89 Jul 24, 2025
32421aa
Formatting and new columns
mmcleod89 Jul 24, 2025
0e91ec3
ART restart
mmcleod89 Jul 24, 2025
d03eec3
reinitiate ART
mmcleod89 Jul 24, 2025
f4c0306
First line regimen
mmcleod89 Jul 24, 2025
746a749
Updating compatibility and dependency list
mmcleod89 Sep 1, 2025
8e16f55
Simplified ART implementation
mmcleod89 Sep 22, 2025
44a0fba
Update LTP risk test
mmcleod89 Sep 22, 2025
ce6ac52
Add second line therapy switch and fix some pandas issues
mmcleod89 Oct 1, 2025
6190a20
Fixing output warnings
mmcleod89 Oct 1, 2025
63e4597
Style fixes
mmcleod89 Oct 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
.vscode/*
log/
output/
SAS_OUTPUTS/
SASGRAPHS/
HIVPY_OUTPUTS/
GRAPHS/

# Compiled and packaged files
*.egg-info/
Expand All @@ -13,3 +17,8 @@ __pycache__/

# Generated documentation
_build

*.png
*.sas7bdat
*.csv
*.sh
2 changes: 1 addition & 1 deletion hivpy.yaml
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
Expand Down
98 changes: 98 additions & 0 deletions plots.py
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()

6 changes: 4 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ package_dir =
packages = find:
python_requires = >=3.7
install_requires =
pandas<1.4
numpy<2.0.0
pandas
numpy
scipy
pyyaml
matplotlib
titlecase
sas7bdat
pytest
pytest-mock

[options.packages.find]
where = src
Expand Down
Loading