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

Apis #235

Merged
merged 178 commits into from
Feb 22, 2024
Merged

Apis #235

merged 178 commits into from
Feb 22, 2024

Conversation

cliffckerr
Copy link
Contributor

@cliffckerr cliffckerr commented Feb 12, 2024

Lots of changes, including:

  • Code reorganization
  • Networks moved from People to Sim
  • Various classes renamed (e.g. FusedArray to UIDArray )
  • Better type checking
  • Added MultiSim (not yet functional due to ScipyDistribution can't be pickled #257)
  • Added cholera, measles, and Ebola (ported from @RomeshA and team's GAVI work)
  • Added vaccination
  • most pars entries can now be specified as scalars, which will be converted to distributions according to keys in par_dists

@cliffckerr cliffckerr mentioned this pull request Feb 12, 2024
@robynstuart robynstuart mentioned this pull request Feb 19, 2024
3 tasks
self.recovered[recovered_sev] = True

# Trigger deaths
deaths = ss.true(self.ti_dead <= sim.year)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a check - shouldn't remove agents as they can still transmit

"cell_type": "markdown",
"source": [
"\n",
"This will scale all your results to represent a population of 50 million people, and will apply annual birth and death rates as specified in the `pars` dict. Alternatively, we can make demographic components:"
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure where the 50 million came from?

"Both achieve the same thing. \n",
"\n",
"## Scaling results to whole populations\n",
"Even though we've been simulating populations of a few thousand agents, we can also use the `total_pop` parameter to scale our results so that they reflect a much larger population. You can think of this as a kind of statistical sampling approximation. If we want to model the population of Nigeria, for example, it would be much too computationally intensive to simulate 200 million agents. However, we could simulate 50,000 agents and then say that each agent represents 4,000 people. Again, we can do this by passing `total_pop=200e6` to the sim or in the `pars` dictionary.\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

There should probably a note somewhere (perhaps not right here though) that this is like having 4000 towns/cities so results need to be interpreted accordingly - this is probably most relevant to outbreaks where 1 outbreak with 10 infections could behave quite differently to 10 outbreaks with 1 infection

"\n",
"# Read in age-specific fertility rates\n",
"fertility_rates = pd.read_csv(ss.root / 'tests/test_data/nigeria_asfr.csv')\n",
"pregnancy = ss.Pregnancy(pars={'fertility_rate': fertility_rates})\n",
Copy link
Contributor

@RomeshA RomeshA Feb 20, 2024

Choose a reason for hiding this comment

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

Also maybe not specific to this PR but how does a user find out what format dataframes (like fertility_rates need to be in? Or rather, what they can/can't put in their CSVs. It's difficult to tell by looking through the code. I guess it's in Pregnancy.metadata? Maybe we should have a data container class that centralises these operations e.g., have the module contain a data object that has a specification of the columns/types etc. and also handles standardization/parsing - then the module's constructor could pass whatever representation of the data the user provided to a load method or similar on that class, and subsequently access the sanitised data via that class too (e.g.,Pregnancy.fertility_rates.df)

@RomeshA
Copy link
Contributor

RomeshA commented Feb 21, 2024

Having reviewed further, still happy to merge this in and carry on from there, but I think we need to finish the discussion about the par_dists changes, I agree with Dan that separating out the distributions from their parameters isn't ideal and I think a step backwards in addressing some of the issues in Covasim around ambiguity about what the parameters for the different distributions are doing. But definitely acknowledge the value of having a compact, straightforward syntax for the simple single-parameter distributions that are most commonly used

@cliffckerr cliffckerr merged commit 02fed61 into main Feb 22, 2024
2 checks passed
@cliffckerr cliffckerr deleted the apis branch February 22, 2024 02:27
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.

None yet

5 participants