prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  use bibtex in plot_evoked_whitening.py
  convert references in `examples/visualization/plot_evoked_whitening.py` to use footcite / footbibliography
  
  
  </issue>
  <code>
  [start of examples/visualization/plot_evoked_whitening.py]
  1 """
  2 =============================================
  3 Whitening evoked data with a noise covariance
  4 =============================================
  5 
  6 Evoked data are loaded and then whitened using a given noise covariance
  7 matrix. It's an excellent quality check to see if baseline signals match
  8 the assumption of Gaussian white noise during the baseline period.
  9 
  10 Covariance estimation and diagnostic plots are based on [1]_.
  11 
  12 References
  13 ----------
  14 .. [1] Engemann D. and Gramfort A. (2015) Automated model selection in
  15     covariance estimation and spatial whitening of MEG and EEG signals, vol.
  16     108, 328-342, NeuroImage.
  17 
  18 """
  19 # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
  20 #          Denis A. Engemann <denis.engemann@gmail.com>
  21 #
  22 # License: BSD (3-clause)
  23 
  24 import mne
  25 
  26 from mne import io
  27 from mne.datasets import sample
  28 from mne.cov import compute_covariance
  29 
  30 print(__doc__)
  31 
  32 ###############################################################################
  33 # Set parameters
  34 
  35 data_path = sample.data_path()
  36 raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'
  37 event_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw-eve.fif'
  38 
  39 raw = io.read_raw_fif(raw_fname, preload=True)
  40 raw.filter(1, 40, n_jobs=1, fir_design='firwin')
  41 raw.info['bads'] += ['MEG 2443']  # bads + 1 more
  42 events = mne.read_events(event_fname)
  43 
  44 # let's look at rare events, button presses
  45 event_id, tmin, tmax = 2, -0.2, 0.5
  46 reject = dict(mag=4e-12, grad=4000e-13, eeg=80e-6)
  47 
  48 epochs = mne.Epochs(raw, events, event_id, tmin, tmax, picks=('meg', 'eeg'),
  49                     baseline=None, reject=reject, preload=True)
  50 
  51 # Uncomment next line to use fewer samples and study regularization effects
  52 # epochs = epochs[:20]  # For your data, use as many samples as you can!
  53 
  54 ###############################################################################
  55 # Compute covariance using automated regularization
  56 method_params = dict(diagonal_fixed=dict(mag=0.01, grad=0.01, eeg=0.01))
  57 noise_covs = compute_covariance(epochs, tmin=None, tmax=0, method='auto',
  58                                 return_estimators=True, verbose=True, n_jobs=1,
  59                                 projs=None, rank=None,
  60                                 method_params=method_params)
  61 
  62 # With "return_estimator=True" all estimated covariances sorted
  63 # by log-likelihood are returned.
  64 
  65 print('Covariance estimates sorted from best to worst')
  66 for c in noise_covs:
  67     print("%s : %s" % (c['method'], c['loglik']))
  68 
  69 ###############################################################################
  70 # Show the evoked data:
  71 
  72 evoked = epochs.average()
  73 
  74 evoked.plot(time_unit='s')  # plot evoked response
  75 
  76 ###############################################################################
  77 # We can then show whitening for our various noise covariance estimates.
  78 #
  79 # Here we should look to see if baseline signals match the
  80 # assumption of Gaussian white noise. we expect values centered at
  81 # 0 within 2 standard deviations for 95% of the time points.
  82 #
  83 # For the Global field power we expect a value of 1.
  84 
  85 evoked.plot_white(noise_covs, time_unit='s')
  86
  [end of examples/visualization/plot_evoked_whitening.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/examples/visualization/plot_evoked_whitening.py b/examples/visualization/plot_evoked_whitening.py
  --- a/examples/visualization/plot_evoked_whitening.py
  +++ b/examples/visualization/plot_evoked_whitening.py
  @@ -7,13 +7,12 @@
   matrix. It's an excellent quality check to see if baseline signals match
   the assumption of Gaussian white noise during the baseline period.
   
  -Covariance estimation and diagnostic plots are based on [1]_.
  +Covariance estimation and diagnostic plots are based on
  +:footcite:`EngemannGramfort2015`.
   
   References
   ----------
  -.. [1] Engemann D. and Gramfort A. (2015) Automated model selection in
  -    covariance estimation and spatial whitening of MEG and EEG signals, vol.
  -    108, 328-342, NeuroImage.
  +.. footbibliography::
   
   """
   # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
  
verification_info: {"golden_diff": "diff --git a/examples/visualization/plot_evoked_whitening.py b/examples/visualization/plot_evoked_whitening.py\n--- a/examples/visualization/plot_evoked_whitening.py\n+++ b/examples/visualization/plot_evoked_whitening.py\n@@ -7,13 +7,12 @@\n matrix. It's an excellent quality check to see if baseline signals match\n the assumption of Gaussian white noise during the baseline period.\n \n-Covariance estimation and diagnostic plots are based on [1]_.\n+Covariance estimation and diagnostic plots are based on\n+:footcite:`EngemannGramfort2015`.\n \n References\n ----------\n-.. [1] Engemann D. and Gramfort A. (2015) Automated model selection in\n-    covariance estimation and spatial whitening of MEG and EEG signals, vol.\n-    108, 328-342, NeuroImage.\n+.. footbibliography::\n \n \"\"\"\n # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>\n", "issue": "use bibtex in plot_evoked_whitening.py\nconvert references in `examples/visualization/plot_evoked_whitening.py` to use footcite / footbibliography\r\n\n", "before_files": [{"content": "\"\"\"\n=============================================\nWhitening evoked data with a noise covariance\n=============================================\n\nEvoked data are loaded and then whitened using a given noise covariance\nmatrix. It's an excellent quality check to see if baseline signals match\nthe assumption of Gaussian white noise during the baseline period.\n\nCovariance estimation and diagnostic plots are based on [1]_.\n\nReferences\n----------\n.. [1] Engemann D. and Gramfort A. (2015) Automated model selection in\n    covariance estimation and spatial whitening of MEG and EEG signals, vol.\n    108, 328-342, NeuroImage.\n\n\"\"\"\n# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>\n#          Denis A. Engemann <denis.engemann@gmail.com>\n#\n# License: BSD (3-clause)\n\nimport mne\n\nfrom mne import io\nfrom mne.datasets import sample\nfrom mne.cov import compute_covariance\n\nprint(__doc__)\n\n###############################################################################\n# Set parameters\n\ndata_path = sample.data_path()\nraw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'\nevent_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw-eve.fif'\n\nraw = io.read_raw_fif(raw_fname, preload=True)\nraw.filter(1, 40, n_jobs=1, fir_design='firwin')\nraw.info['bads'] += ['MEG 2443']  # bads + 1 more\nevents = mne.read_events(event_fname)\n\n# let's look at rare events, button presses\nevent_id, tmin, tmax = 2, -0.2, 0.5\nreject = dict(mag=4e-12, grad=4000e-13, eeg=80e-6)\n\nepochs = mne.Epochs(raw, events, event_id, tmin, tmax, picks=('meg', 'eeg'),\n                    baseline=None, reject=reject, preload=True)\n\n# Uncomment next line to use fewer samples and study regularization effects\n# epochs = epochs[:20]  # For your data, use as many samples as you can!\n\n###############################################################################\n# Compute covariance using automated regularization\nmethod_params = dict(diagonal_fixed=dict(mag=0.01, grad=0.01, eeg=0.01))\nnoise_covs = compute_covariance(epochs, tmin=None, tmax=0, method='auto',\n                                return_estimators=True, verbose=True, n_jobs=1,\n                                projs=None, rank=None,\n                                method_params=method_params)\n\n# With \"return_estimator=True\" all estimated covariances sorted\n# by log-likelihood are returned.\n\nprint('Covariance estimates sorted from best to worst')\nfor c in noise_covs:\n    print(\"%s : %s\" % (c['method'], c['loglik']))\n\n###############################################################################\n# Show the evoked data:\n\nevoked = epochs.average()\n\nevoked.plot(time_unit='s')  # plot evoked response\n\n###############################################################################\n# We can then show whitening for our various noise covariance estimates.\n#\n# Here we should look to see if baseline signals match the\n# assumption of Gaussian white noise. we expect values centered at\n# 0 within 2 standard deviations for 95% of the time points.\n#\n# For the Global field power we expect a value of 1.\n\nevoked.plot_white(noise_covs, time_unit='s')\n", "path": "examples/visualization/plot_evoked_whitening.py"}]}