Repository: microsoft/Qcodes

Issue:
AWG set channel resolution: docstring should reflect allowed values from _chan_resolutions
All three Tektronix AWG devices have their drivers implemented based one AWG70000A driver. AWG5208 is quite different from the other two AWGs as it has 4 markers per channel instead of 2, which is reflected on this line: [_chan_resolutions = {'5208': [12, 13, 14, 15, 16],...](https://github.com/QCoDeS/Qcodes/blob/fe9a68f45cd0a1976e21e1375806ae381113cdbb/qcodes/instrument_drivers/tektronix/AWG70000A.py#L61).

The issue is: the fact about 4 markers instead of 2 is not reflected in the docstring of the `set_resolution` method [see here](https://github.com/QCoDeS/Qcodes/blob/fe9a68f45cd0a1976e21e1375806ae381113cdbb/qcodes/instrument_drivers/tektronix/AWG70000A.py#L289):
```
             docstring=("""
                                      8 bit resolution allows for two
                                      markers, 9 bit resolution
                                      allows for one, and 10 bit
                                      does NOT allow for markers"""))
```

ToDo:
- [x] make dosctring content dependent on the number of channel resolutions
- [x] add a test for the dosctring text 😺 

alternatively, perhaps, you'd propose just to generalize docstring in order not to include this dynamic information that is dependent on the number of channels?
@jenshnielsen @WilliamHPNielsen @sohailc 


Discussion:

Resolving patch:
diff --git a/qcodes/instrument_drivers/tektronix/AWG70000A.py b/qcodes/instrument_drivers/tektronix/AWG70000A.py
--- a/qcodes/instrument_drivers/tektronix/AWG70000A.py
+++ b/qcodes/instrument_drivers/tektronix/AWG70000A.py
@@ -62,6 +62,20 @@ def _parse_string_response(input_str: str) -> str:
                      '70001A': [8, 9, 10],
                      '70002A': [8, 9, 10]}
 
+# channel resolution docstrings
+_chan_resolution_docstrings = {'5208': "12 bit resolution allows for four "
+                                       "markers, 13 bit resolution "
+                                       "allows for three, etc. with 16 bit "
+                                       "allowing for ZERO markers",
+                               '70001A': "8 bit resolution allows for two "
+                                         "markers, 9 bit resolution "
+                                         "allows for one, and 10 bit "
+                                         "does NOT allow for markers ",
+                               '70002A': "8 bit resolution allows for two "
+                                         "markers, 9 bit resolution "
+                                         "allows for one, and 10 bit "
+                                         "does NOT allow for markers "}
+
 # channel amplitudes
 _chan_amps = {'70001A': 0.5,
               '70002A': 0.5,
@@ -286,11 +300,7 @@ def __init__(self,  parent: Instrument, name: str, channel: int) -> None:
                            set_cmd='SOURce{}:DAC:RESolution {{}}'.format(channel),
                            vals=vals.Enum(*_chan_resolutions[self.model]),
                            get_parser=int,
-                           docstring=("""
-                                      8 bit resolution allows for two
-                                      markers, 9 bit resolution
-                                      allows for one, and 10 bit
-                                      does NOT allow for markers"""))
+                           docstring=_chan_resolution_docstrings[self.model])
 
     def _set_marker(self, channel: int, marker: int,
                     high: bool, voltage: float) -> None:


Test patch:
diff --git a/qcodes/tests/drivers/test_tektronix_AWG5208.py b/qcodes/tests/drivers/test_tektronix_AWG5208.py
--- a/qcodes/tests/drivers/test_tektronix_AWG5208.py
+++ b/qcodes/tests/drivers/test_tektronix_AWG5208.py
@@ -1,3 +1,5 @@
+import os
+
 import pytest
 
 from qcodes.instrument_drivers.tektronix.AWG5208 import AWG5208
@@ -20,3 +22,15 @@ def test_init_awg(awg):
     idn_dict = awg.IDN()
 
     assert idn_dict['vendor'] == 'QCoDeS'
+
+
+def test_channel_resolution_docstring(awg):
+
+    expected_docstring = ("12 bit resolution allows for four "
+                          "markers, 13 bit resolution "
+                          "allows for three, etc. with 16 bit "
+                          "allowing for ZERO markers")
+
+    actual_docstring = awg.ch1.resolution.__doc__.split(os.linesep)[0]
+
+    assert actual_docstring == expected_docstring