Skip to main content

Bloch-McConnell (BMC) Simulation Tool

Python License Coverage Badge

This repository contains a purely Python-based Bloch-McConnell (BMC) simulation tool that can be used to simulate the evolution of magnetization in various (exchanging) magnetic environments ('pools') with arbitrary radio-frequency (RF) irradiation schemes. The tool was developed to simulate Chemical Exchange Saturation Transfer (CEST) or related spectra but can be used for many other MR simulations as well.

The BMCTool utilizes the pulseq open file format to define and store all events (RF pulses, gradients, delays, ADCs) to be simulated. The scanner settings (e.g., field strength, B0 inhomogeneity) and characteristic properties of the magnetic environments (e.g., relaxation times, pool size fractions, exchange rates) are defined and stored in configuration files in the YAML file format.

Every simulation requires exactly one Pulseq sequence file (containing all events) and at least one configuration file.

Installation

The BMCTool is available on PyPi and can be installed using pip install bmctool.

Alternatively, if Git is available on your system, you can directly install BMCTool from GitHub using pip install git+https://github.com/schuenke/bmctool@main. You can change the @main to any desired branch.

Initial Test

To make sure that the installation was successful, you can run an example simulation that is provided with both the pip and GitHub installations. To run an example simulation, simply execute the following code:

from bmctool.simulation import sim_example

sim_example()

The sim_example function uses the WASABI.seq and config_1pool.yaml example files.

Running a Simulation

All simulations using the BMCTool require at least one config file (in the YAML format) that includes all simulation settings and exactly one Pulseq sequence file (in the seq format), which defines the events to be simulated. An example seq-file and an example yaml file can be found in the library subfolder. For more information about configuration files and sequence files as well as about the Pulseq-CEST library, where both types of files can be shared, please read the Pulseq-CEST Library section below.

If you created your own files or downloaded them from the Pulseq-CEST library, you can start the simulation by running the following code:

from bmctool.simulate import simulate

config_path = '<path_to_your_config>'  # can be a str or a Path
seq_path = '<path_to_your_sequence>'  # can be a str or a Path
sim = simulate(config_file=config_path, seq_file=seq_path, show_plot=True)

The simulate function accepts several additional keyword arguments (**kwargs) that allow adjusting the plot. These include normalize (bool: toggle normalization), norm_threshold (value/list/array: threshold for normalization offsets), offsets (list/array: manually defined x-values), invert_ax (bool: toggle invert axis), plot_mtr_asym (bool: toggle plot MTR_asym), and title, x_label, y_label to control the labels.

Pulseq-CEST Project

The BMCTool was developed in parallel to the Pulseq-CEST project, which aims to provide published and approved CEST saturation blocks in the Pulseq open file format to enable an exact comparison of CEST saturation blocks with newly developed or adapted saturation blocks for reproducible research. The Pulseq-CEST project also provides a MATLAB implementation.

Pulseq-CEST Library

You will find several pre-defined and approved CEST pre-saturation schemes and simulation configs in the Pulseq-CEST library on GitHub. You can clone the library using git clone https://github.com/kherz/pulseq-cest-library.git or download the latest version as a ZIP file.

Metadata

Release files for BMCTool 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for BMCTool 1.0.3
File Size Uploaded
bmctool-1.0.3.tar.gz 47.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for BMCTool 1.0.3
File Interpreter ABI Platform
bmctool-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 82.0 kB

Release files / bmctool-1.0.3.tar.gz

Download URL bmctool-1.0.3.tar.gz
Size 47.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0809f4d265d740ccf7302ad021a9f79b0406c25dd68ec08b20c9c3cd508d854e
BLAKE2b-256 checksum
How to use checksums
523805e4f6ab5d413b9ed35d07e3bc15285b003ecbadfd58b38486fbfd7858ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.

Transparency log

Release files / bmctool-1.0.3-py3-none-any.whl

Download URL bmctool-1.0.3-py3-none-any.whl
Size 34.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
358c4795fd89145a9568d8519038ab5be705c692758bc62ade0c36bfd29d7f13
BLAKE2b-256 checksum
How to use checksums
b20ceb22afdb7b069912e9a5bbbe079f01071e6f1039ba70352035d9d8ed3b57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page