MRI simulation toolkit
Project description
Sycomore — an MRI simulation toolkit
Sycomore is an MRI simulation toolkit providing Bloch simulation, Extended Phase Graph (EPG) (both regular and discrete, including 3D), and Configuration Model. Sycomore is a Python packge in which all computationnaly-intensive operations are run by a C++ backend, providing a very fast runtime.
Sycomore is free software, released under the MIT license, and its source code is available on GitHub.
A sample web application, using Sycomore paired with Bokeh is available on Heroku: it presents classical MRI experiments (RARE, RF-spoiling, slice profile with a selective sinc pulse), using the different simulation models of Sycomore.
Installation
Packaged versions of Sycomore are available on pypi and Anaconda for Linux, macOS and Windows.
To install from Anaconda, type conda install -c conda-forge sycomore
. To install from pypi, type pip3 install sycomore
(or pip install sycomore
). If you are installing from pypi and no pre-compiled version is available for your platform, pip will try to install from the source archive.
If you need to install Sycomore from source, you will need a C++11 compiler, CMake, xsimd and pybind11 to successfully build Sycomore. If you want to validate your build of Sycomore, you should run the unit tests, which require Boost.Test.
Additional details are provided in the documentation.
Usage
The following code simulates a single repetition of a simple RARE sequence using regular EPG and plots the transverse magnetization of each echo.
import matplotlib.pyplot
import numpy
import sycomore
from sycomore.units import *
species = sycomore.Species(1000*ms, 100*ms, 1*um**2/ms)
TE = 4*ms
train_length = 40
model = sycomore.epg.Regular(species)
data = numpy.zeros(train_length, dtype=[("time", sycomore.Quantity), ("signal", complex)])
model.apply_pulse(90*deg)
for echo in range(train_length):
model.apply_time_interval(TE/2)
model.apply_pulse(180*deg)
model.apply_time_interval(TE/2)
data[echo] = (((1+echo)*TE), model.echo)
times = [x.convert_to(ms) for x in data["time"]]
magnitude = numpy.abs(data["signal"])
matplotlib.pyplot.plot(times, magnitude, ".", label="Simulated")
matplotlib.pyplot.plot(
times, [numpy.exp(-(x*species.R2).magnitude) for x in data["time"]],
label="$T_2$ decay")
matplotlib.pyplot.ylim(0,1)
matplotlib.pyplot.xlabel("Time (ms)")
matplotlib.pyplot.ylabel("Magnitude")
matplotlib.pyplot.legend()
matplotlib.pyplot.show()
The features and data structures are described in the documentation:
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 Distributions
Hashes for sycomore-1.3.2-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c555d208e2dc966777f524c0510c318bcc4f7e6d20e69670fa7fdf9af191a5c |
|
MD5 | 073a3332c1c274d847bc93b3b734866c |
|
BLAKE2b-256 | fa037c135ff071949e75161ef953c1b4e8fb8500138558c43d6ff6a21edce59e |
Hashes for sycomore-1.3.2-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c339ea23942ccd9fb981cd54714e5dd2b3dcf4de684dca68703e40d05ba228e3 |
|
MD5 | 9c9fceffc7af54a391dc1a40f252523d |
|
BLAKE2b-256 | 277dca6bd2499413558333a38a65ef0b771b92f7758675c5c8e037fa4e86e5e1 |
Hashes for sycomore-1.3.2-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2024ba458a77ae882da93ad2c340af0c86e323e4b3ae61800f296eacf319d6c6 |
|
MD5 | a5a28a0bcc08ed9f3cc500b811db3a9f |
|
BLAKE2b-256 | 7dd24a309429bb8e517e9710af4e4e02c9aa7ee91d8398056dd1fde69a0efb29 |
Hashes for sycomore-1.3.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f28853ecb1f47ada1969686b7a7882d79697dc72b6eab8c38d9d63745a1d4915 |
|
MD5 | 1d17bc921d1353a04ab5940029f7d804 |
|
BLAKE2b-256 | 11f513fbf7dc82f24b84a72cf5411ace06f6463610b0f874b3576ff5eda818fd |
Hashes for sycomore-1.3.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1412a347bb8e4ca1ece539dbbdc5f2280e5819ab8d46d06b3efdfac05ad8456 |
|
MD5 | cc92699b10a420502a6b4b9ecde29e38 |
|
BLAKE2b-256 | 61798a498f0c4154468f0783d93594af6116df09da519530b554273cb99afc23 |
Hashes for sycomore-1.3.2-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3537f67fe4f41c704980e26c8e6ca2bd17280a2336f5e540f83261bd682b323a |
|
MD5 | c70029cdba027739e484bf1ce6ffa0a3 |
|
BLAKE2b-256 | ebc1311f849bb4a0757a2343e08d1e6c1c19af8eabfe3a038dbcbed1e999e8ed |
Hashes for sycomore-1.3.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ef05f880a1a12301a3f7b280f3a9689d2583af52e2881358430b84d8c5f8dbd |
|
MD5 | 8938ac445f72daa812a8717491415326 |
|
BLAKE2b-256 | cbb47b41455f2d07917c5e466b46cc1b10353904dba440644a5d9b5fdd3414d7 |
Hashes for sycomore-1.3.2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbe57be24f51f6445115498c2dcef8164c5143ca477b378cc028b4e09df1b480 |
|
MD5 | 8ba15c9a2241e92498507771352cee93 |
|
BLAKE2b-256 | 9bb6e1bfbbff6dd70d4c1fe315b918397fef54eff83bdfd37bdba1548a18b040 |
Hashes for sycomore-1.3.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc977ecc04aaa6eabb62adfe4cf82f6b74a2abcfea46a646eec6b1b63203b64e |
|
MD5 | a1334b971351b619eab2c6b8a50d2e05 |
|
BLAKE2b-256 | 5b0cb58abcacaa9589300d89d90b5f29478f32e9834c4a1f41fadf85c1cd415f |
Hashes for sycomore-1.3.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c0c7e32c8c2a249ec5d1bf3df5a031762ec30a031cb0b47bb950e36e51610fb |
|
MD5 | ddc5c84e53f34c5901aa0b57b980a5f3 |
|
BLAKE2b-256 | 750d1ac144bb5c6eebdcfe6627fee9702dd9cd624f797c5dfcb8acef7d3c3fea |
Hashes for sycomore-1.3.2-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3446241d546b918ee5a235af3f8b8017c47b26a25440dec63c9c8bf18abd343 |
|
MD5 | ff866d88e3837f6e4fa4b23f994b8984 |
|
BLAKE2b-256 | 4576321f320d5fbe1e8f4b820dc83e078fbc1230b65690e7f1eba6df2674e3e3 |
Hashes for sycomore-1.3.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6158ada15d4eb268e978319fd9223d0e64e5bb30a8f403460a5caaf9535978b6 |
|
MD5 | 4f256df93aa2348d094211325039a33e |
|
BLAKE2b-256 | d9f190448b1281c1cd6eb540b7cf5e19993a30708a81aca5d7b382a246a69db9 |
Hashes for sycomore-1.3.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dd511a524db1b0c12e549eca2ead234e06073a2bb74c2a039234734d0790cd2 |
|
MD5 | fd60ad66fe14d56dce02b7949a32ac95 |
|
BLAKE2b-256 | 17a4f79b075900cdc7a60a5c2f6d40a69842a6dd577f227ac1e1a30cdbe058fb |
Hashes for sycomore-1.3.2-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fea5609042a6424d2b15eacfe63939e3ed27ed77ef720fddd68b5db9cffe167 |
|
MD5 | 454893b989b9cf805b166a0c16c3ebef |
|
BLAKE2b-256 | a02eacd9a66235d53c03be5208bc7d995b691ff9c116f27501cc751092122859 |
Hashes for sycomore-1.3.2-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9256be1f23e7cd022558dcc344636fc82a3abbdd7e28afa47e33731871896c72 |
|
MD5 | 5df5d2a02fa6f86601e4ce9c3eb51d3f |
|
BLAKE2b-256 | 133e6d99b685663d6024d7a4b92758ab1a3ce67e0a58036c0ed48d74f7f46ddb |