prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  PR #70 breaks parameter .get and .set functionality
  I cannot debug the issue properly because all the objects are `multiprocessing` objects. A minimal example showing the issue:
  
  ``` python
  %matplotlib nbagg
  import matplotlib.pyplot as plt
  import time
  import numpy as np
  import qcodes as qc
  
  from toymodel import AModel, MockGates, MockSource, MockMeter, AverageGetter, AverageAndRaw
  
  # now create this "experiment"
  model = AModel()
  gates = MockGates('gates', model=model)
  
  c0, c1, c2 = gates.chan0, gates.chan1, gates.chan2
  print('fine so far...')
  
  print('error...')
  c2.get()
  print('no effect?')
  c2.set(0.5)
  
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `docs/examples/toymodel.py`
  Content:
  ```
  1 # code for example notebook
  2 
  3 import math
  4 
  5 from qcodes import MockInstrument, MockModel, Parameter, Loop, DataArray
  6 from qcodes.utils.validators import Numbers
  7 
  8 
  9 class AModel(MockModel):
  10     def __init__(self):
  11         self._gates = [0.0, 0.0, 0.0]
  12         self._excitation = 0.1
  13         super().__init__()
  14 
  15     def _output(self):
  16         # my super exciting model!
  17         # make a nice pattern that looks sort of double-dotty
  18         # with the first two gates controlling the two dots,
  19         # and the third looking like Vsd
  20         delta_i = 10
  21         delta_j = 10
  22         di = (self._gates[0] + delta_i / 2) % delta_i - delta_i / 2
  23         dj = (self._gates[1] + delta_j / 2) % delta_j - delta_j / 2
  24         vsd = math.sqrt(self._gates[2]**2 + self._excitation**2)
  25         dij = math.sqrt(di**2 + dj**2) - vsd
  26         g = (vsd**2 + 1) * (1 / (dij**2 + 1) +
  27                             0.1 * (math.atan(-dij) + math.pi / 2))
  28         return g
  29 
  30     def fmt(self, value):
  31         return '{:.3f}'.format(value)
  32 
  33     def gates_set(self, parameter, value):
  34         if parameter[0] == 'c':
  35             self._gates[int(parameter[1:])] = float(value)
  36         elif parameter == 'rst' and value is None:
  37             self._gates = [0.0, 0.0, 0.0]
  38         else:
  39             raise ValueError
  40 
  41     def gates_get(self, parameter):
  42         if parameter[0] == 'c':
  43             return self.fmt(self.gates[int(parameter[1:])])
  44         else:
  45             raise ValueError
  46 
  47     def source_set(self, parameter, value):
  48         if parameter == 'ampl':
  49             self._excitation = float(value)
  50         else:
  51             raise ValueError
  52 
  53     def source_get(self, parameter):
  54         if parameter == 'ampl':
  55             return self.fmt(self._excitation)
  56         else:
  57             raise ValueError
  58 
  59     def meter_get(self, parameter):
  60         if parameter == 'ampl':
  61             return self.fmt(self._output() * self._excitation)
  62         else:
  63             raise ValueError
  64 
  65 
  66 # make our mock instruments
  67 # real instruments would subclass IPInstrument or VisaInstrument
  68 # or just the base Instrument instead of MockInstrument,
  69 # and be instantiated with an address rather than a model
  70 class MockGates(MockInstrument):
  71     def __init__(self, name, model=None, **kwargs):
  72         super().__init__(name, model=model, **kwargs)
  73 
  74         for i in range(3):
  75             cmdbase = 'c{}'.format(i)
  76             self.add_parameter('chan{}'.format(i),
  77                                label='Gate Channel {} (mV)'.format(i),
  78                                get_cmd=cmdbase + '?',
  79                                set_cmd=cmdbase + ':{:.4f}',
  80                                get_parser=float,
  81                                vals=Numbers(-100, 100))
  82 
  83         self.add_function('reset', call_cmd='rst')
  84 
  85 
  86 class MockSource(MockInstrument):
  87     def __init__(self, name, model=None, **kwargs):
  88         super().__init__(name, model=model, **kwargs)
  89 
  90         # this parameter uses built-in sweeping to change slowly
  91         self.add_parameter('amplitude',
  92                            label='Source Amplitude (\u03bcV)',
  93                            get_cmd='ampl?',
  94                            set_cmd='ampl:{:.4f}',
  95                            get_parser=float,
  96                            vals=Numbers(0, 10),
  97                            sweep_step=0.1,
  98                            sweep_delay=0.05)
  99 
  100 
  101 class MockMeter(MockInstrument):
  102     def __init__(self, name, model=None, **kwargs):
  103         super().__init__(name, model=model, **kwargs)
  104 
  105         self.add_parameter('amplitude',
  106                            label='Current (nA)',
  107                            get_cmd='ampl?',
  108                            get_parser=float)
  109 
  110 
  111 class AverageGetter(Parameter):
  112     def __init__(self, measured_param, sweep_values, delay):
  113         super().__init__(name='avg_' + measured_param.name)
  114         self.measured_param = measured_param
  115         self.sweep_values = sweep_values
  116         self.delay = delay
  117         if hasattr(measured_param, 'label'):
  118             self.label = 'Average: ' + measured_param.label
  119 
  120     def get(self):
  121         loop = Loop(self.sweep_values, self.delay).each(self.measured_param)
  122         data = loop.run_temp()
  123         return data.arrays[self.measured_param.name].mean()
  124 
  125 
  126 class AverageAndRaw(Parameter):
  127     def __init__(self, measured_param, sweep_values, delay):
  128         name = measured_param.name
  129         super().__init__(names=(name, 'avg_' + name))
  130         self.measured_param = measured_param
  131         self.sweep_values = sweep_values
  132         self.delay = delay
  133         self.sizes = (len(sweep_values), None)
  134         set_array = DataArray(parameter=sweep_values.parameter,
  135                               preset_data=sweep_values)
  136         self.setpoints = (set_array, None)
  137         if hasattr(measured_param, 'label'):
  138             self.labels = (measured_param.label,
  139                            'Average: ' + measured_param.label)
  140 
  141     def get(self):
  142         loop = Loop(self.sweep_values, self.delay).each(self.measured_param)
  143         data = loop.run_temp()
  144         array = data.arrays[self.measured_param.name]
  145         return (array, array.mean())
  146
  ```
  --- 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/docs/examples/toymodel.py b/docs/examples/toymodel.py
  --- a/docs/examples/toymodel.py
  +++ b/docs/examples/toymodel.py
  @@ -40,7 +40,7 @@
   
       def gates_get(self, parameter):
           if parameter[0] == 'c':
  -            return self.fmt(self.gates[int(parameter[1:])])
  +            return self.fmt(self._gates[int(parameter[1:])])
           else:
               raise ValueError
  
verification_info: {"golden_diff": "diff --git a/docs/examples/toymodel.py b/docs/examples/toymodel.py\n--- a/docs/examples/toymodel.py\n+++ b/docs/examples/toymodel.py\n@@ -40,7 +40,7 @@\n \n     def gates_get(self, parameter):\n         if parameter[0] == 'c':\n-            return self.fmt(self.gates[int(parameter[1:])])\n+            return self.fmt(self._gates[int(parameter[1:])])\n         else:\n             raise ValueError\n", "issue": "PR #70 breaks parameter .get and .set functionality\nI cannot debug the issue properly because all the objects are `multiprocessing` objects. A minimal example showing the issue:\n\n``` python\n%matplotlib nbagg\nimport matplotlib.pyplot as plt\nimport time\nimport numpy as np\nimport qcodes as qc\n\nfrom toymodel import AModel, MockGates, MockSource, MockMeter, AverageGetter, AverageAndRaw\n\n# now create this \"experiment\"\nmodel = AModel()\ngates = MockGates('gates', model=model)\n\nc0, c1, c2 = gates.chan0, gates.chan1, gates.chan2\nprint('fine so far...')\n\nprint('error...')\nc2.get()\nprint('no effect?')\nc2.set(0.5)\n\n```\n\n", "before_files": [{"content": "# code for example notebook\n\nimport math\n\nfrom qcodes import MockInstrument, MockModel, Parameter, Loop, DataArray\nfrom qcodes.utils.validators import Numbers\n\n\nclass AModel(MockModel):\n    def __init__(self):\n        self._gates = [0.0, 0.0, 0.0]\n        self._excitation = 0.1\n        super().__init__()\n\n    def _output(self):\n        # my super exciting model!\n        # make a nice pattern that looks sort of double-dotty\n        # with the first two gates controlling the two dots,\n        # and the third looking like Vsd\n        delta_i = 10\n        delta_j = 10\n        di = (self._gates[0] + delta_i / 2) % delta_i - delta_i / 2\n        dj = (self._gates[1] + delta_j / 2) % delta_j - delta_j / 2\n        vsd = math.sqrt(self._gates[2]**2 + self._excitation**2)\n        dij = math.sqrt(di**2 + dj**2) - vsd\n        g = (vsd**2 + 1) * (1 / (dij**2 + 1) +\n                            0.1 * (math.atan(-dij) + math.pi / 2))\n        return g\n\n    def fmt(self, value):\n        return '{:.3f}'.format(value)\n\n    def gates_set(self, parameter, value):\n        if parameter[0] == 'c':\n            self._gates[int(parameter[1:])] = float(value)\n        elif parameter == 'rst' and value is None:\n            self._gates = [0.0, 0.0, 0.0]\n        else:\n            raise ValueError\n\n    def gates_get(self, parameter):\n        if parameter[0] == 'c':\n            return self.fmt(self.gates[int(parameter[1:])])\n        else:\n            raise ValueError\n\n    def source_set(self, parameter, value):\n        if parameter == 'ampl':\n            self._excitation = float(value)\n        else:\n            raise ValueError\n\n    def source_get(self, parameter):\n        if parameter == 'ampl':\n            return self.fmt(self._excitation)\n        else:\n            raise ValueError\n\n    def meter_get(self, parameter):\n        if parameter == 'ampl':\n            return self.fmt(self._output() * self._excitation)\n        else:\n            raise ValueError\n\n\n# make our mock instruments\n# real instruments would subclass IPInstrument or VisaInstrument\n# or just the base Instrument instead of MockInstrument,\n# and be instantiated with an address rather than a model\nclass MockGates(MockInstrument):\n    def __init__(self, name, model=None, **kwargs):\n        super().__init__(name, model=model, **kwargs)\n\n        for i in range(3):\n            cmdbase = 'c{}'.format(i)\n            self.add_parameter('chan{}'.format(i),\n                               label='Gate Channel {} (mV)'.format(i),\n                               get_cmd=cmdbase + '?',\n                               set_cmd=cmdbase + ':{:.4f}',\n                               get_parser=float,\n                               vals=Numbers(-100, 100))\n\n        self.add_function('reset', call_cmd='rst')\n\n\nclass MockSource(MockInstrument):\n    def __init__(self, name, model=None, **kwargs):\n        super().__init__(name, model=model, **kwargs)\n\n        # this parameter uses built-in sweeping to change slowly\n        self.add_parameter('amplitude',\n                           label='Source Amplitude (\\u03bcV)',\n                           get_cmd='ampl?',\n                           set_cmd='ampl:{:.4f}',\n                           get_parser=float,\n                           vals=Numbers(0, 10),\n                           sweep_step=0.1,\n                           sweep_delay=0.05)\n\n\nclass MockMeter(MockInstrument):\n    def __init__(self, name, model=None, **kwargs):\n        super().__init__(name, model=model, **kwargs)\n\n        self.add_parameter('amplitude',\n                           label='Current (nA)',\n                           get_cmd='ampl?',\n                           get_parser=float)\n\n\nclass AverageGetter(Parameter):\n    def __init__(self, measured_param, sweep_values, delay):\n        super().__init__(name='avg_' + measured_param.name)\n        self.measured_param = measured_param\n        self.sweep_values = sweep_values\n        self.delay = delay\n        if hasattr(measured_param, 'label'):\n            self.label = 'Average: ' + measured_param.label\n\n    def get(self):\n        loop = Loop(self.sweep_values, self.delay).each(self.measured_param)\n        data = loop.run_temp()\n        return data.arrays[self.measured_param.name].mean()\n\n\nclass AverageAndRaw(Parameter):\n    def __init__(self, measured_param, sweep_values, delay):\n        name = measured_param.name\n        super().__init__(names=(name, 'avg_' + name))\n        self.measured_param = measured_param\n        self.sweep_values = sweep_values\n        self.delay = delay\n        self.sizes = (len(sweep_values), None)\n        set_array = DataArray(parameter=sweep_values.parameter,\n                              preset_data=sweep_values)\n        self.setpoints = (set_array, None)\n        if hasattr(measured_param, 'label'):\n            self.labels = (measured_param.label,\n                           'Average: ' + measured_param.label)\n\n    def get(self):\n        loop = Loop(self.sweep_values, self.delay).each(self.measured_param)\n        data = loop.run_temp()\n        array = data.arrays[self.measured_param.name]\n        return (array, array.mean())\n", "path": "docs/examples/toymodel.py"}], "after_files": [{"content": "# code for example notebook\n\nimport math\n\nfrom qcodes import MockInstrument, MockModel, Parameter, Loop, DataArray\nfrom qcodes.utils.validators import Numbers\n\n\nclass AModel(MockModel):\n    def __init__(self):\n        self._gates = [0.0, 0.0, 0.0]\n        self._excitation = 0.1\n        super().__init__()\n\n    def _output(self):\n        # my super exciting model!\n        # make a nice pattern that looks sort of double-dotty\n        # with the first two gates controlling the two dots,\n        # and the third looking like Vsd\n        delta_i = 10\n        delta_j = 10\n        di = (self._gates[0] + delta_i / 2) % delta_i - delta_i / 2\n        dj = (self._gates[1] + delta_j / 2) % delta_j - delta_j / 2\n        vsd = math.sqrt(self._gates[2]**2 + self._excitation**2)\n        dij = math.sqrt(di**2 + dj**2) - vsd\n        g = (vsd**2 + 1) * (1 / (dij**2 + 1) +\n                            0.1 * (math.atan(-dij) + math.pi / 2))\n        return g\n\n    def fmt(self, value):\n        return '{:.3f}'.format(value)\n\n    def gates_set(self, parameter, value):\n        if parameter[0] == 'c':\n            self._gates[int(parameter[1:])] = float(value)\n        elif parameter == 'rst' and value is None:\n            self._gates = [0.0, 0.0, 0.0]\n        else:\n            raise ValueError\n\n    def gates_get(self, parameter):\n        if parameter[0] == 'c':\n            return self.fmt(self._gates[int(parameter[1:])])\n        else:\n            raise ValueError\n\n    def source_set(self, parameter, value):\n        if parameter == 'ampl':\n            self._excitation = float(value)\n        else:\n            raise ValueError\n\n    def source_get(self, parameter):\n        if parameter == 'ampl':\n            return self.fmt(self._excitation)\n        else:\n            raise ValueError\n\n    def meter_get(self, parameter):\n        if parameter == 'ampl':\n            return self.fmt(self._output() * self._excitation)\n        else:\n            raise ValueError\n\n\n# make our mock instruments\n# real instruments would subclass IPInstrument or VisaInstrument\n# or just the base Instrument instead of MockInstrument,\n# and be instantiated with an address rather than a model\nclass MockGates(MockInstrument):\n    def __init__(self, name, model=None, **kwargs):\n        super().__init__(name, model=model, **kwargs)\n\n        for i in range(3):\n            cmdbase = 'c{}'.format(i)\n            self.add_parameter('chan{}'.format(i),\n                               label='Gate Channel {} (mV)'.format(i),\n                               get_cmd=cmdbase + '?',\n                               set_cmd=cmdbase + ':{:.4f}',\n                               get_parser=float,\n                               vals=Numbers(-100, 100))\n\n        self.add_function('reset', call_cmd='rst')\n\n\nclass MockSource(MockInstrument):\n    def __init__(self, name, model=None, **kwargs):\n        super().__init__(name, model=model, **kwargs)\n\n        # this parameter uses built-in sweeping to change slowly\n        self.add_parameter('amplitude',\n                           label='Source Amplitude (\\u03bcV)',\n                           get_cmd='ampl?',\n                           set_cmd='ampl:{:.4f}',\n                           get_parser=float,\n                           vals=Numbers(0, 10),\n                           sweep_step=0.1,\n                           sweep_delay=0.05)\n\n\nclass MockMeter(MockInstrument):\n    def __init__(self, name, model=None, **kwargs):\n        super().__init__(name, model=model, **kwargs)\n\n        self.add_parameter('amplitude',\n                           label='Current (nA)',\n                           get_cmd='ampl?',\n                           get_parser=float)\n\n\nclass AverageGetter(Parameter):\n    def __init__(self, measured_param, sweep_values, delay):\n        super().__init__(name='avg_' + measured_param.name)\n        self.measured_param = measured_param\n        self.sweep_values = sweep_values\n        self.delay = delay\n        if hasattr(measured_param, 'label'):\n            self.label = 'Average: ' + measured_param.label\n\n    def get(self):\n        loop = Loop(self.sweep_values, self.delay).each(self.measured_param)\n        data = loop.run_temp()\n        return data.arrays[self.measured_param.name].mean()\n\n\nclass AverageAndRaw(Parameter):\n    def __init__(self, measured_param, sweep_values, delay):\n        name = measured_param.name\n        super().__init__(names=(name, 'avg_' + name))\n        self.measured_param = measured_param\n        self.sweep_values = sweep_values\n        self.delay = delay\n        self.sizes = (len(sweep_values), None)\n        set_array = DataArray(parameter=sweep_values.parameter,\n                              preset_data=sweep_values)\n        self.setpoints = (set_array, None)\n        if hasattr(measured_param, 'label'):\n            self.labels = (measured_param.label,\n                           'Average: ' + measured_param.label)\n\n    def get(self):\n        loop = Loop(self.sweep_values, self.delay).each(self.measured_param)\n        data = loop.run_temp()\n        array = data.arrays[self.measured_param.name]\n        return (array, array.mean())\n", "path": "docs/examples/toymodel.py"}]}