Skip to content

Commit

Permalink
Add Walter's IOV examples
Browse files Browse the repository at this point in the history
* walter's IOV examples

* re-enable the iov example. Remove non-needed bench

* re-write examples using the new settings

* using new version of pharmsol. New debugging tools when having zero likelihoods for a subject

* working on vanco

* Clean dataset

* Fix data

* using new version of pharmsol

* Update main.rs

* remove files not needed on the main repo

* rename examples and some data files

---------

Co-authored-by: Markus <markushh@uio.no>
  • Loading branch information
Siel and mhovd authored Feb 21, 2025
1 parent 284d2a8 commit 7a81d2b
Show file tree
Hide file tree
Showing 14 changed files with 4,100 additions and 80 deletions.
5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tracing-subscriber = { version = "0.3.17", features = [
config = { version = "0.15", features = ["preserve_order"] }
faer = "0.19.3"
faer-ext = { version = "0.2.0", features = ["nalgebra", "ndarray"] }
pharmsol = "0.7.2"
pharmsol = "0.7.6"
rand = "0.9.0"
anyhow = "1.0.86"

Expand All @@ -45,9 +45,6 @@ opt-level = 3
[dev-dependencies]
criterion = { version = "0.5" }

[[bench]]
name = "fibonacci"
harness = false

[[bench]]
name = "bimodal_ke"
Expand Down
17 changes: 0 additions & 17 deletions benches/fibonacci.rs

This file was deleted.

65 changes: 65 additions & 0 deletions examples/iov/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
use anyhow::Ok;
use pmcore::prelude::{
settings::{Parameters, Prior, Settings},
*,
};
fn main() -> Result<()> {
let sde = equation::SDE::new(
|x, p, _t, dx, _rateiv, _cov| {
// automatically defined
fetch_params!(p, ke0);
// let ke0 = 1.2;
dx[1] = -x[1] + ke0;
let ke = x[1];
// user defined
dx[0] = -ke * x[0];
},
|p, d| {
fetch_params!(p, _ke0);
d[1] = 0.1;
},
|_p| lag! {},
|_p| fa! {},
|p, _t, _cov, x| {
fetch_params!(p, ke0);
x[1] = ke0;
},
|x, p, _t, _cov, y| {
fetch_params!(p, _ke0);
y[0] = x[0] / 50.0;
},
(2, 1),
10000,
);

let mut settings = Settings::new();

let params = Parameters::builder()
.add("ke0", 0.001, 2.0, false)
.build()
.unwrap();
settings.set_parameters(params);
settings.set_cycles(100000);
settings.set_error_poly((0.0, 0.0, 0.0, 0.0));
settings.set_error_type(ErrorType::Add);
settings.set_error_value(0.0000757575757576);
settings.set_output_path("examples/iov/output");
settings.set_prior(Prior {
sampler: "sobol".to_string(),
points: 100,
seed: 347,
file: None,
});
settings.set_output_write(true);

setup_log(&settings)?;

let data = data::read_pmetrics("examples/iov/test.csv").unwrap();
let mut algorithm = dispatch_algorithm(settings, sde, data).unwrap();
algorithm.initialize().unwrap();
while !algorithm.next_cycle().unwrap() {}
let result = algorithm.into_npresult();
result.write_outputs().unwrap();

Ok(())
}
Loading

0 comments on commit 7a81d2b

Please sign in to comment.