The original bloch equation simulator was a matlab mex file created by Brian Hargreaves at Stanford University. This is a modification to run it as a python C extension. The simulator was used in a graduate MRI class taught by Miki Lustig. Lustig wrote several helper modules in matlab, which have also been converted to python here.
This module was developed on a linux platform and has been since been tested on macos 10.14.6.
Minor edits by Gopal Nataraj
python 3.7
numpy 1.16.4
scipy 1.3.0
matplotlib 3.1.0
Other versions have not been tested, but there should be some flexibility.
First, make sure your build environment can build python c extensions. Here are some instructions that may help on macs.
Next, run pip install -e .
from the base directory.
Use from bloch import bloch
for the primary bloch simulator function.
Run python -m unittest
from the base directory.
This library is distributed under the same terms as Brian's original bloch simulator.
Thanks to Brian for the original bloch simulator, Miki for the helper modules, and NPann for assisting with a critical bug fix.