Skip to content

Commit

Permalink
Adjusted documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
BenediktBurger committed Aug 2, 2022
1 parent 79124e4 commit 4ff616e
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions docs/dev/adding_instruments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ This is a minimal instrument definition:
""" Represents the imaginary Extreme 5000 instrument.
"""

def __init__(self, resourceName, **kwargs):
def __init__(self, resourceName, name="Extreme 5000", **kwargs):
super().__init__(
resourceName,
"Extreme 5000",
name,
**kwargs
)
Expand All @@ -126,10 +126,10 @@ The simplest version, suitable when the instrument connection needs default sett

.. code-block:: python
def __init__(self, resourceName, **kwargs):
def __init__(self, resourceName, name="Extreme 5000", **kwargs):
super().__init__(
resourceName,
"Extreme 5000",
name,
**kwargs
)
Expand All @@ -138,10 +138,10 @@ This is suitable when the instrument has one type of interface, or any defaults

.. code-block:: python
def __init__(self, resourceName, baud_rate=2400, **kwargs):
def __init__(self, resourceName, name="Extreme 5000", baud_rate=2400, **kwargs):
super().__init__(
resourceName,
"Extreme 5000",
name,
baud_rate=baud_rate,
**kwargs
)
Expand All @@ -150,11 +150,11 @@ If you want to set defaults, but they don't need to be prominently exposed for r

.. code-block:: python
def __init__(self, resourceName, **kwargs):
def __init__(self, resourceName, name="Extreme 5000", **kwargs):
kwargs.setdefault('timeout', 1500)
super().__init__(
resourceName,
"Extreme 5000",
name,
**kwargs
)
Expand All @@ -169,11 +169,11 @@ These then contain a *dictionary* with the settings specific to the respective i

.. code-block:: python
def __init__(self, resourceName, baud_rate=2400, **kwargs):
def __init__(self, resourceName, name="Extreme 5000", baud_rate=2400, **kwargs):
kwargs.setdefault('timeout', 1500)
super().__init__(
resourceName,
"Extreme 5000",
name,
gpib=dict(enable_repeat_addressing=False,
read_termination='\r'),
asrl={'baud_rate': baud_rate,
Expand All @@ -196,15 +196,15 @@ If, however, you are unable to use the :py:class:`~pymeasure.adapters.VISAAdapte

.. code-block:: python
def __init__(self, resourceName, baud_rate=2400, **kwargs):
def __init__(self, resourceName, name="Extreme 5000", baud_rate=2400, **kwargs):
kwargs.setdefault('timeout', 0.5)
kwargs.setdefault('xonxoff', True)
adapter = SerialAdapter(resourceName,
baudrate=baud_rate, # different arg name!
**kwargs)
super().__init__(
adapter,
"Extreme 5000",
name,
)
Follow the user interface patterns presented above as closely as feasible (the code example shows how) so there is the least surprise for users used to other instruments.
Expand Down Expand Up @@ -576,10 +576,10 @@ The real purpose of `preprocess_reply` is, however, for instruments where many/a
"""
)
def __init__(self, resourceName, **kwargs):
def __init__(self, resourceName, name="Extreme 5000", **kwargs):
super().__init__(
resourceName,
"Extreme 5000",
name,
preprocess_reply=extract_value,
**kwargs,
)
Expand Down

0 comments on commit 4ff616e

Please sign in to comment.