<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Compare the different ICA algorithms in MNE
Different ICA algorithms are fit to raw MEG data, and the corresponding maps
are displayed.
Step1:  Read and preprocess the data. Preprocessing consists of
Step2:  Define a function that runs ICA on the raw MEG data and plots the components
Step3:  FastICA
Step4:  Picard
Step5:  Infomax
Step6:  Extended Infomax
<ASSISTANT_TASK:>
Python Code:
# Authors: Pierre Ablin <pierreablin@gmail.com>
#
# License: BSD-3-Clause
from time import time
import mne
from mne.preprocessing import ICA
from mne.datasets import sample
print(__doc__)
Explanation: Compare the different ICA algorithms in MNE
Different ICA algorithms are fit to raw MEG data, and the corresponding maps
are displayed.
End of explanation
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'
raw = mne.io.read_raw_fif(raw_fname).crop(0, 60).pick('meg').load_data()
reject = dict(mag=5e-12, grad=4000e-13)
raw.filter(1, 30, fir_design='firwin')
Explanation: Read and preprocess the data. Preprocessing consists of:
MEG channel selection
1-30 Hz band-pass filter
End of explanation
def run_ica(method, fit_params=None):
    ica = ICA(n_components=20, method=method, fit_params=fit_params,
              max_iter='auto', random_state=0)
    t0 = time()
    ica.fit(raw, reject=reject)
    fit_time = time() - t0
    title = ('ICA decomposition using %s (took %.1fs)' % (method, fit_time))
    ica.plot_components(title=title)
Explanation: Define a function that runs ICA on the raw MEG data and plots the components
End of explanation
run_ica('fastica')
Explanation: FastICA
End of explanation
run_ica('picard')
Explanation: Picard
End of explanation
run_ica('infomax')
Explanation: Infomax
End of explanation
run_ica('infomax', fit_params=dict(extended=True))
Explanation: Extended Infomax
End of explanation
<END_TASK>