InstituteforDiseaseModeling / covasim

COVID-19 Agent-based Simulator (Covasim): a model for exploring coronavirus dynamics and interventions
https://covasim.org
MIT License
250 stars 223 forks source link

Applying Aggregation on Plotting Module #326

Closed Daivakshi closed 2 years ago

Daivakshi commented 3 years ago

Introduction

The plotting module consists of several functions that are responsible for plotting scripts and graphs. There are some functions that are responsible for creating subplots and plotting data, these set the foundation for other core plot functions. They use the same methods to create the subplot and are dependent on the performance of the fundamental helper functions to produce the desired results. The plotting then consists of styling as well as plotly functions, which are again dependant on the core functions.

Concept and Changes made

Class plotting: The class that contains all foundational helper functions like handle_to_plot or create_subplots. The rest of the classes are dependent on function from this class. Functions contain: handle args, handle to plot, create figs, create subplots, plot data, plot interventions

Class plot_styl_form: As the name suggests, this class contains functions that are responsible for styling and formatting and other miscellaneous functions. Functions contain: title grid legend, date formatter, reset ticks, tidy up, set line options

Class plot2D: core plotting functions Functions contain: plot sim, plot scens, plot result, plot compare, plot people

Class plotly: Plotly functions Functions contain: import plotly, get individual states, plotly interventions, plotly sims, plotly people, plotly animate

Additional Aggregate Pattern on Efficacy Functions in immunity.py

The immunity module consists of several functions for calculation the efficacy agains different parameters. However, all parameter specific functions are dependant on the function calc_VE and call on it to further compute vaccine efficacy on the basis of the parameters. Therefore, functions in this code have been classified into root vaccineEfficacyclass (contains calc_VE) and then classes sym_inf_VE and severe_disease_VE for respective parameter functions.

cliffckerr commented 2 years ago

Thanks for the PR -- we're not considering major architectural changes currently, but we appreciate the contribution to open-source software!