Port of MCML (Monte Carlo Multi-Layered) to Python.
Requires Python 3.10 or above, numba
, and tqdm
.
-
Clone the repo (or download the zip file and extract).
-
Create a virtual environment. Use Miniconda if you don't know what that means. After installing miniconda, open "Anaconda Powershell Prompt" and run
conda create -y -n mcml python=3.10 numba tqdm
This command creates a new virtual environment named
mcml
, and installs Python 3.10 along withnumba
andtqdm
. -
Activate the
mcml
virtual environment:conda activate mcml
-
cd
into the working directory. Replace<path>
with the directory containing the filemain.py
.cd <path>
-
Run the MCML main program with a sample input file. The output will be written to text files specified in the input file. For the example input file, this will be
sample.mco
andsample2.mco
.python main.py sample.mci
The program is checked against the original MCML program. Errors should be <1%.
Most of this program is JIT compiled with numba, hence the speed is reasonable. Simulating 1,000,000 photons in a 3 layer medium takes <20s on my laptop.