Code for processing MEG data