prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Error in examples/Notebook Experiments/script2.ipynb
  script.ipynb runs fine but in script2.ipynb I hit the following error at `experiment = Experiment('test', procedure, analyse)`:
  
  ```python
  
  C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\__init__.py in __setitem__(self, key, val)
      927             raise KeyError(
      928                 '%s is not a valid rc parameter. See rcParams.keys() for a '
  --> 929                 'list of valid parameters.' % (key,))
      930 
      931     def __getitem__(self, key):
  
  KeyError: 'axes.color_cycle is not a valid rc parameter. See rcParams.keys() for a list of valid parameters.'
  ```
  
  Error in examples/Notebook Experiments/script2.ipynb
  script.ipynb runs fine but in script2.ipynb I hit the following error at `experiment = Experiment('test', procedure, analyse)`:
  
  ```python
  
  C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\__init__.py in __setitem__(self, key, val)
      927             raise KeyError(
      928                 '%s is not a valid rc parameter. See rcParams.keys() for a '
  --> 929                 'list of valid parameters.' % (key,))
      930 
      931     def __getitem__(self, key):
  
  KeyError: 'axes.color_cycle is not a valid rc parameter. See rcParams.keys() for a list of valid parameters.'
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `pymeasure/experiment/config.py`
  Content:
  ```
  1 #
  2 # This file is part of the PyMeasure package.
  3 #
  4 # Copyright (c) 2013-2020 PyMeasure Developers
  5 #
  6 # Permission is hereby granted, free of charge, to any person obtaining a copy
  7 # of this software and associated documentation files (the "Software"), to deal
  8 # in the Software without restriction, including without limitation the rights
  9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10 # copies of the Software, and to permit persons to whom the Software is
  11 # furnished to do so, subject to the following conditions:
  12 #
  13 # The above copyright notice and this permission notice shall be included in
  14 # all copies or substantial portions of the Software.
  15 #
  16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22 # THE SOFTWARE.
  23 #
  24 
  25 import configparser
  26 import logging
  27 import os
  28 
  29 log = logging.getLogger(__name__)
  30 log.addHandler(logging.NullHandler())
  31 
  32 
  33 def set_file(filename):
  34     os.environ['CONFIG'] = filename
  35 
  36 
  37 def get_config(filename='default_config.ini'):
  38     if 'CONFIG' in os.environ.keys():
  39         filename = os.environ['CONFIG']
  40     config = configparser.ConfigParser()
  41     config.read(filename)
  42     return config
  43 
  44 
  45 # noinspection PyProtectedMember
  46 def set_mpl_rcparams(config):
  47     if 'matplotlib.rcParams' in config._sections.keys():
  48         import matplotlib
  49         for key in config._sections['matplotlib.rcParams']:
  50             matplotlib.rcParams[key] = eval(config._sections['matplotlib.rcParams'][key])
  51
  ```
  
  Path: `examples/Notebook Experiments/procedures.py`
  Content:
  ```
  1 #
  2 # This file is part of the PyMeasure package.
  3 #
  4 # Copyright (c) 2013-2016 PyMeasure Developers
  5 #
  6 # Permission is hereby granted, free of charge, to any person obtaining a copy
  7 # of this software and associated documentation files (the "Software"), to deal
  8 # in the Software without restriction, including without limitation the rights
  9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10 # copies of the Software, and to permit persons to whom the Software is
  11 # furnished to do so, subject to the following conditions:
  12 #
  13 # The above copyright notice and this permission notice shall be included in
  14 # all copies or substantial portions of the Software.
  15 #
  16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22 # THE SOFTWARE.
  23 #
  24 
  25 import random
  26 from time import sleep
  27 from pymeasure.experiment import Procedure, IntegerParameter, Parameter, FloatParameter
  28 import logging
  29 log = logging.getLogger(__name__)
  30 log.addHandler(logging.NullHandler())
  31 
  32 class TestProcedure(Procedure):
  33 
  34     iterations = IntegerParameter('Loop Iterations', default=100)
  35     delay = FloatParameter('Delay Time', units='s', default=0.2)
  36     seed = Parameter('Random Seed', default='12345')
  37     
  38     DATA_COLUMNS = ['Iteration', 'Random Number']
  39 
  40     def startup(self):
  41         log.info("Setting up random number generator")
  42         random.seed(self.seed)
  43 
  44     def execute(self):
  45         log.info("Starting to generate numbers")
  46         for i in range(self.iterations):
  47             data = {
  48                 'Iteration': i,
  49                 'Random Number': random.random()
  50             }
  51             log.debug("Produced numbers: %s" % data)
  52             self.emit('results', data)
  53             self.emit('progress', 100.*i/self.iterations)
  54             sleep(self.delay)
  55             if self.should_stop():
  56                 log.warning("Catch stop command in procedure")
  57                 break
  58 
  59     def shutdown(self):
  60         log.info("Finished")
  ```
  --- 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/Notebook Experiments/procedures.py b/examples/Notebook Experiments/procedures.py
  deleted file mode 100644
  --- a/examples/Notebook Experiments/procedures.py	
  +++ /dev/null
  @@ -1,60 +0,0 @@
  -#
  -# This file is part of the PyMeasure package.
  -#
  -# Copyright (c) 2013-2016 PyMeasure Developers
  -#
  -# Permission is hereby granted, free of charge, to any person obtaining a copy
  -# of this software and associated documentation files (the "Software"), to deal
  -# in the Software without restriction, including without limitation the rights
  -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  -# copies of the Software, and to permit persons to whom the Software is
  -# furnished to do so, subject to the following conditions:
  -#
  -# The above copyright notice and this permission notice shall be included in
  -# all copies or substantial portions of the Software.
  -#
  -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  -# THE SOFTWARE.
  -#
  -
  -import random
  -from time import sleep
  -from pymeasure.experiment import Procedure, IntegerParameter, Parameter, FloatParameter
  -import logging
  -log = logging.getLogger(__name__)
  -log.addHandler(logging.NullHandler())
  -
  -class TestProcedure(Procedure):
  -
  -    iterations = IntegerParameter('Loop Iterations', default=100)
  -    delay = FloatParameter('Delay Time', units='s', default=0.2)
  -    seed = Parameter('Random Seed', default='12345')
  -    
  -    DATA_COLUMNS = ['Iteration', 'Random Number']
  -
  -    def startup(self):
  -        log.info("Setting up random number generator")
  -        random.seed(self.seed)
  -
  -    def execute(self):
  -        log.info("Starting to generate numbers")
  -        for i in range(self.iterations):
  -            data = {
  -                'Iteration': i,
  -                'Random Number': random.random()
  -            }
  -            log.debug("Produced numbers: %s" % data)
  -            self.emit('results', data)
  -            self.emit('progress', 100.*i/self.iterations)
  -            sleep(self.delay)
  -            if self.should_stop():
  -                log.warning("Catch stop command in procedure")
  -                break
  -
  -    def shutdown(self):
  -        log.info("Finished")
  \ No newline at end of file
  diff --git a/pymeasure/experiment/config.py b/pymeasure/experiment/config.py
  --- a/pymeasure/experiment/config.py
  +++ b/pymeasure/experiment/config.py
  @@ -46,5 +46,6 @@
   def set_mpl_rcparams(config):
       if 'matplotlib.rcParams' in config._sections.keys():
           import matplotlib
  +        from cycler import cycler
           for key in config._sections['matplotlib.rcParams']:
               matplotlib.rcParams[key] = eval(config._sections['matplotlib.rcParams'][key])
  
verification_info: {"golden_diff": "diff --git a/examples/Notebook Experiments/procedures.py b/examples/Notebook Experiments/procedures.py\ndeleted file mode 100644\n--- a/examples/Notebook Experiments/procedures.py\t\n+++ /dev/null\n@@ -1,60 +0,0 @@\n-#\n-# This file is part of the PyMeasure package.\n-#\n-# Copyright (c) 2013-2016 PyMeasure Developers\n-#\n-# Permission is hereby granted, free of charge, to any person obtaining a copy\n-# of this software and associated documentation files (the \"Software\"), to deal\n-# in the Software without restriction, including without limitation the rights\n-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n-# copies of the Software, and to permit persons to whom the Software is\n-# furnished to do so, subject to the following conditions:\n-#\n-# The above copyright notice and this permission notice shall be included in\n-# all copies or substantial portions of the Software.\n-#\n-# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n-# THE SOFTWARE.\n-#\n-\n-import random\n-from time import sleep\n-from pymeasure.experiment import Procedure, IntegerParameter, Parameter, FloatParameter\n-import logging\n-log = logging.getLogger(__name__)\n-log.addHandler(logging.NullHandler())\n-\n-class TestProcedure(Procedure):\n-\n-    iterations = IntegerParameter('Loop Iterations', default=100)\n-    delay = FloatParameter('Delay Time', units='s', default=0.2)\n-    seed = Parameter('Random Seed', default='12345')\n-    \n-    DATA_COLUMNS = ['Iteration', 'Random Number']\n-\n-    def startup(self):\n-        log.info(\"Setting up random number generator\")\n-        random.seed(self.seed)\n-\n-    def execute(self):\n-        log.info(\"Starting to generate numbers\")\n-        for i in range(self.iterations):\n-            data = {\n-                'Iteration': i,\n-                'Random Number': random.random()\n-            }\n-            log.debug(\"Produced numbers: %s\" % data)\n-            self.emit('results', data)\n-            self.emit('progress', 100.*i/self.iterations)\n-            sleep(self.delay)\n-            if self.should_stop():\n-                log.warning(\"Catch stop command in procedure\")\n-                break\n-\n-    def shutdown(self):\n-        log.info(\"Finished\")\n\\ No newline at end of file\ndiff --git a/pymeasure/experiment/config.py b/pymeasure/experiment/config.py\n--- a/pymeasure/experiment/config.py\n+++ b/pymeasure/experiment/config.py\n@@ -46,5 +46,6 @@\n def set_mpl_rcparams(config):\n     if 'matplotlib.rcParams' in config._sections.keys():\n         import matplotlib\n+        from cycler import cycler\n         for key in config._sections['matplotlib.rcParams']:\n             matplotlib.rcParams[key] = eval(config._sections['matplotlib.rcParams'][key])\n", "issue": "Error in examples/Notebook Experiments/script2.ipynb\nscript.ipynb runs fine but in script2.ipynb I hit the following error at `experiment = Experiment('test', procedure, analyse)`:\r\n\r\n```python\r\n\r\nC:\\ProgramData\\Anaconda3\\lib\\site-packages\\matplotlib\\__init__.py in __setitem__(self, key, val)\r\n    927             raise KeyError(\r\n    928                 '%s is not a valid rc parameter. See rcParams.keys() for a '\r\n--> 929                 'list of valid parameters.' % (key,))\r\n    930 \r\n    931     def __getitem__(self, key):\r\n\r\nKeyError: 'axes.color_cycle is not a valid rc parameter. See rcParams.keys() for a list of valid parameters.'\r\n```\r\n\nError in examples/Notebook Experiments/script2.ipynb\nscript.ipynb runs fine but in script2.ipynb I hit the following error at `experiment = Experiment('test', procedure, analyse)`:\r\n\r\n```python\r\n\r\nC:\\ProgramData\\Anaconda3\\lib\\site-packages\\matplotlib\\__init__.py in __setitem__(self, key, val)\r\n    927             raise KeyError(\r\n    928                 '%s is not a valid rc parameter. See rcParams.keys() for a '\r\n--> 929                 'list of valid parameters.' % (key,))\r\n    930 \r\n    931     def __getitem__(self, key):\r\n\r\nKeyError: 'axes.color_cycle is not a valid rc parameter. See rcParams.keys() for a list of valid parameters.'\r\n```\r\n\n", "before_files": [{"content": "#\n# This file is part of the PyMeasure package.\n#\n# Copyright (c) 2013-2020 PyMeasure Developers\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\nimport configparser\nimport logging\nimport os\n\nlog = logging.getLogger(__name__)\nlog.addHandler(logging.NullHandler())\n\n\ndef set_file(filename):\n    os.environ['CONFIG'] = filename\n\n\ndef get_config(filename='default_config.ini'):\n    if 'CONFIG' in os.environ.keys():\n        filename = os.environ['CONFIG']\n    config = configparser.ConfigParser()\n    config.read(filename)\n    return config\n\n\n# noinspection PyProtectedMember\ndef set_mpl_rcparams(config):\n    if 'matplotlib.rcParams' in config._sections.keys():\n        import matplotlib\n        for key in config._sections['matplotlib.rcParams']:\n            matplotlib.rcParams[key] = eval(config._sections['matplotlib.rcParams'][key])\n", "path": "pymeasure/experiment/config.py"}, {"content": "#\n# This file is part of the PyMeasure package.\n#\n# Copyright (c) 2013-2016 PyMeasure Developers\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\nimport random\nfrom time import sleep\nfrom pymeasure.experiment import Procedure, IntegerParameter, Parameter, FloatParameter\nimport logging\nlog = logging.getLogger(__name__)\nlog.addHandler(logging.NullHandler())\n\nclass TestProcedure(Procedure):\n\n    iterations = IntegerParameter('Loop Iterations', default=100)\n    delay = FloatParameter('Delay Time', units='s', default=0.2)\n    seed = Parameter('Random Seed', default='12345')\n    \n    DATA_COLUMNS = ['Iteration', 'Random Number']\n\n    def startup(self):\n        log.info(\"Setting up random number generator\")\n        random.seed(self.seed)\n\n    def execute(self):\n        log.info(\"Starting to generate numbers\")\n        for i in range(self.iterations):\n            data = {\n                'Iteration': i,\n                'Random Number': random.random()\n            }\n            log.debug(\"Produced numbers: %s\" % data)\n            self.emit('results', data)\n            self.emit('progress', 100.*i/self.iterations)\n            sleep(self.delay)\n            if self.should_stop():\n                log.warning(\"Catch stop command in procedure\")\n                break\n\n    def shutdown(self):\n        log.info(\"Finished\")", "path": "examples/Notebook Experiments/procedures.py"}], "after_files": [{"content": "#\n# This file is part of the PyMeasure package.\n#\n# Copyright (c) 2013-2020 PyMeasure Developers\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\nimport configparser\nimport logging\nimport os\n\nlog = logging.getLogger(__name__)\nlog.addHandler(logging.NullHandler())\n\n\ndef set_file(filename):\n    os.environ['CONFIG'] = filename\n\n\ndef get_config(filename='default_config.ini'):\n    if 'CONFIG' in os.environ.keys():\n        filename = os.environ['CONFIG']\n    config = configparser.ConfigParser()\n    config.read(filename)\n    return config\n\n\n# noinspection PyProtectedMember\ndef set_mpl_rcparams(config):\n    if 'matplotlib.rcParams' in config._sections.keys():\n        import matplotlib\n        from cycler import cycler\n        for key in config._sections['matplotlib.rcParams']:\n            matplotlib.rcParams[key] = eval(config._sections['matplotlib.rcParams'][key])\n", "path": "pymeasure/experiment/config.py"}, {"content": null, "path": "examples/Notebook Experiments/procedures.py"}]}