A python tool to perform Bloch-McConnell (BMC) simulations.
Project description
Bloch-McConnell (BMC) Simulation Tool
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.
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 bmctool-1.0.1.tar.gz.
File metadata
- Download URL: bmctool-1.0.1.tar.gz
- Upload date:
- Size: 44.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 |
d9253c6e2b9e19dc64d1fcef6e0317f64638463c83dfd1becfacf116f5db5203
|
|
| MD5 |
5d463d648448c7826bcd753674f9403f
|
|
| BLAKE2b-256 |
eb25610b122291b681e29d1e59f5ce3c2409606bfc33e018d658fda052f43682
|
Provenance
The following attestation bundles were made for bmctool-1.0.1.tar.gz:
Publisher:
publish-to-pypi.yml on schuenke/BMCTool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bmctool-1.0.1.tar.gz -
Subject digest:
d9253c6e2b9e19dc64d1fcef6e0317f64638463c83dfd1becfacf116f5db5203 - Sigstore transparency entry: 924003110
- Sigstore integration time:
-
Permalink:
schuenke/BMCTool@ec1efd2d21902013318ff8106576f8f092fc3d79 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/schuenke
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@ec1efd2d21902013318ff8106576f8f092fc3d79 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bmctool-1.0.1-py3-none-any.whl.
File metadata
- Download URL: bmctool-1.0.1-py3-none-any.whl
- Upload date:
- Size: 34.9 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 |
1bf141a23f9bb444bd2e638ecf534bb1f7ca62dafe765c6c438f716afcd74100
|
|
| MD5 |
918edaca637f2413d3bff218fbbca028
|
|
| BLAKE2b-256 |
128177d5cdae0400ada2118036177ff9ff21ec8b4975cf8178b1a770b7194050
|
Provenance
The following attestation bundles were made for bmctool-1.0.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on schuenke/BMCTool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bmctool-1.0.1-py3-none-any.whl -
Subject digest:
1bf141a23f9bb444bd2e638ecf534bb1f7ca62dafe765c6c438f716afcd74100 - Sigstore transparency entry: 924003120
- Sigstore integration time:
-
Permalink:
schuenke/BMCTool@ec1efd2d21902013318ff8106576f8f092fc3d79 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/schuenke
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@ec1efd2d21902013318ff8106576f8f092fc3d79 -
Trigger Event:
push
-
Statement type: