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

Added 4 new classes inside utils.py that creates an aggregated pattern design. #322

Closed B-9991 closed 2 years ago

B-9991 commented 3 years ago

Created 4 classes inside utils.py that creates aggregated pattern design. These 4 classes protect their children's functions from being directly exposed from outside the class. Newly Created Classes: "Compute" , "Samp_Seed" , "Probabilities" , "Arr_Op". Each class individually is a root entity to its children's functions. These classes act as an entrance to the aggregate pattern, external classes and objects cannot call any of internal functions directly. The internal functions can only be accessed through the root class.

Compute Class contains functions: "compute_viral_load" , "compute_trans_sus" , "compute_infections" , "find_contacts".

Samp_Seed Class contains functions: "sample" , "get_pdf" , "set_seed".

Probabilities Class contains functions: “n_binomial” , “binomial_filter” , “binomial_arr” , “n_multinomial” , “poisson” , “n_poisson” , “n_neg_binomial” , “choose” , "choose_r” , “choose_w”.

Arr_Op Class contains functions: "true" , "false" , "defined" , "undefined" , "itrue" , "ifalse" , "idefined" , "iundefined" , "itruei" , "ifalsei" , "idefinedi", "iundefinedi".

Please note that these changes are part of a school project. Hope my work adds a positive impact to the Project!

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!