A pipeline for performing rapid calibration of 0D cardiovascular models using linear emulators.
Project description
CVDNet pipeline
This repository contains the pipeline for Calibration from Fay Frost as part of the CVDNet project.
Installation
-
Clone the repository:
git clone https://github.com/alan-turing-institute/cvd-net-pipeline cd cvd-net-pipeline
-
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On macOS/Linux
-
Install
You can install the dependencies using the pyproject.toml file:
pip install .
Usage
The pipeline can be run by executing the main.py script. You must specify a configuration file in JSON format using the --config argument.
Configuration File
The configuration file should define the steps to run and other parameters such as the number of samples and with outputs used for calibration. Below is an example configuration file:
{
"input_parameters": "parameters_pulmonary_sensitive_summarystats.json",
"output_path": "output_synthetic/",
"steps": ["1", "2", "3", "4", "5"],
"nsamples": 64,
"n_pca_components": 10,
"n_params": 9,
"include_timeseries": 0,
"output_keys": [
"t_max_dpdt", "a_epad", "epad", "s_a_epad", "s_epad",
"min_dpdt", "max_dpdt", "A_p", "P_max", "esp", "sys",
"EF", "dia", "Ees/Ea", "iT", "PC1", "PC2", "PC3"
],
"epsilon_obs_scale": 0.05,
"output_dir_bayesian": "output_synthetic/output_5000_9params/bayesian_calibration_results/18_output_keys/calibration_20250619_135107"
}
input_parameters: The json file containting parameters and their ranges to sample from.
output_path: The path you want output to be saved to.
steps: The steps you want to run.
nsamples: The number of samples you want to run.
n_pca_components: The number of pca components to compute.
n_params: The number of non-fixed parameters sampled.
include_timeseries: (Not implemented yet) Whether the timeseries waveform should be included in the calibration 0/1 for true/false.
output_keys: The outputs you want to calibrate on.
epsilon_obs_scale: (Hard coded for now) Observation error
output_dir_bayesian: The directory where calibration files are saved if you are only running steps 6 onwards.
Running the Pipeline
To run the pipeline, specify the configuration file as follows:
python main.py --config config/pipeline_config.json
Steps in the Pipeline
- Simulate Data: Generates input and output data based on parameters.
- Analyze Giessen: Performs analysis on the simulated pressure waveform data.
- Compute PCA: Performs a PCA on the output data.
- Build Emulator: Builds an emulator for the data.
- Calibration: Calibrates the model.
- Simulate Posterior Data: Simulates data from posterior samples.
- Final Resampling: Performs final resampling on posterior simulations.
Example
To run specific steps, modify the steps field in the configuration file. For example, to run steps 1, 2, and 3, use the following within your configuration:
{
"steps": ["1", "2", "3"],
}
Then execute:
python main.py --config config/pipeline_config.json
Project Structure
main.py: Entry point for running the pipeline.pipeline/: Contains the modules for each step of the pipeline.simulate_data.py: Simulates input and output data.analyse_giessen.py: Analyzes the data.build_emulator.py: Builds the emulator.simulate_posterior.py: Simulates posterior data.calibrate.py: Calibrates the model.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cvdnet_pipeline-0.1.0.tar.gz.
File metadata
- Download URL: cvdnet_pipeline-0.1.0.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c8f2d3025cdcd082b199d82cc72eb846ecc91aea06958d165d31874d28397d6
|
|
| MD5 |
b7cfc24869464d436d55bfe9a400dc9e
|
|
| BLAKE2b-256 |
0d8e238d9eeee9b01a62fb7a493d893a7203bd4621d5a2052b09650a304b9c8e
|
Provenance
The following attestation bundles were made for cvdnet_pipeline-0.1.0.tar.gz:
Publisher:
publish.yml on alan-turing-institute/cvd-net-pipeline
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cvdnet_pipeline-0.1.0.tar.gz -
Subject digest:
3c8f2d3025cdcd082b199d82cc72eb846ecc91aea06958d165d31874d28397d6 - Sigstore transparency entry: 533200360
- Sigstore integration time:
-
Permalink:
alan-turing-institute/cvd-net-pipeline@a40ce667a1e0e68152ea21ebe6a6c7389e13147b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/alan-turing-institute
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a40ce667a1e0e68152ea21ebe6a6c7389e13147b -
Trigger Event:
release
-
Statement type:
File details
Details for the file cvdnet_pipeline-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cvdnet_pipeline-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc7c6a6a23fe1c24dbab4f21b1f2de2a2df05bf086365d56e63d010871558089
|
|
| MD5 |
b48e9b59135da68d608d4ce25a6096ae
|
|
| BLAKE2b-256 |
229b8c38bfa2eecf1ba739679555ba72e8ed98cd5871a194635032085ac43045
|
Provenance
The following attestation bundles were made for cvdnet_pipeline-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on alan-turing-institute/cvd-net-pipeline
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cvdnet_pipeline-0.1.0-py3-none-any.whl -
Subject digest:
fc7c6a6a23fe1c24dbab4f21b1f2de2a2df05bf086365d56e63d010871558089 - Sigstore transparency entry: 533200362
- Sigstore integration time:
-
Permalink:
alan-turing-institute/cvd-net-pipeline@a40ce667a1e0e68152ea21ebe6a6c7389e13147b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/alan-turing-institute
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a40ce667a1e0e68152ea21ebe6a6c7389e13147b -
Trigger Event:
release
-
Statement type: