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

Use built-in periodic report function in example #115

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ serde_derive = "1.0"
serde_json = "1.0.128"
reikna = "0.12.3"
roots = "0.0.8"
strum = "0.26.3"
strum_macros = "0.26.4"
ixa-derive = { path = "ixa-derive" }
seq-macro = "0.3.5"
paste = "1.0.15"
Expand Down
6 changes: 4 additions & 2 deletions examples/time-varying-infection/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ use std::path::PathBuf;

use ixa::error::IxaError;
use ixa::random::ContextRandomExt;
use ixa::report::ContextReportExt;
use ixa::{context::Context, global_properties::ContextGlobalPropertiesExt};
use population_loader::DiseaseStatusType;

mod exposure_manager;
mod incidence_report;
mod infection_manager;
mod parameters_loader;
mod periodic_report;
mod population_loader;

use crate::parameters_loader::Parameters;
Expand All @@ -31,7 +32,8 @@ fn initialize() -> Result<Context, IxaError> {
population_loader::init(&mut context);
infection_manager::init(&mut context);
incidence_report::init(&mut context)?;
periodic_report::init(&mut context)?;
// add periodic report
context.add_periodic_report("person_property_count", 1.0, (DiseaseStatusType,))?;

context.add_plan(parameters.max_time, |context| {
context.shutdown();
Expand Down
67 changes: 0 additions & 67 deletions examples/time-varying-infection/periodic_report.rs

This file was deleted.

2 changes: 1 addition & 1 deletion examples/time-varying-infection/plot_output.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ person_property_report <- readr::read_csv(file.path(
))

ggplot2::ggplot() +
geom_point(aes(day, count, color = property_value), person_property_report) +
geom_point(aes(t, count, color = DiseaseStatusType), person_property_report) +
geom_line(aes(time_array_susc, expected_susc), color = "black") +
xlab("Time") +
ylab("People") +
Expand Down
3 changes: 1 addition & 2 deletions examples/time-varying-infection/population_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ use ixa::people::ContextPeopleExt;
use ixa::{define_person_property, define_person_property_with_default};
use ordered_float::OrderedFloat;
use serde::{Deserialize, Serialize};
use strum_macros::EnumIter;

use crate::parameters_loader::Parameters;

#[derive(Deserialize, Serialize, Copy, Clone, PartialEq, Eq, Debug, EnumIter, Hash)]
#[derive(Deserialize, Serialize, Copy, Clone, PartialEq, Eq, Debug, Hash)]
pub enum DiseaseStatus {
S,
I,
Expand Down