Instructions for the workshop

Instructions for the workshop

Build your Python environment

Download all the relevant files and data

Download the fif files and the files in getting_started_with_python https://sciencedata.dk/shared/AarhusMEGschool2023

download Figure: files on sciencedata

Brief introduction to environments

This document will help you build your Python environment such that you can run MNE-Python seamlessly.

We will use Anaconda to build these environments. The rationale about environments is that you only include the packages that you strictly require for the task at hand.

For example, I have an MNE-Python environment for doing MEG analysis, but I have a separate PsychoPy environment for building my experiments. The reason for this is that MNE-Python and PsychoPy have conflicting dependencies.

For this workshop, we will build two environments, one for MNE-Python in general called nordicmne, and an environment for the GUI Meggie called meggie-arhus.
This is done to make sure that there are no conflicts between packages required

Building environments - Anaconda

We will be using Anaconda to build our Python environments

I don’t have Anaconda

We will follow the instructions from MNE-Python’s website, and we will be using the Anaconda distribution of Python https://www.anaconda.com/download

I do have Anaconda (>= Python 3.8)

Then run the following command (Mac & Linux: use a terminal) (Windows: use the Anaconda Prompt)

(Note: don’t include the dollar sign - it just shows that we are using bash)

$ conda create --override-channels --channel=conda-forge --name=nordicmne mne

Now activate your environment:

$ conda activate nordicmne

Your terminal should look like this (but only if you are called lau):

terminal
Figure: You are now in the nordicmne environment

(More information about MNE-Python installation can be found here: https://mne.tools/stable/install/index.html)

Check installation

From your nordicmne environment run the script check_installation.py, which you have downloaded from sciencedata by issuing the following command:

$ conda activate nordicmne
$ python check_installation.py

This will download the MNE-Python sample data (1.65 GB) as well as the somato (611 MB) and OPM (1.2 GB) data sets to your home folder (~/mne_data).
See more about the data set here: https://mne.tools/stable/overview/datasets_index.html#sample
Your output should look similar to this: terminal_output Figure: you have installed the nordicmne environment correctly and you have successfully downloaded the data

Meggie installation:

Meggie is a GUI for doing MNE-Python. We will install that in a separate environment called meggie-arhus

$ conda create -n meggie-arhus -c conda-forge python=3.8 meggie=1.6.1

Next, check that your meggie-installation works

$ conda activate meggie-arhus
$ python check_installation_meggie.py

You should get output looking similar to this:

terminal_output2 Figure: you have the meggie environment installed

Action point:

Show that you have achieved this by sending screenshots of your two outputs to us by clicking the following link: Send proof

Recommendation: Integrated development environment (IDE)

Check https://mne.tools/stable/install/manual_install.html#python-ides to see how you can install IDE’s, e.g. Spyder, Visual Studio Code and PyCharm
I will be using Spyder, which will have a homely feel if you are used to MATLAB