SABS-R3-Epidemiology / branchpro

Using branching processes to estimate the time-dependent reproduction number of a disease with imported cases
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

Issue 153 figure functions #155

Closed rccreswell closed 3 years ago

rccreswell commented 3 years ago

Closes #153

The code to generate our figures for the paper has become lengthy, and it is duplicated across multiple notebooks. This PR defines unit tested functions for the two main types of figures we are using.

The design is similar to the current figures, with support added for date time labels, shared x and y axis, and automatic panel labels.

Examples of the new figures: Simulated cases Inference for R

codecov[bot] commented 3 years ago

Codecov Report

Merging #155 (7dc9251) into main (ff3360b) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #155   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        11    +1     
  Lines          399       495   +96     
=========================================
+ Hits           399       495   +96     
Impacted Files Coverage Δ
branchpro/__init__.py 100.00% <100.00%> (ø)
branchpro/figures.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ff3360b...7dc9251. Read the comment docs.

rccreswell commented 3 years ago

I'd usually complain that it's probably not a good idea to write this long and "complex" functions, but since these functions are not really meant to be reusable outside of this publication, I'd say it's fine.

Yes, I would agree from a software engineering perspective. I see these more as fairly detailed scripts which are written as functions for easy reusability across datasets. I added a few lines to the module docstring diverting people towards the more general visualizations.