Skip to content

Commit

Permalink
Update person properties periodic report in example to use real API (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiragKumar9 authored Dec 2, 2024
1 parent b8e5a4d commit ab6f9d1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 74 deletions.
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

0 comments on commit ab6f9d1

Please sign in to comment.