Skip to content
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

4 add files for lct paper #7

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

lenaploetzke
Copy link
Member

@lenaploetzke lenaploetzke commented Jan 24, 2025

Changes and Information

Please briefly list the changes (main added features, changed items, or corrected bugs) made:

  • Added simulation scripts, shell scripts (to get all the data with one command), and plot scripts used to create the figures of the LCT paper.
  • I validated that the figures in the paper look the same as the outputs using these files.

If need be, add additional information and what the reviewer should look out for in particular:

  • I tried to document what is happening really detailed, such that my work can be easily continued. If I missed out anything, please comment.

Functionality is taken from SciCompMod/memilio#1164 with adapted paths.

Closes #4

@lenaploetzke lenaploetzke self-assigned this Jan 24, 2025
@lenaploetzke lenaploetzke linked an issue Jan 24, 2025 that may be closed by this pull request
Copy link
Member

@annawendler annawendler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very good! :) I just made a few comments regarding documentation.

## Overview
Below is an overview of the files and the paper sections they belong to.

- Section 4.2: The file [lct_impact_distribution_assumption](lct_impact_distribution_assumption.cpp) provides the functionality to run simulations to assess the impact of the distribution assumption or different numbers of subcompartments. The dynamics at change points and epidemic peaks can be examined using this script. The population is not divided into age groups for these experiments. All simulation results are created and saved in `.h5` files when the shell script [get_data_numerical_experiments](get_data_numerical_experiments.sh) is executed. The visualizations of these simulation results in the paper were created using the python script [plot_numerical_experiments](plot_numerical_experiments.py).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Section 4.2: The file [lct_impact_distribution_assumption](lct_impact_distribution_assumption.cpp) provides the functionality to run simulations to assess the impact of the distribution assumption or different numbers of subcompartments. The dynamics at change points and epidemic peaks can be examined using this script. The population is not divided into age groups for these experiments. All simulation results are created and saved in `.h5` files when the shell script [get_data_numerical_experiments](get_data_numerical_experiments.sh) is executed. The visualizations of these simulation results in the paper were created using the python script [plot_numerical_experiments](plot_numerical_experiments.py).
- Section 4.2: The file [lct_impact_distribution_assumption](lct_impact_distribution_assumption.cpp) provides the functionality to run simulations to assess the impact of the distribution assumption by choosing different numbers of subcompartments. The dynamics at change points and epidemic peaks can be examined using this script. The population is not divided into age groups for these experiments. All simulation results are created and saved in `.h5` files when the shell script [get_data_numerical_experiments](get_data_numerical_experiments.sh) is executed. The visualizations of these simulation results in the paper were created using the python script [plot_numerical_experiments](plot_numerical_experiments.py).


- Section 4.2: The file [lct_impact_distribution_assumption](lct_impact_distribution_assumption.cpp) provides the functionality to run simulations to assess the impact of the distribution assumption or different numbers of subcompartments. The dynamics at change points and epidemic peaks can be examined using this script. The population is not divided into age groups for these experiments. All simulation results are created and saved in `.h5` files when the shell script [get_data_numerical_experiments](get_data_numerical_experiments.sh) is executed. The visualizations of these simulation results in the paper were created using the python script [plot_numerical_experiments](plot_numerical_experiments.py).

- Section 4.3: With the file [lct_impact_age_resolution](lct_impact_age_resolution.cpp), one can run simulations to assess the impact of including an age resolution. The simulation results are created and saved together with the results for section 4.2 with the shellscript [get_data_numerical_experiments](get_data_numerical_experiments.sh). The visualizations are also created with [plot_numerical_experiments](plot_numerical_experiments.py).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Section 4.3: With the file [lct_impact_age_resolution](lct_impact_age_resolution.cpp), one can run simulations to assess the impact of including an age resolution. The simulation results are created and saved together with the results for section 4.2 with the shellscript [get_data_numerical_experiments](get_data_numerical_experiments.sh). The visualizations are also created with [plot_numerical_experiments](plot_numerical_experiments.py).
- Section 4.3: With the file [lct_impact_age_resolution](lct_impact_age_resolution.cpp), one can run simulations to assess the impact of including an age resolution into the model. The simulation results are created and saved together with the results for section 4.2 with the shellscript [get_data_numerical_experiments](get_data_numerical_experiments.sh). The visualizations are also created with [plot_numerical_experiments](plot_numerical_experiments.py).


- Section 4.3: With the file [lct_impact_age_resolution](lct_impact_age_resolution.cpp), one can run simulations to assess the impact of including an age resolution. The simulation results are created and saved together with the results for section 4.2 with the shellscript [get_data_numerical_experiments](get_data_numerical_experiments.sh). The visualizations are also created with [plot_numerical_experiments](plot_numerical_experiments.py).

- Section 4.4: Run time measurements are possible with the file [lct_runtime](lct_runtime.cpp). `OpenMP` is used to measure the run times. The target `lct_runtime` is only built if the option `MEMILIO_ENABLE_OPENMP` is enabled. The Slurm script [get_runtimes_lct](get_runtimes_lct.sh) can be used to define a job to measure the run time for different numbers of subcompartments. This script can be easily adapted to use an adaptive solver. To use the optimization flag `-O0`, uncomment the suitable line in the [CMakeLists file](CMakeLists.txt). Visualizations of the run times in the paper were created using the python script [plot_runtimes_lct](plot_runtimes_lct.py).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Section 4.4: Run time measurements are possible with the file [lct_runtime](lct_runtime.cpp). `OpenMP` is used to measure the run times. The target `lct_runtime` is only built if the option `MEMILIO_ENABLE_OPENMP` is enabled. The Slurm script [get_runtimes_lct](get_runtimes_lct.sh) can be used to define a job to measure the run time for different numbers of subcompartments. This script can be easily adapted to use an adaptive solver. To use the optimization flag `-O0`, uncomment the suitable line in the [CMakeLists file](CMakeLists.txt). Visualizations of the run times in the paper were created using the python script [plot_runtimes_lct](plot_runtimes_lct.py).
- Section 4.4: Run time measurements are possible with the file [lct_runtime](lct_runtime.cpp). `OpenMP` is used to measure the run times. The target `lct_runtime` is only built if the option `MEMILIO_ENABLE_OPENMP` is enabled. The Slurm script [get_runtimes_lct](get_runtimes_lct.sh) can be used to define a job to measure the run time for different numbers of subcompartments. This script can be easily adapted for the use of an adaptive solver. To use the optimization flag `-O0`, uncomment the suitable line in the [CMakeLists file](CMakeLists.txt). Visualizations of the run times in the paper were created using the python script [plot_runtimes_lct](plot_runtimes_lct.py).

if not os.path.isdir(data_folder):
os.makedirs(data_folder)

# Download data in format required.
Copy link
Member

@annawendler annawendler Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment why you download the case data twice, once with and once without moving average or what the different data sets are used for?


# Fifth case: Increase the effective reproduction number at simulation day 2 to different values and
# simulate for 200 days to compare epidemic peaks.
# Also perform simulations with TimeExposed scaled by 0.5 or 2.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Also perform simulations with TimeExposed scaled by 0.5 or 2.
# Also perform simulations with TimeExposed scaled with 0.5 or 2.

return max


def plot_day_peak_daily_new_transmissions(func_get_file_name, Reffs, subcompartments, file_name=""):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def plot_day_peak_daily_new_transmissions(func_get_file_name, Reffs, subcompartments, file_name=""):
def plot_epidemic_peak_timing(func_get_file_name, Reffs, subcompartments, file_name=""):

Easier to read for me than twice the word day in function name. Maybe plot_epidemic_peak_size for the other function as well.

(timing of the epidemic peak) for different effective reproduction numbers and different assumptions
regarding the number of subcompartments.

@param[in] func_get_file_name: Function that returns the paths to a file with suitable simulation results
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@param[in] func_get_file_name: Function that returns the paths to a file with suitable simulation results
@param[in] func_get_file_name: Function that returns the path to the files with suitable simulation results

def get_file_name(result_dir, Reff, num_subcompartments, boolsubcomp=False):
""" Gives a paths to a file with the simulation results for an LCT model with num_subcompartments subcompartments,
where the effective reproduction number is set to Reff at simulation time 2.
This uses standard defined naming convention of the lct simulations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This uses standard defined naming convention of the lct simulations.
This uses standard defined naming convention of the LCT simulations.

result_dir = os.path.join(os.path.dirname(
__file__), "simulation_results", "simulation_lct_numerical_experiments")

# Define which figures of the paper should be created. Figure 12 is created with another pyton script.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Define which figures of the paper should be created. Figure 12 is created with another pyton script.
# Define which figures of the paper should be created. Figure 12 is created with another python script.



def plot_runtime_and_steps(json_file, file_name=''):
""" Creates a plot with two y-axis: One for the run time measurements and one for the required number of time steps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
""" Creates a plot with two y-axis: One for the run time measurements and one for the required number of time steps
""" Creates a plot with two y-axes: One for the run time measurements and one for the required number of time steps

- Section 4.4: Run time measurements are possible with the file [lct_runtime](lct_runtime.cpp). `OpenMP` is used to measure the run times. The target `lct_runtime` is only built if the option `MEMILIO_ENABLE_OPENMP` is enabled. The Slurm script [get_runtimes_lct](get_runtimes_lct.sh) can be used to define a job to measure the run time for different numbers of subcompartments. This script can be easily adapted to use an adaptive solver. To use the optimization flag `-O0`, uncomment the suitable line in the [CMakeLists file](CMakeLists.txt). Visualizations of the run times in the paper were created using the python script [plot_runtimes_lct](plot_runtimes_lct.py).

- Section 4.5: A COVID-19 inspired scenario in Germany in 2020 is defined in the file [lct_covid19_inspired_scenario](lct_covid19_inspired_scenario.cpp). The simulation results are created and saved with the shell script [get_data_covid19_inspired](get_data_covid19_inspired.sh).
The simulation is initialized using real data, which has to be downloaded beforehand. Please execute the file [download_infection_data](download_infection_data.py) for this purpose.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The simulation is initialized using real data, which has to be downloaded beforehand. Please execute the file [download_infection_data](download_infection_data.py) for this purpose.
The simulation is initialized using reported data, which has to be downloaded beforehand. Please execute the file [download_infection_data](download_data.py) for this purpose.

Or rename the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add files for LCT paper
2 participants