This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, reproduction and adaptation in any medium and for any purpose provided that it is properly attributed. For attribution, the original author(s), title, publication source (PeerJ Preprints) and either DOI or URL of the article must be cited.
Data from magnetoencephalography (MEG) and electroencephalography (EEG) is extremely rich and multifaceted. For example, in a standard MEG recording with 306 sensors and a sampling rate of 1,000 Hz, 306,000 data points are sampled every second. To be able to answer the question, which was the ultimate reason for acquiring the data, thus necessitates efficient data handling. Luckily, several software packages have been developed for handling MEG and/or EEG data. To name some of the most popular: MNE-Python; FieldTrip; Brainstorm; EEGLAB and SPM. These are all available under a public domain licence, meaning that they can be run, shared and modified by anyone. Commercial software released under proprietary licences include BESA and CURRY. It is important to be aware of that for clinical diagnosis of for example epilepsy, certified software is required FieldTrip, MNE-Python, Brainstorm, EEGLAB and SPM for example cannot be used for that. In this chapter, the emphasis will be on MNE-Python and FieldTrip. This will allow users of both Python and MATLAB (or alternatively GNU Octave to code along as the chapter unfolds. As a general remark, all that MNE-Python can do, FieldTrip can do and vice versa – though with some small difference. A full analysis going from raw data to a source reconstruction will be presented, illustrated with both code and figures with the aim of providing newcomers to the field a stepping stone towards doing their own analyses of their own datasets.
Code snippet 3 had accidentally been omitted - has been added now.
Code snippet 8 accidentally appeared twice - only one appears now.
Code snippet 12 had 'inisde' instead of 'inside' - has been changed now.