prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [MRG] Add fetch function for eeg_matchingpennies dataset
  Instead of adding a matchingpennies fetcher to the mne-study-template, I thought it could be a nice addition to mne-bids.
  
  We can then easily import it at mne-study-template and make it run.
  
  Merge checklist
  ---------------
  
  Maintainer, please confirm the following before merging:
  
  - [ ] All comments resolved
  - [ ] This is not your own PR
  - [x] All CIs are happy
  - [x] PR title starts with [MRG]
  - [x] [whats_new.rst](https://github.com/mne-tools/mne-bids/blob/master/doc/whats_new.rst) is updated
  - ~PR description includes phrase "closes <#issue-number>"~
  - [x] Commit history does not contain any merge commits
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `examples/rename_brainvision_files.py`
  Content:
  ```
  1 """
  2 =================================
  3 Rename BrainVision EEG data files
  4 =================================
  5 
  6 The BrainVision file format is one of the recommended formats to store EEG data
  7 within a BIDS directory. To organize EEG data in BIDS format, it is often
  8 necessary to rename the files. In the case of BrainVision files, we would have
  9 to rename multiple files for each dataset instance (i.e., once per recording):
  10 
  11 1. A text header file (``.vhdr``) containing meta data
  12 2. A text marker file (``.vmrk``) containing information about events in the
  13    data
  14 3. A binary data file (``.eeg``) containing the voltage values of the EEG
  15 
  16 The problem is that the three files contain internal links that guide a
  17 potential data reading software. If we just rename the three files without also
  18 adjusting the internal links, we corrupt the file format.
  19 
  20 In this example, we use MNE-BIDS to rename BrainVision data files including a
  21 repair of the internal file pointers.
  22 
  23 For the command line version of this tool, see the :code:`cp` tool in the docs
  24 for the :ref:`Python Command Line Interface <python_cli>`.
  25 
  26 """
  27 
  28 # Authors: Stefan Appelhoff <stefan.appelhoff@mailbox.org>
  29 # License: BSD (3-clause)
  30 
  31 ###############################################################################
  32 # We are importing everything we need for this example:
  33 import os
  34 
  35 from numpy.testing import assert_array_equal
  36 from mne.io import read_raw_brainvision
  37 
  38 from mne_bids.datasets import fetch_brainvision_testing_data
  39 from mne_bids.copyfiles import copyfile_brainvision
  40 
  41 ###############################################################################
  42 # Step 1: Download some example data
  43 # ----------------------------------
  44 # To demonstrate the MNE-BIDS functions, we need some testing data. Here, we
  45 # will use data that is shipped with MNE-Python. Feel free to use your own
  46 # BrainVision data.
  47 examples_dir = fetch_brainvision_testing_data()
  48 
  49 ###############################################################################
  50 # Step 2: Rename the recording
  51 # ----------------------------------
  52 # Above, at the top of the example, we imported ``copyfile_brainvision`` from
  53 # the MNE-BIDS ``utils.py`` module. This function takes two arguments as
  54 # input: First, the path to the existing .vhdr file. And second, the path to
  55 # the future .vhdr file.
  56 #
  57 # ``copyfile_brainvision`` will then create three new files (.vhdr, .vmrk, and
  58 # .eeg) with the new names as provided with the second argument.
  59 #
  60 # Here, we rename test.vhdr to test_renamed.vhdr:
  61 vhdr_file = os.path.join(examples_dir, 'test.vhdr')
  62 vhdr_file_renamed = os.path.join(examples_dir, 'test_renamed.vhdr')
  63 copyfile_brainvision(vhdr_file, vhdr_file_renamed)
  64 
  65 ###############################################################################
  66 # Step 3: Assert that the renamed data can be read by a software
  67 # --------------------------------------------------------------
  68 # Finally, let's use MNE-Python to read in both, the original BrainVision data
  69 # as well as the renamed data. They should be the same.
  70 raw = read_raw_brainvision(vhdr_file)
  71 raw_renamed = read_raw_brainvision(vhdr_file_renamed)
  72 
  73 assert_array_equal(raw.get_data(), raw_renamed.get_data())
  74 
  75 ###############################################################################
  76 # Further information
  77 # -------------------
  78 # There are alternative options to rename your BrainVision files. You could
  79 # for example check out the
  80 # `BVARENAMER <https://github.com/stefanSchinkel/bvarenamer>`_ by Stefan
  81 # Schinkel.
  82 #
  83 # Lastly, there is a tool to check the integrity of your BrainVision files.
  84 # For that, see the `BrainVision Validator <bv-validator_>`_
  85 #
  86 # .. LINKS
  87 #
  88 # .. _`bv-validator`: https://github.com/sappelhoff/brainvision-validator
  89
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/examples/rename_brainvision_files.py b/examples/rename_brainvision_files.py
  --- a/examples/rename_brainvision_files.py
  +++ b/examples/rename_brainvision_files.py
  @@ -30,36 +30,42 @@
   
   ###############################################################################
   # We are importing everything we need for this example:
  -import os
  +import os.path as op
   
   from numpy.testing import assert_array_equal
  -from mne.io import read_raw_brainvision
  +import mne
   
  -from mne_bids.datasets import fetch_brainvision_testing_data
   from mne_bids.copyfiles import copyfile_brainvision
   
   ###############################################################################
   # Step 1: Download some example data
   # ----------------------------------
   # To demonstrate the MNE-BIDS functions, we need some testing data. Here, we
  -# will use data that is shipped with MNE-Python. Feel free to use your own
  -# BrainVision data.
  -examples_dir = fetch_brainvision_testing_data()
  +# will use the MNE-Python testing data. Feel free to use your own BrainVision
  +# data.
  +#
  +# .. warning:: This will download 1.6 GB of data!
  +
  +data_path = mne.datasets.testing.data_path()
  +examples_dir = op.join(data_path, 'Brainvision')
   
   ###############################################################################
   # Step 2: Rename the recording
   # ----------------------------------
  -# Above, at the top of the example, we imported ``copyfile_brainvision`` from
  +# Above, at the top of the example, we imported
  +# :func:`mne_bids.utils.copyfile_brainvision` from
   # the MNE-BIDS ``utils.py`` module. This function takes two arguments as
   # input: First, the path to the existing .vhdr file. And second, the path to
   # the future .vhdr file.
   #
  -# ``copyfile_brainvision`` will then create three new files (.vhdr, .vmrk, and
  -# .eeg) with the new names as provided with the second argument.
  +# :func:`mne_bids.utils.copyfile_brainvision` will then create three new files
  +# (.vhdr, .vmrk, and .eeg) with the new names as provided with the second
  +# argument.
   #
  -# Here, we rename test.vhdr to test_renamed.vhdr:
  -vhdr_file = os.path.join(examples_dir, 'test.vhdr')
  -vhdr_file_renamed = os.path.join(examples_dir, 'test_renamed.vhdr')
  +# Here, we rename a test file name:
  +
  +vhdr_file = op.join(examples_dir, 'test_NO.vhdr')
  +vhdr_file_renamed = op.join(examples_dir, 'test_renamed.vhdr')
   copyfile_brainvision(vhdr_file, vhdr_file_renamed)
   
   ###############################################################################
  @@ -67,8 +73,8 @@
   # --------------------------------------------------------------
   # Finally, let's use MNE-Python to read in both, the original BrainVision data
   # as well as the renamed data. They should be the same.
  -raw = read_raw_brainvision(vhdr_file)
  -raw_renamed = read_raw_brainvision(vhdr_file_renamed)
  +raw = mne.io.read_raw_brainvision(vhdr_file)
  +raw_renamed = mne.io.read_raw_brainvision(vhdr_file_renamed)
   
   assert_array_equal(raw.get_data(), raw_renamed.get_data())
  
verification_info: {"golden_diff": "diff --git a/examples/rename_brainvision_files.py b/examples/rename_brainvision_files.py\n--- a/examples/rename_brainvision_files.py\n+++ b/examples/rename_brainvision_files.py\n@@ -30,36 +30,42 @@\n \n ###############################################################################\n # We are importing everything we need for this example:\n-import os\n+import os.path as op\n \n from numpy.testing import assert_array_equal\n-from mne.io import read_raw_brainvision\n+import mne\n \n-from mne_bids.datasets import fetch_brainvision_testing_data\n from mne_bids.copyfiles import copyfile_brainvision\n \n ###############################################################################\n # Step 1: Download some example data\n # ----------------------------------\n # To demonstrate the MNE-BIDS functions, we need some testing data. Here, we\n-# will use data that is shipped with MNE-Python. Feel free to use your own\n-# BrainVision data.\n-examples_dir = fetch_brainvision_testing_data()\n+# will use the MNE-Python testing data. Feel free to use your own BrainVision\n+# data.\n+#\n+# .. warning:: This will download 1.6 GB of data!\n+\n+data_path = mne.datasets.testing.data_path()\n+examples_dir = op.join(data_path, 'Brainvision')\n \n ###############################################################################\n # Step 2: Rename the recording\n # ----------------------------------\n-# Above, at the top of the example, we imported ``copyfile_brainvision`` from\n+# Above, at the top of the example, we imported\n+# :func:`mne_bids.utils.copyfile_brainvision` from\n # the MNE-BIDS ``utils.py`` module. This function takes two arguments as\n # input: First, the path to the existing .vhdr file. And second, the path to\n # the future .vhdr file.\n #\n-# ``copyfile_brainvision`` will then create three new files (.vhdr, .vmrk, and\n-# .eeg) with the new names as provided with the second argument.\n+# :func:`mne_bids.utils.copyfile_brainvision` will then create three new files\n+# (.vhdr, .vmrk, and .eeg) with the new names as provided with the second\n+# argument.\n #\n-# Here, we rename test.vhdr to test_renamed.vhdr:\n-vhdr_file = os.path.join(examples_dir, 'test.vhdr')\n-vhdr_file_renamed = os.path.join(examples_dir, 'test_renamed.vhdr')\n+# Here, we rename a test file name:\n+\n+vhdr_file = op.join(examples_dir, 'test_NO.vhdr')\n+vhdr_file_renamed = op.join(examples_dir, 'test_renamed.vhdr')\n copyfile_brainvision(vhdr_file, vhdr_file_renamed)\n \n ###############################################################################\n@@ -67,8 +73,8 @@\n # --------------------------------------------------------------\n # Finally, let's use MNE-Python to read in both, the original BrainVision data\n # as well as the renamed data. They should be the same.\n-raw = read_raw_brainvision(vhdr_file)\n-raw_renamed = read_raw_brainvision(vhdr_file_renamed)\n+raw = mne.io.read_raw_brainvision(vhdr_file)\n+raw_renamed = mne.io.read_raw_brainvision(vhdr_file_renamed)\n \n assert_array_equal(raw.get_data(), raw_renamed.get_data())\n", "issue": "[MRG] Add fetch function for eeg_matchingpennies dataset\nInstead of adding a matchingpennies fetcher to the mne-study-template, I thought it could be a nice addition to mne-bids.\r\n\r\nWe can then easily import it at mne-study-template and make it run.\r\n\r\nMerge checklist\r\n---------------\r\n\r\nMaintainer, please confirm the following before merging:\r\n\r\n- [ ] All comments resolved\r\n- [ ] This is not your own PR\r\n- [x] All CIs are happy\r\n- [x] PR title starts with [MRG]\r\n- [x] [whats_new.rst](https://github.com/mne-tools/mne-bids/blob/master/doc/whats_new.rst) is updated\r\n- ~PR description includes phrase \"closes <#issue-number>\"~\r\n- [x] Commit history does not contain any merge commits\r\n\n", "before_files": [{"content": "\"\"\"\n=================================\nRename BrainVision EEG data files\n=================================\n\nThe BrainVision file format is one of the recommended formats to store EEG data\nwithin a BIDS directory. To organize EEG data in BIDS format, it is often\nnecessary to rename the files. In the case of BrainVision files, we would have\nto rename multiple files for each dataset instance (i.e., once per recording):\n\n1. A text header file (``.vhdr``) containing meta data\n2. A text marker file (``.vmrk``) containing information about events in the\n   data\n3. A binary data file (``.eeg``) containing the voltage values of the EEG\n\nThe problem is that the three files contain internal links that guide a\npotential data reading software. If we just rename the three files without also\nadjusting the internal links, we corrupt the file format.\n\nIn this example, we use MNE-BIDS to rename BrainVision data files including a\nrepair of the internal file pointers.\n\nFor the command line version of this tool, see the :code:`cp` tool in the docs\nfor the :ref:`Python Command Line Interface <python_cli>`.\n\n\"\"\"\n\n# Authors: Stefan Appelhoff <stefan.appelhoff@mailbox.org>\n# License: BSD (3-clause)\n\n###############################################################################\n# We are importing everything we need for this example:\nimport os\n\nfrom numpy.testing import assert_array_equal\nfrom mne.io import read_raw_brainvision\n\nfrom mne_bids.datasets import fetch_brainvision_testing_data\nfrom mne_bids.copyfiles import copyfile_brainvision\n\n###############################################################################\n# Step 1: Download some example data\n# ----------------------------------\n# To demonstrate the MNE-BIDS functions, we need some testing data. Here, we\n# will use data that is shipped with MNE-Python. Feel free to use your own\n# BrainVision data.\nexamples_dir = fetch_brainvision_testing_data()\n\n###############################################################################\n# Step 2: Rename the recording\n# ----------------------------------\n# Above, at the top of the example, we imported ``copyfile_brainvision`` from\n# the MNE-BIDS ``utils.py`` module. This function takes two arguments as\n# input: First, the path to the existing .vhdr file. And second, the path to\n# the future .vhdr file.\n#\n# ``copyfile_brainvision`` will then create three new files (.vhdr, .vmrk, and\n# .eeg) with the new names as provided with the second argument.\n#\n# Here, we rename test.vhdr to test_renamed.vhdr:\nvhdr_file = os.path.join(examples_dir, 'test.vhdr')\nvhdr_file_renamed = os.path.join(examples_dir, 'test_renamed.vhdr')\ncopyfile_brainvision(vhdr_file, vhdr_file_renamed)\n\n###############################################################################\n# Step 3: Assert that the renamed data can be read by a software\n# --------------------------------------------------------------\n# Finally, let's use MNE-Python to read in both, the original BrainVision data\n# as well as the renamed data. They should be the same.\nraw = read_raw_brainvision(vhdr_file)\nraw_renamed = read_raw_brainvision(vhdr_file_renamed)\n\nassert_array_equal(raw.get_data(), raw_renamed.get_data())\n\n###############################################################################\n# Further information\n# -------------------\n# There are alternative options to rename your BrainVision files. You could\n# for example check out the\n# `BVARENAMER <https://github.com/stefanSchinkel/bvarenamer>`_ by Stefan\n# Schinkel.\n#\n# Lastly, there is a tool to check the integrity of your BrainVision files.\n# For that, see the `BrainVision Validator <bv-validator_>`_\n#\n# .. LINKS\n#\n# .. _`bv-validator`: https://github.com/sappelhoff/brainvision-validator\n", "path": "examples/rename_brainvision_files.py"}], "after_files": [{"content": "\"\"\"\n=================================\nRename BrainVision EEG data files\n=================================\n\nThe BrainVision file format is one of the recommended formats to store EEG data\nwithin a BIDS directory. To organize EEG data in BIDS format, it is often\nnecessary to rename the files. In the case of BrainVision files, we would have\nto rename multiple files for each dataset instance (i.e., once per recording):\n\n1. A text header file (``.vhdr``) containing meta data\n2. A text marker file (``.vmrk``) containing information about events in the\n   data\n3. A binary data file (``.eeg``) containing the voltage values of the EEG\n\nThe problem is that the three files contain internal links that guide a\npotential data reading software. If we just rename the three files without also\nadjusting the internal links, we corrupt the file format.\n\nIn this example, we use MNE-BIDS to rename BrainVision data files including a\nrepair of the internal file pointers.\n\nFor the command line version of this tool, see the :code:`cp` tool in the docs\nfor the :ref:`Python Command Line Interface <python_cli>`.\n\n\"\"\"\n\n# Authors: Stefan Appelhoff <stefan.appelhoff@mailbox.org>\n# License: BSD (3-clause)\n\n###############################################################################\n# We are importing everything we need for this example:\nimport os.path as op\n\nfrom numpy.testing import assert_array_equal\nimport mne\n\nfrom mne_bids.copyfiles import copyfile_brainvision\n\n###############################################################################\n# Step 1: Download some example data\n# ----------------------------------\n# To demonstrate the MNE-BIDS functions, we need some testing data. Here, we\n# will use the MNE-Python testing data. Feel free to use your own BrainVision\n# data.\n#\n# .. warning:: This will download 1.6 GB of data!\n\ndata_path = mne.datasets.testing.data_path()\nexamples_dir = op.join(data_path, 'Brainvision')\n\n###############################################################################\n# Step 2: Rename the recording\n# ----------------------------------\n# Above, at the top of the example, we imported\n# :func:`mne_bids.utils.copyfile_brainvision` from\n# the MNE-BIDS ``utils.py`` module. This function takes two arguments as\n# input: First, the path to the existing .vhdr file. And second, the path to\n# the future .vhdr file.\n#\n# :func:`mne_bids.utils.copyfile_brainvision` will then create three new files\n# (.vhdr, .vmrk, and .eeg) with the new names as provided with the second\n# argument.\n#\n# Here, we rename a test file name:\n\nvhdr_file = op.join(examples_dir, 'test_NO.vhdr')\nvhdr_file_renamed = op.join(examples_dir, 'test_renamed.vhdr')\ncopyfile_brainvision(vhdr_file, vhdr_file_renamed)\n\n###############################################################################\n# Step 3: Assert that the renamed data can be read by a software\n# --------------------------------------------------------------\n# Finally, let's use MNE-Python to read in both, the original BrainVision data\n# as well as the renamed data. They should be the same.\nraw = mne.io.read_raw_brainvision(vhdr_file)\nraw_renamed = mne.io.read_raw_brainvision(vhdr_file_renamed)\n\nassert_array_equal(raw.get_data(), raw_renamed.get_data())\n\n###############################################################################\n# Further information\n# -------------------\n# There are alternative options to rename your BrainVision files. You could\n# for example check out the\n# `BVARENAMER <https://github.com/stefanSchinkel/bvarenamer>`_ by Stefan\n# Schinkel.\n#\n# Lastly, there is a tool to check the integrity of your BrainVision files.\n# For that, see the `BrainVision Validator <bv-validator_>`_\n#\n# .. LINKS\n#\n# .. _`bv-validator`: https://github.com/sappelhoff/brainvision-validator\n", "path": "examples/rename_brainvision_files.py"}]}