Python tools for creating RS
Installation and Set-up
We recommend using Python 3.10 or higher and installing dependencies in a virtual environment.
If you plan to call rs_py from MATLAB, the required Python version may depend on your MATLAB version.
1. Download rs-software from GitHub
Clone the repository from GitHub by typing the following into your terminal.
Alternatively, download the zipped folder.2. Create a virtual environment
We recommend using a virtual environment when working with the scripts in rs_py.
Throughout this guide we use conda, but other tools such as venv can be used instead.
You may also install the required dependencies into your global Python environment, although this is generally not recommended.
If you do not already have conda installed, see the official documentation here:
Create a conda environment with Python 3.10 or higher:
If you do not already have conda you may have to install it, or you can use an alternate utility to create a virtual environment such as venv.3. Install dependencies
While in your new conda environment, type the following in your terminal to install required packages:
4. Verify installation
Verify that the environment was created and note the path to it, by typing the following in the terminal:
You may see output resembling the following. Copy the path you see for thers_env environment as it will be used when setting up MATLAB.
# conda environments:
#
# * -> active
# + -> frozen
/Users/suniyya/fsl
base /Users/suniyya/miniconda3
rs_env * /Users/suniyya/miniconda3/envs/rs_env
4. Set up MATLAB environment
If you do not intend to run rs_py scripts from MATLAB, you can skip this step.
We assume MATLAB R2024a or R2024b is being used. Other versions may also work with Python 3.10, but compatibility should be verified by the user. If you are able to complete this step, then there is no compatibility issue.
- Open MATLAB.
- Navigate to the
rs-softwarefolder and make suresrchas been added to the path. - Open the MATLAB console and set the python environment by typing the following:
Ensure you replace the above path with what you copied in the previous step.
;
Now, you should be able to import python modules and run them. See section Using MATLAB to run rs_py for details.