Skip to content
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: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ tracing-subscriber = { version = "0.3.19", features = [
"time",
] }
faer = "0.24.0"
pharmsol = "=0.24.1"
pharmsol = "=0.25"
rand = "0.9.0"
anyhow = "1.0.100"
Comment thread
mhovd marked this conversation as resolved.
rayon = "1.10.0"
Expand Down
1 change: 1 addition & 0 deletions benches/bimodal_ke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ fn create_equation() -> equation::ODE {
y[1] = x[0] / v;
},
)
.with_default_cache()
}

fn create_parameters() -> Parameters {
Expand Down
3 changes: 2 additions & 1 deletion examples/bestdose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ fn main() -> Result<()> {
fetch_params!(p, _ke, v);
y[0] = x[0] / v;
},
};
}
.with_default_cache();

let params = Parameters::new()
.add("ke", 0.001, 3.0)
Expand Down
3 changes: 2 additions & 1 deletion examples/bestdose_auc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ fn main() -> Result<()> {
fetch_params!(p, _ke, v);
y[0] = x[0] / v;
},
};
}
.with_default_cache();

// Minimal parameter ranges
let params = Parameters::new()
Expand Down
3 changes: 2 additions & 1 deletion examples/bestdose_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ fn main() -> Result<()> {
fetch_params!(p, _ke, v);
y[0] = x[0] / v;
},
};
}
.with_default_cache();

let params = Parameters::new()
.add("ke", 0.001, 3.0)
Expand Down
13 changes: 6 additions & 7 deletions examples/bimodal_ke/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,17 @@ fn main() -> Result<()> {
y[1] = x[0] / v;
},
}
.with_solver(OdeSolver::ExplicitRk(ExplicitRkTableau::Tsit45));
.with_solver(OdeSolver::ExplicitRk(ExplicitRkTableau::Tsit45))
.with_default_cache();

let params = Parameters::new()
.add("ke", 0.001, 3.0)
.add("v", 25.0, 250.0);

let ems = AssayErrorModels::new()
.add(
1,
AssayErrorModel::additive(ErrorPoly::new(0.0, 0.5, 0.0, 0.0), 0.0),
)
.unwrap();
let ems = AssayErrorModels::new().add(
1,
AssayErrorModel::additive(ErrorPoly::new(0.0, 0.5, 0.0, 0.0), 0.0),
)?;

let mut settings = Settings::builder()
.set_algorithm(Algorithm::NPAG)
Expand Down
3 changes: 2 additions & 1 deletion examples/drusano/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ fn main() -> Result<()> {
y[3] = x[3].log10();
y[4] = x[4].log10();
},
};
}
.with_default_cache();

let params = Parameters::new()
.add("v1", 5.0, 160.0)
Expand Down
3 changes: 2 additions & 1 deletion examples/iov/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ fn main() -> Result<()> {
)
.with_nstates(2)
.with_ndrugs(1)
.with_nout(1);
.with_nout(1)
.with_default_cache();

let params = Parameters::new().add("ke0", 0.001, 2.0);

Expand Down
3 changes: 2 additions & 1 deletion examples/meta/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ fn main() {
y[1] = x[0] / v;
y[2] = x[1] / v2;
},
};
}
.with_default_cache();

let params = Parameters::new()
.add("cls", 0.1, 10.0)
Expand Down
4 changes: 3 additions & 1 deletion examples/neely/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ fn main() {
y[2] = x[2] / vm1;
y[3] = x[3] / vm2;
},
};
}
.with_default_cache();

let params = Parameters::new()
.add("cls", 0.0, 0.4)
.add("k30", 0.0, 0.5)
Expand Down
4 changes: 2 additions & 2 deletions examples/new_iov/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ fn main() {
)
.with_nstates(2)
.with_ndrugs(1)
.with_nout(1);
.with_nout(1)
.with_default_cache();

let params = Parameters::new()
.add("ke0", 0.0001, 2.4)
Expand All @@ -49,7 +50,6 @@ fn main() {
.build();

settings.set_cycles(1000);
settings.set_cache(true);
settings.set_output_path("examples/new_iov/output");
settings.set_prior(Prior::sobol(100, 347));

Expand Down
3 changes: 2 additions & 1 deletion examples/theophylline/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ fn main() {
fetch_params!(p, _ka, _ke, v);
y[0] = x[1] * 1000.0 / v;
},
);
)
.with_default_cache();

let params = Parameters::new()
.add("ka", 0.001, 3.0)
Expand Down
3 changes: 2 additions & 1 deletion examples/two_eq_lag/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ fn main() {
fetch_params!(p, _ka, _ke, _tlag, v);
y[1] = x[1] / v;
},
};
}
.with_default_cache();
// let eq = Equation::new_analytical(
// one_compartment_with_absorption,
// |_p, _cov| {},
Expand Down
3 changes: 2 additions & 1 deletion examples/vanco.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ fn main() {
out: |x, _p, _t, _cov, y| {
y[0] = x[1];
},
};
}
.with_default_cache();
// same eq but analytical
// let eq = Equation::new_analytical(
// two_compartments,
Expand Down
4 changes: 2 additions & 2 deletions examples/vanco_sde/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ fn main() {
y[0] = x[1] / (vol * wt);
},
100,
);
)
.with_default_cache();

// let ode = equation::ODE::new(
// |x, p, _t, dx, _rateiv, _cov| {
Expand Down Expand Up @@ -69,7 +70,6 @@ fn main() {
.build();

settings.set_cycles(usize::MAX);
settings.set_cache(true);
settings.set_output_path("examples/vanco_sde/output");
settings.set_prior(Prior::sobol(100, 347));
settings.initialize_logs().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ pub trait Algorithms<E: Equation + Send + 'static>: Sync + Send + 'static {
let outeqs = preds.iter().map(|x| x.outeq()).collect::<Vec<usize>>();
let states = preds
.iter()
.map(|x| x.state().clone())
.map(|x| x.state().to_vec())
.collect::<Vec<Vec<f64>>>();

tracing::debug!("\t\tTimes: {:?}", times);
Expand Down
8 changes: 0 additions & 8 deletions src/routines/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ impl Settings {
self.config.algorithm = algorithm;
}

pub fn set_cache(&mut self, cache: bool) {
self.config.cache = cache;
}

pub fn set_idelta(&mut self, idelta: f64) {
self.predictions.idelta = idelta;
}
Expand Down Expand Up @@ -148,8 +144,6 @@ pub struct Config {
pub cycles: usize,
/// Denotes the algorithm to use
pub algorithm: Algorithm,
/// If true (default), cache predicted values
pub cache: bool,
/// Should a progress bar be displayed for the first cycle
///
/// The progress bar is not written to logs, but is written to stdout. It incurs a minor performance penalty.
Expand All @@ -161,7 +155,6 @@ impl Default for Config {
Config {
cycles: 100,
algorithm: Algorithm::NPAG,
cache: true,
progress: true,
}
}
Expand Down Expand Up @@ -603,7 +596,6 @@ mod tests {

assert_eq!(settings.config.algorithm, Algorithm::NPAG);
assert_eq!(settings.config.cycles, 100);
assert_eq!(settings.config.cache, true);
assert_eq!(settings.parameters().names(), vec!["Ke", "V"]);
}
}
43 changes: 29 additions & 14 deletions tests/bestdose_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ fn test_infusion_mask_inclusion() -> Result<()> {
fetch_params!(p, _ke, v);
y[0] = x[0] / v;
},
);
)
.with_default_cache();

let params = Parameters::new().add("ke", 0.1, 0.5).add("v", 40.0, 60.0);

Expand Down Expand Up @@ -136,7 +137,8 @@ fn test_fixed_infusion_preservation() -> Result<()> {
fetch_params!(p, _ke, v);
y[0] = x[0] / v;
},
);
)
.with_default_cache();

let params = Parameters::new()
.add("ke", 0.001, 3.0)
Expand Down Expand Up @@ -229,7 +231,8 @@ fn test_dose_count_validation() -> Result<()> {
fetch_params!(p, _ke, v);
y[0] = x[0] / v;
},
);
)
.with_default_cache();

let params = Parameters::new().add("ke", 0.1, 0.5).add("v", 40.0, 60.0);
let ems = AssayErrorModels::new().add(
Expand Down Expand Up @@ -299,7 +302,8 @@ fn test_empty_observations_validation() -> Result<()> {
fetch_params!(p, _ke, v);
y[0] = x[0] / v;
},
);
)
.with_default_cache();

let params = Parameters::new().add("ke", 0.1, 0.5).add("v", 40.0, 60.0);
let ems = AssayErrorModels::new().add(
Expand Down Expand Up @@ -359,7 +363,8 @@ fn test_basic_auc_mode() -> Result<()> {
fetch_params!(p, _ke, v);
y[0] = x[0] / v;
},
);
)
.with_default_cache();

let params = Parameters::new().add("ke", 0.1, 0.5).add("v", 40.0, 60.0);

Expand Down Expand Up @@ -444,7 +449,8 @@ fn test_infusion_auc_mode() -> Result<()> {
fetch_params!(p, _ke, v);
y[0] = x[0] / v;
},
);
)
.with_default_cache();

let params = Parameters::new().add("ke", 0.1, 0.5).add("v", 40.0, 60.0);

Expand Down Expand Up @@ -548,7 +554,8 @@ fn test_multi_outeq_auc_mode() -> Result<()> {
y[0] = x[0] / v; // outeq 0: concentration
y[1] = x[0]; // outeq 1: amount
},
);
)
.with_default_cache();

let params = Parameters::new().add("ke", 0.1, 0.5).add("v", 40.0, 60.0);

Expand Down Expand Up @@ -618,7 +625,8 @@ fn test_multi_outeq_auc_optimization() -> Result<()> {
y[0] = x[0] / v;
y[1] = x[0];
},
);
)
.with_default_cache();

let params = Parameters::new().add("ke", 0.1, 0.5).add("v", 40.0, 60.0);
let error_model = AssayErrorModel::additive(ErrorPoly::new(0.0, 5.0, 0.0, 0.0), 0.0);
Expand Down Expand Up @@ -703,7 +711,8 @@ fn test_auc_from_zero_single_dose() -> Result<()> {
fetch_params!(p, _ke, v);
y[0] = x[0] / v;
},
);
)
.with_default_cache();

let params = Parameters::new().add("ke", 0.2, 0.4).add("v", 40.0, 60.0);

Expand Down Expand Up @@ -787,7 +796,8 @@ fn test_auc_from_last_dose_maintenance() -> Result<()> {
fetch_params!(p, _ke, v);
y[0] = x[0] / v;
},
);
)
.with_default_cache();

let params = Parameters::new().add("ke", 0.2, 0.4).add("v", 40.0, 60.0);

Expand Down Expand Up @@ -875,7 +885,8 @@ fn test_auc_modes_comparison() -> Result<()> {
fetch_params!(p, _ke, v);
y[0] = x[0] / v;
},
);
)
.with_default_cache();

let params = Parameters::new().add("ke", 0.3, 0.3).add("v", 50.0, 50.0);

Expand Down Expand Up @@ -1004,7 +1015,8 @@ fn test_auc_from_last_dose_multiple_observations() -> Result<()> {
fetch_params!(p, _ke, v);
y[0] = x[0] / v;
},
);
)
.with_default_cache();

let params = Parameters::new().add("ke", 0.2, 0.4).add("v", 40.0, 60.0);

Expand Down Expand Up @@ -1098,7 +1110,8 @@ fn test_auc_from_last_dose_no_prior_dose() -> Result<()> {
fetch_params!(p, _ke, v);
y[0] = x[0] / v;
},
);
)
.with_default_cache();

let params = Parameters::new().add("ke", 0.2, 0.4).add("v", 40.0, 60.0);

Expand Down Expand Up @@ -1187,7 +1200,8 @@ fn test_dose_range_bounds_respected() -> Result<()> {
fetch_params!(p, _ke, v);
y[0] = x[0] / v;
},
);
)
.with_default_cache();

let params = Parameters::new().add("ke", 0.1, 0.5).add("v", 40.0, 60.0);

Expand Down Expand Up @@ -1281,6 +1295,7 @@ fn one_compartment_model() -> pharmsol::ODE {
y[0] = x[0] / v;
},
)
.with_default_cache()
}

/// Helper to build minimal settings for tests (no posterior refinement)
Expand Down
Loading
Loading