Skip to content

Commit

Permalink
Update formatting and docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
scasagrande committed Sep 22, 2019
1 parent e75c80d commit 402d263
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
10 changes: 5 additions & 5 deletions instruments/abstract_instruments/comm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

from .abstract_comm import AbstractCommunicator

from .file_communicator import FileCommunicator
from .gpib_communicator import GPIBCommunicator
from .loopback_communicator import LoopbackCommunicator
from .serial_communicator import SerialCommunicator
from .socket_communicator import SocketCommunicator
from .usb_communicator import USBCommunicator
from .serial_communicator import SerialCommunicator
from .visa_communicator import VisaCommunicator
from .loopback_communicator import LoopbackCommunicator
from .gpib_communicator import GPIBCommunicator
from .file_communicator import FileCommunicator
from .usbtmc_communicator import USBTMCCommunicator
from .visa_communicator import VisaCommunicator
from .vxi11_communicator import VXI11Communicator
7 changes: 3 additions & 4 deletions instruments/abstract_instruments/comm/gpib_communicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
from __future__ import division
from __future__ import unicode_literals

from enum import Enum
import io
import time

from enum import Enum

from builtins import chr, str, bytes
import quantities as pq

Expand Down Expand Up @@ -326,9 +325,9 @@ def _sendcmd(self, msg):
if msg == '':
return
if self._model == GPIBCommunicator.Model.gi:
self._file.sendcmd('+a:' + str(self._gpib_address))
self._file.sendcmd("+a:{0}".format(str(self._gpib_address)))
else:
self._file.sendcmd('++addr ' + str(self._gpib_address))
self._file.sendcmd("++addr {0}".format(str(self._gpib_address)))
time.sleep(sleep_time)
self.eoi = self.eoi
time.sleep(sleep_time)
Expand Down
18 changes: 14 additions & 4 deletions instruments/abstract_instruments/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ def open_gpibusb(cls, port, gpib_address, timeout=3, write_timeout=3, model="gi"
instrument before timing out.
:param float write_timeout: Number of seconds to wait when writing to the
instrument before timing out.
:param str model: The brand of adapter to be connected to. Currently supported
is "gi" for Galvant Industries, and "pl" for Prologix LLC.
:rtype: `Instrument`
:return: Object representing the connected instrument.
Expand All @@ -562,11 +564,19 @@ def open_gpibusb(cls, port, gpib_address, timeout=3, write_timeout=3, model="gi"
return cls(GPIBCommunicator(ser, gpib_address, model))

@classmethod
def open_gpibethernet(cls, host, port, gpib_address, model="gi"):
def open_gpibethernet(cls, host, port, gpib_address, model="pl"):
"""
.. warning:: The GPIB-Ethernet adapter that this connection would
use does not actually exist, and thus this class method should
not be used.
Opens an instrument, connecting via a Prologix GPIBETHERNET adapter.
:param str host: Name or IP address of the instrument.
:param int port: TCP port on which the insturment is listening.
:param int gpib_address: Address on the connected GPIB bus assigned to
the instrument.
:param str model: The brand of adapter to be connected to. Currently supported
is "gi" for Galvant Industries, and "pl" for Prologix LLC.
.. warning:: This function has been setup for use with the Prologix
GPIBETHERNET adapter but has not been tested as confirmed working.
"""
conn = socket.socket()
conn.connect((host, port))
Expand Down

0 comments on commit 402d263

Please sign in to comment.