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

Visualize whole tree of infections #55

Merged
merged 7 commits into from
Jan 10, 2025
Merged

Visualize whole tree of infections #55

merged 7 commits into from
Jan 10, 2025

Conversation

afmagee42
Copy link
Contributor

@afmagee42 afmagee42 commented Dec 23, 2024

Resolves #24 and #15. Solves #53 along the way because the broken plots that led to were driving me crazy.

Code lives in ringvax.plot, and I'm rather tempted to wrap it all up into a plotting object since that would avoid a lot of unneeded passing of objects around (the simulation, plotting parameters, and the plot itself).

Colors and styles can and probably should be argued over. I strove to keep things clean and visible first and foremost, but also to use our color palette and keep things accessible. I think this is mostly achieved, except perhaps marking detections which is a bit ugly. I tried delineating detection types by color, instead of shape, but I ran out of colors that were both easy to see on both latent and exposed backgrounds and which were truly distinctive from each other.

To keep some of the plotting-induced post-processing sane, I added infection attributes: the id and the infectees.

@afmagee42 afmagee42 requested a review from swo December 23, 2024 22:15
@swo swo mentioned this pull request Dec 26, 2024
@swo
Copy link
Contributor

swo commented Dec 26, 2024

Pretty cool!!

image

I'm guessing this is:

  • Gray bars are latent
  • Blue/teal/gray is infectious
  • Green lozenge is passive detection(?)
  • Orange lozenge is active detection(?)
  • Gray ticks are onward infections that are not tracked

I could really use a legend or something!

Also, I would have expected to see:

  • Index infection
  • Contacts
  • Contacts of contacts
  • Contacts of contacts of contacts

But it looks like this is actually there is one more? This is telling me our default "number of simulated generations" should be 3, not 4? Does "simulated" include the index? I'll break this off as a separate issue (#62)

This was referenced Dec 26, 2024
Copy link
Contributor

@swo swo left a comment

Choose a reason for hiding this comment

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

This could definitely work. I have some questions to make sure we're going the right way first.

poetry.lock Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

I got an error about matplotlib, see #61

ringvax/__init__.py Show resolved Hide resolved
ringvax/__init__.py Outdated Show resolved Hide resolved
ringvax/__init__.py Outdated Show resolved Hide resolved
ringvax/plot.py Outdated Show resolved Hide resolved
@swo swo mentioned this pull request Dec 27, 2024
@afmagee42
Copy link
Contributor Author

Re: legend and what things are: yes we need one, but I figured we should agree on the aesthetics we liked first.

E.g., I also have #64 (which is what I thought I had opened this PR on... oops... but you've got the right interpretation for what's been shown here)

image

which I think is in many ways better, but requires shapes for detection.

@afmagee42
Copy link
Contributor Author

To-dos and to-considers from sync disc:

  • Axis/axes
  • Different color for un-simulated forward infections vs actual infections
  • Generation labels for infections
  • Do we want "empty" post-detection "counterfactual infectious"?
  • Colors are... perhaps bland

@afmagee42 afmagee42 marked this pull request as draft December 30, 2024 16:31
afmagee42 added a commit that referenced this pull request Dec 30, 2024
@swo swo mentioned this pull request Dec 31, 2024
works

rename

use new plot

dropped these

update deps

cleanup #53

use get_person_properties() everywhere

clean up plotting

add matplotlib (#61)

cleanup per @swo #55

bug fix requires test changes

triangles

precommit

let counterfactual show passive detection, remove unused par

put axis back where it belongs, optional gen plotting
@afmagee42 afmagee42 requested a review from swo January 7, 2025 22:33
@afmagee42 afmagee42 marked this pull request as ready for review January 7, 2025 22:33
@afmagee42 afmagee42 requested a review from paigemiller January 7, 2025 22:34
@afmagee42
Copy link
Contributor Author

Okay @swo and @paigemiller, this is ready for a look now, your feedback has been incorporated.

Scott, the generations get crowded fast so "please show me the generation" is an Advanced Setting.

This was linked to issues Jan 8, 2025
@afmagee42 afmagee42 linked an issue Jan 8, 2025 that may be closed by this pull request
@swo
Copy link
Contributor

swo commented Jan 10, 2025

Pulling out some images to reference the new style:

image

image

Copy link
Contributor

@swo swo left a comment

Choose a reason for hiding this comment

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

Overall I think this is good! Of course there are a thousand things that could be tweaked; but we should leave those aside.

Two things that you could change or leave aside:

  • It makes more sense to me to have the "escape" infections be little black ticks, rather than blue ones?
  • "Show infection times?" would make more sense to me as a toggle, rather than a button

@@ -3,5 +3,5 @@

def test_app():
# Cf. https://docs.streamlit.io/develop/api-reference/app-testing
at = AppTest.from_file("ringvax/app.py").run()
at = AppTest.from_file("ringvax/app.py", default_timeout=10.0).run()
Copy link
Contributor

Choose a reason for hiding this comment

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

ooh what does this do?

Copy link
Contributor Author

@afmagee42 afmagee42 Jan 10, 2025

Choose a reason for hiding this comment

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

This imposes some sort of time limit on how long the tests are allowed to run.

The new plots are apparently slower to render, enough so that while they passed on my machine, whatever the actions are run on needed more time. My guess is the actions must be rendering all the plots for all the simulations, because it's not that slow.

@afmagee42 afmagee42 linked an issue Jan 10, 2025 that may be closed by this pull request
@afmagee42 afmagee42 merged commit e01050b into main Jan 10, 2025
2 checks passed
@afmagee42 afmagee42 deleted the afm-viz-tree branch January 10, 2025 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants