Skip to main content

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

  1. Clone the repository:

    git clone https://github.com/alan-turing-institute/cvd-net-pipeline
    cd cvd-net-pipeline
    
  2. Create a virtual environment (optional but recommended):

    python -m venv venv
    source venv/bin/activate  # On macOS/Linux
    
  3. 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

  1. Simulate Data: Generates input and output data based on parameters.
  2. Analyze Giessen: Performs analysis on the simulated pressure waveform data.
  3. Compute PCA: Performs a PCA on the output data.
  4. Build Emulator: Builds an emulator for the data.
  5. Calibration: Calibrates the model.
  6. Simulate Posterior Data: Simulates data from posterior samples.
  7. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cvdnet_pipeline-0.1.0.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cvdnet_pipeline-0.1.0-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

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

Hashes for cvdnet_pipeline-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3c8f2d3025cdcd082b199d82cc72eb846ecc91aea06958d165d31874d28397d6
MD5 b7cfc24869464d436d55bfe9a400dc9e
BLAKE2b-256 0d8e238d9eeee9b01a62fb7a493d893a7203bd4621d5a2052b09650a304b9c8e

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cvdnet_pipeline-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cvdnet_pipeline-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc7c6a6a23fe1c24dbab4f21b1f2de2a2df05bf086365d56e63d010871558089
MD5 b48e9b59135da68d608d4ce25a6096ae
BLAKE2b-256 229b8c38bfa2eecf1ba739679555ba72e8ed98cd5871a194635032085ac43045

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page