idmtools-test 0.0.0.dev0__py3-none-any.whl → 0.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- idmtools_test/__init__.py +16 -8
- idmtools_test/inputs/__init__.py +0 -0
- idmtools_test/inputs/assets/collections/1/a.txt +0 -0
- idmtools_test/inputs/assets/collections/1/b.txt +0 -0
- idmtools_test/inputs/assets/collections/2/c.txt +0 -0
- idmtools_test/inputs/assets/collections/d.txt +0 -0
- idmtools_test/inputs/builder/sweeps.csv +6 -0
- idmtools_test/inputs/builder/sweeps.yaml +8 -0
- idmtools_test/inputs/compsplatform/__init__.py +0 -0
- idmtools_test/inputs/compsplatform/failing_model.py +5 -0
- idmtools_test/inputs/compsplatform/mixed_model.py +10 -0
- idmtools_test/inputs/compsplatform/working_model.py +5 -0
- idmtools_test/inputs/configuration/idmtools_test.ini +71 -0
- idmtools_test/inputs/custom/Eradication.exe +0 -0
- idmtools_test/inputs/custom/Local_Migration.bin +0 -0
- idmtools_test/inputs/custom/Local_Migration.bin.json +12 -0
- idmtools_test/inputs/custom/Regional_Migration.bin +0 -0
- idmtools_test/inputs/custom/Regional_Migration.bin.json +12 -0
- idmtools_test/inputs/custom/Zambia_30arcsec_air_temperature_daily.bin +0 -0
- idmtools_test/inputs/custom/Zambia_30arcsec_air_temperature_daily.bin.json +26 -0
- idmtools_test/inputs/custom/Zambia_30arcsec_rainfall_daily.bin +0 -0
- idmtools_test/inputs/custom/Zambia_30arcsec_rainfall_daily.bin.json +26 -0
- idmtools_test/inputs/custom/Zambia_30arcsec_relative_humidity_daily.bin +0 -0
- idmtools_test/inputs/custom/Zambia_30arcsec_relative_humidity_daily.bin.json +26 -0
- idmtools_test/inputs/custom/campaign.json +95384 -0
- idmtools_test/inputs/custom/config.json +943 -0
- idmtools_test/inputs/custom/custom_reports.json +163 -0
- idmtools_test/inputs/custom/demo.json +1258 -0
- idmtools_test/inputs/custom/emodules_map.json +9 -0
- idmtools_test/inputs/custom/reporter_plugins/libReportMalariaFiltered.dll +0 -0
- idmtools_test/inputs/custom/reporter_plugins/libSpatialReportMalariaFiltered.dll +0 -0
- idmtools_test/inputs/custom/reporter_plugins/libreporteventcounter.dll +0 -0
- idmtools_test/inputs/duplicated_model/exe/Eradication +0 -0
- idmtools_test/inputs/duplicated_model/f1 +0 -0
- idmtools_test/inputs/emod/Eradication.exe +0 -0
- idmtools_test/inputs/emod_files/campaign.json +21 -0
- idmtools_test/inputs/emod_files/config.json +125 -0
- idmtools_test/inputs/emod_files/demographics.json +81 -0
- idmtools_test/inputs/fakemodels/AnotherOne +0 -0
- idmtools_test/inputs/fakemodels/Eradication +0 -0
- idmtools_test/inputs/fakemodels/Eradication-2.11.custom.exe +0 -0
- idmtools_test/inputs/fakemodels/Eradication.exe +0 -0
- idmtools_test/inputs/files/campaign.json +21 -0
- idmtools_test/inputs/files/config.json +119 -0
- idmtools_test/inputs/files/demographics.json +82 -0
- idmtools_test/inputs/files/hello.txt +1 -0
- idmtools_test/inputs/id_files/slurm.example_python_experiment.id +1 -0
- idmtools_test/inputs/malaria_brazil_central_west_spatial/Assets/Brazil_Central_West_Brazil_Central_West_2.5arcmin_air_temperature_daily.bin +0 -0
- idmtools_test/inputs/malaria_brazil_central_west_spatial/Assets/Brazil_Central_West_Brazil_Central_West_2.5arcmin_air_temperature_daily.bin.json +26 -0
- idmtools_test/inputs/malaria_brazil_central_west_spatial/Assets/Brazil_Central_West_Brazil_Central_West_2.5arcmin_demographics.json +559 -0
- idmtools_test/inputs/malaria_brazil_central_west_spatial/Assets/Brazil_Central_West_Brazil_Central_West_2.5arcmin_rainfall_daily.bin +0 -0
- idmtools_test/inputs/malaria_brazil_central_west_spatial/Assets/Brazil_Central_West_Brazil_Central_West_2.5arcmin_rainfall_daily.bin.json +26 -0
- idmtools_test/inputs/malaria_brazil_central_west_spatial/Assets/Brazil_Central_West_Brazil_Central_West_2.5arcmin_relative_humidity_daily.bin +0 -0
- idmtools_test/inputs/malaria_brazil_central_west_spatial/Assets/Brazil_Central_West_Brazil_Central_West_2.5arcmin_relative_humidity_daily.bin.json +26 -0
- idmtools_test/inputs/malaria_brazil_central_west_spatial/Assets/Eradication +0 -0
- idmtools_test/inputs/malaria_brazil_central_west_spatial/Assets/Eradication.exe +0 -0
- idmtools_test/inputs/malaria_brazil_central_west_spatial/campaign.json +4 -0
- idmtools_test/inputs/malaria_brazil_central_west_spatial/config.json +667 -0
- idmtools_test/inputs/malaria_brazil_central_west_spatial/malaria_brazil_central_west_spatial-ERA5Input_demo.csv +37 -0
- idmtools_test/inputs/python/Assets/MyExternalLibrary/__init__.py +0 -0
- idmtools_test/inputs/python/Assets/MyExternalLibrary/functions.py +15 -0
- idmtools_test/inputs/python/Assets/MyLib/functions.py +2 -0
- idmtools_test/inputs/python/Assets/MyLib/temp.py +271 -0
- idmtools_test/inputs/python/Assets/__init__.py +0 -0
- idmtools_test/inputs/python/__init__.py +0 -0
- idmtools_test/inputs/python/folder_dup_file/__init__.py +0 -0
- idmtools_test/inputs/python/folder_dup_file/model1.py +19 -0
- idmtools_test/inputs/python/hello_world.py +1 -0
- idmtools_test/inputs/python/model.py +26 -0
- idmtools_test/inputs/python/model1.py +20 -0
- idmtools_test/inputs/python/model3.py +21 -0
- idmtools_test/inputs/python/newmodel2.py +20 -0
- idmtools_test/inputs/python/output_generator/generate.py +39 -0
- idmtools_test/inputs/python/realpath_verify.py +6 -0
- idmtools_test/inputs/python/ye_seir_model/Assets/MyExternalLibrary/Python36/dtk_generic_intrahost.pyd +0 -0
- idmtools_test/inputs/python/ye_seir_model/Assets/MyExternalLibrary/Python36/dtk_nodedemog.pyd +0 -0
- idmtools_test/inputs/python/ye_seir_model/Assets/MyExternalLibrary/Python37/dtk_generic_intrahost.pyd +0 -0
- idmtools_test/inputs/python/ye_seir_model/Assets/MyExternalLibrary/Python37/dtk_nodedemog.pyd +0 -0
- idmtools_test/inputs/python/ye_seir_model/Assets/SEIR_model.py +252 -0
- idmtools_test/inputs/python/ye_seir_model/Assets/SEIR_model_slurm.py +242 -0
- idmtools_test/inputs/python/ye_seir_model/Assets/config_sim.py +48 -0
- idmtools_test/inputs/python/ye_seir_model/Assets/custom_csv_analyzer.py +133 -0
- idmtools_test/inputs/python/ye_seir_model/Assets/python.sh +4 -0
- idmtools_test/inputs/python/ye_seir_model/Assets/requirements.txt +4 -0
- idmtools_test/inputs/python/ye_seir_model/Assets/templates/config.json +68 -0
- idmtools_test/inputs/python/ye_seir_model/Assets/templates/demographics_template.json +44 -0
- idmtools_test/inputs/python/ye_seir_model/__init__.py +0 -0
- idmtools_test/inputs/python_experiments/__init__.py +0 -0
- idmtools_test/inputs/python_experiments/model.py +10 -0
- idmtools_test/inputs/r/model1.R +1 -0
- idmtools_test/inputs/r/ncov_analysis/individual_dynamics_estimates/estimate_incubation_period.R +89 -0
- idmtools_test/inputs/regression/107/Assets/__init__.py +0 -0
- idmtools_test/inputs/regression/107/Assets/model.py +1 -0
- idmtools_test/inputs/regression/107/__init__.py +0 -0
- idmtools_test/inputs/regression/125/Assets/__init__.py +0 -0
- idmtools_test/inputs/regression/125/Assets/model.py +1 -0
- idmtools_test/inputs/regression/125/Assets2/__init__.py +0 -0
- idmtools_test/inputs/regression/125/Assets2/dir1/__init__.py +0 -0
- idmtools_test/inputs/regression/125/Assets2/dir1/model.py +1 -0
- idmtools_test/inputs/regression/125/Assets2/dir2/__init__.py +0 -0
- idmtools_test/inputs/regression/125/Assets2/dir2/model.py +1 -0
- idmtools_test/inputs/regression/125/__init__.py +0 -0
- idmtools_test/inputs/regression/__init__.py +0 -0
- idmtools_test/inputs/scheduling/hpc/WorkOrder.json +7 -0
- idmtools_test/inputs/scheduling/slurm/WorkOrder.json +11 -0
- idmtools_test/inputs/scheduling/slurm/WorkOrder1.json +11 -0
- idmtools_test/inputs/scheduling/slurm/WorkOrder2.json +13 -0
- idmtools_test/inputs/scheduling/slurm/commandline_model.py +22 -0
- idmtools_test/inputs/serialization/Eradication.exe +0 -0
- idmtools_test/inputs/serialization/single_node_demographics.json +82 -0
- idmtools_test/inputs/singularity/alpine_simple/Singularity.def +28 -0
- idmtools_test/inputs/singularity/alpine_simple/run_model.py +41 -0
- idmtools_test/inputs/singularity/alpine_template/Singularity.jinja +22 -0
- idmtools_test/test_precreate_hooks.py +25 -0
- idmtools_test/utils/__init__.py +0 -0
- idmtools_test/utils/cli.py +41 -0
- idmtools_test/utils/common_experiments.py +79 -0
- idmtools_test/utils/comps.py +152 -0
- idmtools_test/utils/decorators.py +208 -0
- idmtools_test/utils/execute_operations/__init__.py +0 -0
- idmtools_test/utils/execute_operations/experiment_operations.py +237 -0
- idmtools_test/utils/execute_operations/simulate_operations.py +368 -0
- idmtools_test/utils/itest_with_persistence.py +25 -0
- idmtools_test/utils/operations/__init__.py +0 -0
- idmtools_test/utils/operations/experiment_operations.py +64 -0
- idmtools_test/utils/operations/simulation_operations.py +114 -0
- idmtools_test/utils/shared_functions.py +25 -0
- idmtools_test/utils/test_asset.py +89 -0
- idmtools_test/utils/test_asset_collection.py +223 -0
- idmtools_test/utils/test_execute_platform.py +137 -0
- idmtools_test/utils/test_platform.py +94 -0
- idmtools_test/utils/test_task.py +69 -0
- idmtools_test/utils/utils.py +146 -0
- idmtools_test-0.0.3.dist-info/METADATA +48 -0
- idmtools_test-0.0.3.dist-info/RECORD +139 -0
- idmtools_test-0.0.3.dist-info/entry_points.txt +9 -0
- idmtools_test-0.0.3.dist-info/licenses/LICENSE.TXT +3 -0
- idmtools_test-0.0.0.dev0.dist-info/METADATA +0 -41
- idmtools_test-0.0.0.dev0.dist-info/RECORD +0 -5
- {idmtools_test-0.0.0.dev0.dist-info → idmtools_test-0.0.3.dist-info}/WHEEL +0 -0
- {idmtools_test-0.0.0.dev0.dist-info → idmtools_test-0.0.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Age_Initialization_Distribution_Type": "DISTRIBUTION_SIMPLE",
|
|
3
|
+
"Base_Individual_Sample_Rate": 1,
|
|
4
|
+
"Base_Infectivity_Distribution": "CONSTANT_DISTRIBUTION",
|
|
5
|
+
"Base_Year": 2015,
|
|
6
|
+
"Birth_Rate_Dependence": "FIXED_BIRTH_RATE",
|
|
7
|
+
"Birth_Rate_Time_Dependence": "NONE",
|
|
8
|
+
"Config_Name": "Generic_BaseInfectivityDistribution-NOT_INITIALIZED",
|
|
9
|
+
"Custom_Coordinator_Events": [],
|
|
10
|
+
"Custom_Individual_Events": [],
|
|
11
|
+
"Custom_Node_Events": [],
|
|
12
|
+
"Custom_Reports_Filename": "",
|
|
13
|
+
"Death_Rate_Dependence": "NOT_INITIALIZED",
|
|
14
|
+
"Demographics_Filenames": [
|
|
15
|
+
"demographics.json"
|
|
16
|
+
],
|
|
17
|
+
"Enable_Aging": 1,
|
|
18
|
+
"Enable_Birth": 1,
|
|
19
|
+
"Enable_Demographics_Birth": 0,
|
|
20
|
+
"Enable_Demographics_Builtin": 0,
|
|
21
|
+
"Enable_Demographics_Gender": 0,
|
|
22
|
+
"Enable_Demographics_Other": 0,
|
|
23
|
+
"Enable_Demographics_Risk": 0,
|
|
24
|
+
"Enable_Disease_Mortality": 0,
|
|
25
|
+
"Enable_Heterogeneous_Intranode_Transmission": 0,
|
|
26
|
+
"Enable_Immunity": 1,
|
|
27
|
+
"Enable_Immunity_Initialization_Distribution": 0,
|
|
28
|
+
"Enable_Infectivity_Reservoir": 0,
|
|
29
|
+
"Enable_Infectivity_Scaling": 0,
|
|
30
|
+
"Enable_Initial_Prevalence": 0,
|
|
31
|
+
"Enable_Initial_Susceptibility_Distribution": 1,
|
|
32
|
+
"Enable_Interventions": 0,
|
|
33
|
+
"Enable_Maternal_Infection_Transmission": 0,
|
|
34
|
+
"Enable_Maternal_Transmission": 0,
|
|
35
|
+
"Enable_Natural_Mortality": 1,
|
|
36
|
+
"Enable_Susceptibility_Scaling": 0,
|
|
37
|
+
"Enable_Vital_Dynamics": 1,
|
|
38
|
+
"Incubation_Period_Constant": 0,
|
|
39
|
+
"Incubation_Period_Distribution": "CONSTANT_DISTRIBUTION",
|
|
40
|
+
"Individual_Sampling_Type": "FIXED_SAMPLING",
|
|
41
|
+
"Infectious_Period_Distribution": "CONSTANT_DISTRIBUTION",
|
|
42
|
+
"Listed_Events": [],
|
|
43
|
+
"Migration_Model": "NO_MIGRATION",
|
|
44
|
+
"Node_Grid_Size": 0.005,
|
|
45
|
+
"Number_Basestrains": 1,
|
|
46
|
+
"Number_Substrains": 1,
|
|
47
|
+
"Num_Cores": 1,
|
|
48
|
+
"Population_Scale_Type": "FIXED_SCALING",
|
|
49
|
+
"Post_Infection_Acquisition_Multiplier" : 0,
|
|
50
|
+
"Post_Infection_Transmission_Multiplier": 0,
|
|
51
|
+
"Post_Infection_Mortality_Multiplier": 0,
|
|
52
|
+
"Run_Number": 1,
|
|
53
|
+
"Sample_Rate_0_18mo": 1,
|
|
54
|
+
"Sample_Rate_10_14": 1,
|
|
55
|
+
"Sample_Rate_15_19": 1,
|
|
56
|
+
"Sample_Rate_18mo_4yr": 1,
|
|
57
|
+
"Sample_Rate_20_Plus": 1,
|
|
58
|
+
"Sample_Rate_5_9": 1,
|
|
59
|
+
"Sample_Rate_Birth": 1,
|
|
60
|
+
"Simulation_Duration": 2,
|
|
61
|
+
"Simulation_Timestep": 1,
|
|
62
|
+
"Simulation_Type": "GENERIC_SIM",
|
|
63
|
+
"Start_Time": 0,
|
|
64
|
+
"Susceptibility_Initialization_Distribution_Type": "DISTRIBUTION_OFF",
|
|
65
|
+
"x_Base_Population": 1,
|
|
66
|
+
"x_Birth": 10,
|
|
67
|
+
"x_Other_Mortality": 1
|
|
68
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Metadata": {
|
|
3
|
+
"DateCreated": "Sun Sep 25 23:19:55 2011",
|
|
4
|
+
"Tool": "convertdemog.py",
|
|
5
|
+
"Author": "jsteinkraus",
|
|
6
|
+
"IdReference": "Gridded world grump2.5arcmin",
|
|
7
|
+
"NodeCount": 1,
|
|
8
|
+
"Resolution": 150
|
|
9
|
+
},
|
|
10
|
+
"Defaults": {
|
|
11
|
+
},
|
|
12
|
+
"Nodes": [
|
|
13
|
+
{
|
|
14
|
+
"NodeID": 1,
|
|
15
|
+
"NodeAttributes": {
|
|
16
|
+
"Latitude": 1,
|
|
17
|
+
"Longitude": 1,
|
|
18
|
+
"Altitude": 0,
|
|
19
|
+
"Airport": 0,
|
|
20
|
+
"Region": 1,
|
|
21
|
+
"Seaport": 0,
|
|
22
|
+
"InitialPopulation": 10000,
|
|
23
|
+
"BirthRate": 0.0548
|
|
24
|
+
},
|
|
25
|
+
"IndividualAttributes": {
|
|
26
|
+
"AgeDistributionFlag": 3,
|
|
27
|
+
"AgeDistribution1": 0.000118,
|
|
28
|
+
"AgeDistribution2": 0,
|
|
29
|
+
"PrevalenceDistributionFlag": 0,
|
|
30
|
+
"PrevalenceDistribution1": 0.0,
|
|
31
|
+
"PrevalenceDistribution2": 0.0,
|
|
32
|
+
"SusceptibilityDistributionFlag": 0,
|
|
33
|
+
"SusceptibilityDistribution1": 1,
|
|
34
|
+
"SusceptibilityDistribution2": 0,
|
|
35
|
+
"RiskDistributionFlag": 0,
|
|
36
|
+
"RiskDistribution1": 1,
|
|
37
|
+
"RiskDistribution2": 0,
|
|
38
|
+
"MigrationHeterogeneityDistributionFlag": 0,
|
|
39
|
+
"MigrationHeterogeneityDistribution1": 1,
|
|
40
|
+
"MigrationHeterogeneityDistribution2": 0
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
print("Hello World!")
|
idmtools_test/inputs/r/ncov_analysis/individual_dynamics_estimates/estimate_incubation_period.R
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# estimate incubation period
|
|
2
|
+
|
|
3
|
+
# library(tidyverse, lib.loc="./Assets/ncov_analysis/individual_dynamics_estimates/library")
|
|
4
|
+
# library(survival, lib.loc="./Assets/ncov_analysis/individual_dynamics_estimates/library")
|
|
5
|
+
# library(flexsurv, lib.loc="./Assets/ncov_analysis/individual_dynamics_estimates/library")
|
|
6
|
+
# library(ggplot2, lib.loc="./Assets/ncov_analysis/individual_dynamics_estimates/library")
|
|
7
|
+
# #library(survminer)
|
|
8
|
+
# #library(cowplot)
|
|
9
|
+
# library(gridExtra, lib.loc="./Assets/ncov_analysis/individual_dynamics_estimates/library")
|
|
10
|
+
system('apt-get update -y libcurl4-openssl-dev libxml2-dev libssl-dev --fix-missing')
|
|
11
|
+
|
|
12
|
+
packages = c("tidyverse","survival","flexsurv","ggplot2","gridExtra")
|
|
13
|
+
for(i in packages){
|
|
14
|
+
if(!require(i, character.only = T)){
|
|
15
|
+
install.packages(i)
|
|
16
|
+
library(i, character.only = T)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
linelist <- read.csv('./Assets/Kudos to DXY.cn Last update_ 01_25_2020, 11_30 am (EST) - Line-list.csv', header=TRUE)
|
|
22
|
+
linelist$date <- as.Date(linelist$date)
|
|
23
|
+
linelist$symptom_onset <- as.Date(linelist$symptom_onset)
|
|
24
|
+
linelist$hosp_visit_date <- as.Date(linelist$hosp_visit_date)
|
|
25
|
+
linelist$exposure_start <- as.Date(linelist$exposure_start)
|
|
26
|
+
linelist$exposure_end <- as.Date(linelist$exposure_end)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# incubation = duration from exposure to onset
|
|
31
|
+
# censored survival analysis
|
|
32
|
+
|
|
33
|
+
t1 <- as.numeric(linelist$symptom_onset - linelist$exposure_end)
|
|
34
|
+
t1 <- pmax(1,t1)
|
|
35
|
+
t2 <- as.numeric(linelist$symptom_onset - linelist$exposure_start)
|
|
36
|
+
st <- data.frame(t1=t1,t2=t2,status=3)
|
|
37
|
+
|
|
38
|
+
st<- st[!is.na(st$t1) | !is.na(st$t2),]
|
|
39
|
+
|
|
40
|
+
surv_object <- Surv(time = st$t1,
|
|
41
|
+
time2 = st$t2,
|
|
42
|
+
type='interval2')
|
|
43
|
+
|
|
44
|
+
mod <- survfit(surv_object~1,data=st)
|
|
45
|
+
plot(mod)
|
|
46
|
+
|
|
47
|
+
mod2<-flexsurvreg(surv_object ~ 1, dist="exponential", data=st)
|
|
48
|
+
ggflexsurvplot(mod2,conf.int = TRUE)
|
|
49
|
+
mod2
|
|
50
|
+
|
|
51
|
+
mod2a<-flexsurvreg(surv_object ~ 1, dist="weibull", data=st)
|
|
52
|
+
ggflexsurvplot(mod2,conf.int = TRUE)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
mod3<-flexsurvreg(surv_object ~ 1, dist="lognormal", data=st)
|
|
56
|
+
ggflexsurvplot(mod3,conf.int = TRUE, summary.flexsurv = summary(mod3,t=seq(1,20,by=0.1)))
|
|
57
|
+
mod3
|
|
58
|
+
|
|
59
|
+
predMod <- as.data.frame(summary(mod3,t=seq(1,100,by=0.1)))
|
|
60
|
+
|
|
61
|
+
kmp <- ggsurvplot(mod,risk.table = TRUE, xlim=c(0,20), conf.int = FALSE) + guides(color=FALSE)
|
|
62
|
+
|
|
63
|
+
p1<-kmp$plot + geom_line(data=predMod,aes(x=time,y=est)) +
|
|
64
|
+
geom_line(data=predMod,aes(x=time,y=lcl),linetype='dashed') +
|
|
65
|
+
geom_line(data=predMod,aes(x=time,y=ucl),linetype='dashed') +
|
|
66
|
+
scale_x_continuous(limits=c(0,20), breaks=seq(0,20,by=2)) +
|
|
67
|
+
xlab('') + ylab('probability')
|
|
68
|
+
|
|
69
|
+
p2<- kmp$table + scale_x_continuous(limits=c(0,20), breaks=seq(0,20,by=2)) +
|
|
70
|
+
xlab('days from exposure to symptom onset') + ylab('')
|
|
71
|
+
|
|
72
|
+
plot_grid(p1,p2,nrow = 2, rel_heights = c(0.7,0.25), align='v')
|
|
73
|
+
|
|
74
|
+
ggsave('./sitrep/incubation_period_estimate/incubation_from_linelist.png',width=5, height=5,units='in',dpi=600)
|
|
75
|
+
|
|
76
|
+
incubationIntervals<-matrix(c(predMod$time[min(which(predMod$est<=0.5))], predMod$time[min(which(predMod$est<=0.975))],predMod$time[min(which(predMod$est<=0.025))],
|
|
77
|
+
predMod$time[min(which(predMod$lcl<=0.5))], predMod$time[min(which(predMod$lcl<=0.975))],predMod$time[min(which(predMod$lcl<=0.025))],
|
|
78
|
+
predMod$time[min(which(predMod$ucl<=0.5))], predMod$time[min(which(predMod$ucl<=0.975))],predMod$time[min(which(predMod$ucl<=0.025))]),
|
|
79
|
+
ncol = 3)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
incubationIntervals <- data.frame(incubationIntervals,row.names = c('duration_median','duration_lower95','duration_upper95'))
|
|
83
|
+
names(incubationIntervals) <- c('model_mle','model_lcl','model_ucl')
|
|
84
|
+
incubationIntervals
|
|
85
|
+
|
|
86
|
+
png('./sitrep/incubation_period_estimate/incubation_from_linelist_summary.png',width=5, height=1.5,units='in',res=600)
|
|
87
|
+
grid.arrange(tableGrob(incubationIntervals))
|
|
88
|
+
dev.off()
|
|
89
|
+
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
print("Hello World")
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
print("Hello World")
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
print("Hello World")
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
print("Hello World2")
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Command": "python3 Assets/model.py",
|
|
3
|
+
"NodeGroupName": "idm_abcd",
|
|
4
|
+
"NumCores": 1,
|
|
5
|
+
"NumProcesses": 1,
|
|
6
|
+
"NumNodes": 1,
|
|
7
|
+
"Environment": {
|
|
8
|
+
"key1": "value1",
|
|
9
|
+
"key2": "value2",
|
|
10
|
+
"PYTHONPATH": "$PYTHONPATH:$PWD/Assets:$PWD/Assets/site-packages",
|
|
11
|
+
"PATH": "$PATH:$PWD/Assets:$PWD/Assets/site-packages"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import time
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def test_sweep(pop_size=10000, pop_infected=10, n_days=120, rand_seed=1, pop_type='hybrid'):
|
|
6
|
+
pars = {
|
|
7
|
+
"pop_size": pop_size, # Population size
|
|
8
|
+
"pop_infected": pop_infected, # Number of initial infections
|
|
9
|
+
"n_days": n_days, # Number of days to simulate
|
|
10
|
+
"rand_seed": rand_seed, # Random seed
|
|
11
|
+
"pop_type": pop_type, # Population to use -- "hybrid" is random with household, school,and work structure
|
|
12
|
+
}
|
|
13
|
+
print(str(pars))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
if __name__ == "__main__":
|
|
17
|
+
pop_size= sys.argv[1]
|
|
18
|
+
pop_infected = sys.argv[2]
|
|
19
|
+
n_days = int(sys.argv[3])
|
|
20
|
+
rand_seed = sys.argv[4]
|
|
21
|
+
|
|
22
|
+
test_sweep(pop_size=pop_size, pop_infected=pop_infected, n_days=n_days, rand_seed=rand_seed, pop_type='hybrid')
|
|
Binary file
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Metadata": {
|
|
3
|
+
"Author": "jsteinkraus",
|
|
4
|
+
"DateCreated": "Sun Sep 25 23:19:55 2011",
|
|
5
|
+
"IdReference": "Gridded world grump2.5arcmin",
|
|
6
|
+
"NodeCount": 1,
|
|
7
|
+
"Tool": "convertdemog.py"
|
|
8
|
+
},
|
|
9
|
+
"Nodes": [
|
|
10
|
+
{
|
|
11
|
+
"IndividualAttributes": {
|
|
12
|
+
"AgeDistributionFlag": 3,
|
|
13
|
+
"AgeDistribution1": 0.000118,
|
|
14
|
+
"AgeDistribution2": 0,
|
|
15
|
+
"ImmunityDistribution1": 1,
|
|
16
|
+
"ImmunityDistribution2": 0,
|
|
17
|
+
"ImmunityDistributionFlag": 0,
|
|
18
|
+
"MigrationHeterogeneityDistribution1": 1,
|
|
19
|
+
"MigrationHeterogeneityDistribution2": 0,
|
|
20
|
+
"MigrationHeterogeneityDistributionFlag": 0,
|
|
21
|
+
"MortalityDistribution": {
|
|
22
|
+
"AxisNames": [
|
|
23
|
+
"gender",
|
|
24
|
+
"age"
|
|
25
|
+
],
|
|
26
|
+
"AxisScaleFactors": [
|
|
27
|
+
1,
|
|
28
|
+
365
|
|
29
|
+
],
|
|
30
|
+
"AxisUnits": [
|
|
31
|
+
"male=0,female=1",
|
|
32
|
+
"years"
|
|
33
|
+
],
|
|
34
|
+
"NumDistributionAxes": 2,
|
|
35
|
+
"NumPopulationGroups": [
|
|
36
|
+
2,
|
|
37
|
+
1
|
|
38
|
+
],
|
|
39
|
+
"PopulationGroups": [
|
|
40
|
+
[
|
|
41
|
+
0,
|
|
42
|
+
1
|
|
43
|
+
],
|
|
44
|
+
[
|
|
45
|
+
0
|
|
46
|
+
]
|
|
47
|
+
],
|
|
48
|
+
"ResultScaleFactor": 2.74e-06,
|
|
49
|
+
"ResultUnits": "annual deaths per 1000 individuals",
|
|
50
|
+
"ResultValues": [
|
|
51
|
+
[
|
|
52
|
+
45
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
45
|
|
56
|
+
]
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"PrevalenceDistribution1": 0.1,
|
|
60
|
+
"PrevalenceDistribution2": 0,
|
|
61
|
+
"PrevalenceDistributionFlag": 0,
|
|
62
|
+
"RiskDistribution1": 1,
|
|
63
|
+
"RiskDistribution2": 0,
|
|
64
|
+
"RiskDistributionFlag": 0
|
|
65
|
+
},
|
|
66
|
+
"NodeAttributes": {
|
|
67
|
+
"AbovePoverty": 0.5,
|
|
68
|
+
"Airport": 0,
|
|
69
|
+
"Altitude": 0,
|
|
70
|
+
"BirthRate": 0.1234,
|
|
71
|
+
"Birth_Rate_Dependence": "FIXED_BIRTH_RATE",
|
|
72
|
+
"InitialPopulation": 1000,
|
|
73
|
+
"Latitude": -8.5,
|
|
74
|
+
"Longitude": 36.5,
|
|
75
|
+
"Region": 1,
|
|
76
|
+
"Seaport": 0,
|
|
77
|
+
"Urban": 0
|
|
78
|
+
},
|
|
79
|
+
"NodeID": 340461476
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Bootstrap: docker
|
|
2
|
+
From: python:3.8.6
|
|
3
|
+
|
|
4
|
+
%setup
|
|
5
|
+
mkdir /model
|
|
6
|
+
|
|
7
|
+
%files
|
|
8
|
+
Assets/run_model.py /model/
|
|
9
|
+
|
|
10
|
+
%post
|
|
11
|
+
apt-get -y update && apt-get install -y gcc
|
|
12
|
+
pip3 install wheel
|
|
13
|
+
pip3 install epistoch==0.1.13
|
|
14
|
+
|
|
15
|
+
%runscript
|
|
16
|
+
echo "Container was created $NOW"
|
|
17
|
+
echo "Arguments received: $*"
|
|
18
|
+
exec "$@"
|
|
19
|
+
|
|
20
|
+
%environment
|
|
21
|
+
export MPLBACKEND=Agg
|
|
22
|
+
|
|
23
|
+
%labels
|
|
24
|
+
Author ccollins@idmod.org
|
|
25
|
+
Version v0.0.1
|
|
26
|
+
|
|
27
|
+
%help
|
|
28
|
+
This is a demo container used to demo idmtools builds
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
from epistoch import *
|
|
3
|
+
from epistoch.utils.plotting import plot_sir
|
|
4
|
+
from scipy import stats
|
|
5
|
+
import matplotlib.pyplot as plt
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def run_sir_model(population, num_days, r0):
|
|
10
|
+
# Let's build a SIR-G model
|
|
11
|
+
|
|
12
|
+
dist = stats.gamma(a=2, scale=10)
|
|
13
|
+
# The expected time is 20 days
|
|
14
|
+
|
|
15
|
+
SIR_general = sir_g(
|
|
16
|
+
name="SIR-G-Example",
|
|
17
|
+
population=population,
|
|
18
|
+
num_days=num_days,
|
|
19
|
+
reproductive_factor=r0,
|
|
20
|
+
infectious_time_distribution=dist,
|
|
21
|
+
method="loss",
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
# Report a summary
|
|
25
|
+
report_summary(SIR_general)
|
|
26
|
+
|
|
27
|
+
# Now plot the result
|
|
28
|
+
plot_sir(SIR_general)
|
|
29
|
+
plt.savefig("result.png")
|
|
30
|
+
|
|
31
|
+
print(SIR_general["data"])
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
if __name__ == "__main__":
|
|
35
|
+
parser = argparse.ArgumentParser()
|
|
36
|
+
parser.add_argument("--population", default=1000, type=int, help="Population")
|
|
37
|
+
parser.add_argument("--num-days", default=230, type=int, help="Num of days")
|
|
38
|
+
parser.add_argument("--r0", default=2.2, type=float, help="Reproduction Factory")
|
|
39
|
+
|
|
40
|
+
args = parser.parse_args()
|
|
41
|
+
run_sir_model(args.population, args.num_days, args.r0)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Bootstrap: docker
|
|
2
|
+
From: python:{{ python_version }}
|
|
3
|
+
|
|
4
|
+
%post
|
|
5
|
+
apt-get -y update && apt-get install -y gcc
|
|
6
|
+
pip3 install wheel
|
|
7
|
+
pip3 install {% for package in packages %}{{package}} {% endfor %}
|
|
8
|
+
|
|
9
|
+
%runscript
|
|
10
|
+
echo "Container was created $NOW"
|
|
11
|
+
echo "Arguments received: $*"
|
|
12
|
+
exec "$@"
|
|
13
|
+
|
|
14
|
+
%environment
|
|
15
|
+
export MPLBACKEND=Agg
|
|
16
|
+
|
|
17
|
+
%labels
|
|
18
|
+
Author ccollins@idmod.org
|
|
19
|
+
Version v0.0.1
|
|
20
|
+
|
|
21
|
+
%help
|
|
22
|
+
This is a demo container used to demo idmtools templates
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import contextlib
|
|
3
|
+
from idmtools.core import TRUTHY_VALUES, getLogger
|
|
4
|
+
from idmtools.registry.hook_specs import function_hook_impl
|
|
5
|
+
|
|
6
|
+
TEST_WITH_NEW_CODE = os.environ.get("TEST_WITH_PACKAGES", 'n').lower() in TRUTHY_VALUES
|
|
7
|
+
logger = getLogger(__name__)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Make a plugin here to load our local packages if needed to test CLI functions
|
|
11
|
+
@function_hook_impl
|
|
12
|
+
def idmtools_platform_pre_create_item(item: 'IEntity', **kwargs):
|
|
13
|
+
# do it dynamically
|
|
14
|
+
load_packages_to_ssmt_image_dynamically(item)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def load_packages_to_ssmt_image_dynamically(item):
|
|
18
|
+
with contextlib.suppress(ImportError):
|
|
19
|
+
from idmtools_platform_comps.utils.assetize_output.assetize_output import AssetizeOutput
|
|
20
|
+
from idmtools_platform_comps.utils.download.download import DownloadWorkItem
|
|
21
|
+
from idmtools_test.utils.comps import load_library_dynamically
|
|
22
|
+
if os.environ.get("TEST_WITH_PACKAGES", 'n').lower() in TRUTHY_VALUES:
|
|
23
|
+
logger.debug("TEST WITH NEW CODE is enabled. Adding COMPS and IDMTOOLS package to asset")
|
|
24
|
+
if isinstance(item, (AssetizeOutput, DownloadWorkItem)):
|
|
25
|
+
item.add_pre_creation_hook(load_library_dynamically)
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from typing import List, Dict
|
|
2
|
+
|
|
3
|
+
from click.testing import CliRunner, Result
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def get_subcommands_from_help_result(result):
|
|
7
|
+
lines = striped_cli_output_lines(result)
|
|
8
|
+
found_commands_header = False
|
|
9
|
+
while not found_commands_header:
|
|
10
|
+
nex = lines.pop(0)
|
|
11
|
+
if nex == "Commands:":
|
|
12
|
+
found_commands_header = True
|
|
13
|
+
# filter down to just the name
|
|
14
|
+
lines = [l.split(None, 1)[0].strip() for l in lines]
|
|
15
|
+
return lines
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def striped_cli_output_lines(result):
|
|
19
|
+
return list(filter(lambda x: len(x), map(str.strip, result.output.split('\n'))))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def invoke_command(*args, start_command=None, mix_stderr: bool = True, env: Dict[str, str] = None):
|
|
23
|
+
if env is None:
|
|
24
|
+
env = dict()
|
|
25
|
+
if start_command is None:
|
|
26
|
+
start_command = []
|
|
27
|
+
from idmtools_cli.main import start
|
|
28
|
+
from idmtools_cli.cli.entrypoint import cli
|
|
29
|
+
start()
|
|
30
|
+
runner = CliRunner(mix_stderr=mix_stderr, env=env)
|
|
31
|
+
final_command = start_command + list(args) if len(args) else start_command
|
|
32
|
+
result = runner.invoke(cli, final_command, env=env)
|
|
33
|
+
return result
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def run_command(*args: str, start_command: List[str] = None, base_command: str = None, mix_stderr: bool = True, env: Dict[str, str] = None) -> Result:
|
|
37
|
+
if start_command is None:
|
|
38
|
+
start_command = []
|
|
39
|
+
if base_command:
|
|
40
|
+
start_command.append(base_command)
|
|
41
|
+
return invoke_command(*args, start_command=start_command, mix_stderr=mix_stderr, env=env)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from idmtools.assets import AssetCollection
|
|
4
|
+
from idmtools.core import EntityStatus
|
|
5
|
+
from idmtools.entities.experiment import Experiment
|
|
6
|
+
from idmtools.entities.templated_simulation import TemplatedSimulations
|
|
7
|
+
from idmtools_test import COMMON_INPUT_PATH
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_model_py_templated_experiment(case_name: str, default_parameters: dict = None,
|
|
11
|
+
assets_path: str = os.path.join(COMMON_INPUT_PATH, "python", "Assets",
|
|
12
|
+
"MyExternalLibrary"),
|
|
13
|
+
relative_path="MyExternalLibrary", templated_simulations=None) -> Experiment:
|
|
14
|
+
"""
|
|
15
|
+
Returns an experiment using inputs/python/model.py and a JSONConfiguredPythonTask as the task
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
case_name: Test case name
|
|
19
|
+
default_parameters: Default parameters from model
|
|
20
|
+
assets_path: Default path to assets
|
|
21
|
+
relative_path: Relative path to add to assets
|
|
22
|
+
templated_simulations:Optional override for templated simulations
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
from idmtools_models.python.json_python_task import JSONConfiguredPythonTask
|
|
28
|
+
|
|
29
|
+
if default_parameters is None:
|
|
30
|
+
default_parameters = dict()
|
|
31
|
+
model_path = os.path.join(COMMON_INPUT_PATH, "python", "model.py")
|
|
32
|
+
ac = AssetCollection()
|
|
33
|
+
ac.add_directory(assets_directory=assets_path, relative_path=relative_path)
|
|
34
|
+
task = JSONConfiguredPythonTask(script_path=model_path, envelope="parameters", parameters=default_parameters)
|
|
35
|
+
if templated_simulations is None:
|
|
36
|
+
templated_simulations = TemplatedSimulations(base_task=task)
|
|
37
|
+
e = Experiment(name=case_name, simulations=templated_simulations, assets=ac)
|
|
38
|
+
# assets=AssetCollection.from_directory(assets_directory=assets_path, relative_path="MyExternalLibrary"))
|
|
39
|
+
e.tags = {"string_tag": "test", "number_tag": 123}
|
|
40
|
+
return e
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def get_model1_templated_experiment(case_name, parameters=None):
|
|
44
|
+
from idmtools_models.python.json_python_task import JSONConfiguredPythonTask
|
|
45
|
+
if parameters is None:
|
|
46
|
+
parameters = dict(c='c-value')
|
|
47
|
+
model_path = os.path.join(COMMON_INPUT_PATH, "python", "model1.py")
|
|
48
|
+
e = Experiment(name=case_name,
|
|
49
|
+
simulations=TemplatedSimulations(base_task=JSONConfiguredPythonTask(parameters=parameters,
|
|
50
|
+
script_path=model_path)
|
|
51
|
+
))
|
|
52
|
+
e.tags = {"string_tag": "test", "number_tag": 123, "KeyOnly": None}
|
|
53
|
+
return e
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def wait_on_experiment_and_check_all_sim_status(tc, experiment, platform=None,
|
|
57
|
+
expected_status: EntityStatus = EntityStatus.SUCCEEDED,
|
|
58
|
+
scheduling=False):
|
|
59
|
+
"""
|
|
60
|
+
Run experiment and wait for it to finish then check all sims succeeded
|
|
61
|
+
Args:
|
|
62
|
+
tc: Test case(self)
|
|
63
|
+
experiment: Experiment object
|
|
64
|
+
platform: Platform
|
|
65
|
+
expected_status: Expected status
|
|
66
|
+
Returns:
|
|
67
|
+
|
|
68
|
+
"""
|
|
69
|
+
experiment.run(wait_until_done=True, scheduling=scheduling, retries=5)
|
|
70
|
+
if isinstance(tc, type):
|
|
71
|
+
tc.assertTrue(tc, all([s.status == expected_status for s in experiment.simulations]))
|
|
72
|
+
else:
|
|
73
|
+
tc.assertTrue(all([s.status == expected_status for s in experiment.simulations]))
|
|
74
|
+
if expected_status is EntityStatus.SUCCEEDED:
|
|
75
|
+
tc.assertTrue(experiment.done)
|
|
76
|
+
tc.assertTrue(experiment.succeeded)
|
|
77
|
+
elif expected_status is EntityStatus.FAILED:
|
|
78
|
+
tc.assertFalse(experiment.succeeded)
|
|
79
|
+
return experiment
|