Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 49 additions & 31 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions hardwarelibrary/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__version__ = "1.0.5"
__author__ = "Daniel Cote <dccote@cervo.ulaval.ca>"

__all__ = ["communication","motion","oscilloscope","powermeters","spectrometers"]
__all__ = ["communication", "motion", "oscilloscope", "powermeters", "spectrometers"]

# We want the modules at the top level
from .devicemanager import *
Expand All @@ -14,6 +14,6 @@
import hardwarelibrary.spectrometers
import hardwarelibrary.oscilloscope
import hardwarelibrary.motion
# import hardwarelibrary.cameras

#import sources #TODO: Not much to see here yet
# import hardwarelibrary.cameras #TODO: Not much to see here yet
# import hardwarelibrary.sources #TODO: Not much to see here yet
4 changes: 2 additions & 2 deletions hardwarelibrary/daq/labjackdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
class LabjackDevice(PhysicalDevice, AnalogIOProtocol, DigitalIOProtocol):
classIdVendor = 0x0cd5
classIdProduct = 0x003
def __init__(self, serialNumber="*"):
super().__init__(serialNumber, idProduct=0x003, idVendor=0x0cd5)
def __init__(self, serialNumber="*", idProduct=0x003, idVendor=0x0cd5):
super().__init__(serialNumber, idProduct=idProduct, idVendor=idVendor)
self.dev = None

def doInitializeDevice(self):
Expand Down
2 changes: 1 addition & 1 deletion hardwarelibrary/devicemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def usbDeviceConnected(self, usbDevice):
# This may throw if incompat:
# deviceInstanceible
try:
candidateClass(serialNumber=descriptor.serialNumber,
deviceInstance = candidateClass(serialNumber=descriptor.serialNumber,
idProduct=descriptor.idProduct,
idVendor=descriptor.idVendor)
deviceInstance.initializeDevice()
Expand Down
6 changes: 6 additions & 0 deletions hardwarelibrary/spectrometers/oceaninsight.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,12 @@ class USB2000Plus(USB4000_2000Plus):
def __init__(self, serialNumber=None, idProduct:int = None, idVendor:int = None):
USB4000_2000Plus.__init__(self, serialNumber=serialNumber, idProduct=idProduct, idVendor=idVendor, model="USB2000+")

class SAS(USB4000_2000Plus):
classIdProduct = 0x1006

def __init__(self, serialNumber=None, idProduct:int = None, idVendor:int = None):
USB4000_2000Plus.__init__(self, serialNumber=serialNumber, idProduct=idProduct, idVendor=idVendor)


class DebugSpectro:
class Emitter(NamedTuple):
Expand Down
9 changes: 6 additions & 3 deletions hardwarelibrary/tests/testIntegraDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ class TestIntegraDevice(unittest.TestCase):
def setUp(self):
self.device = IntegraDevice()
self.assertIsNotNone(self.device)
self.device.initializeDevice()
try:
self.device.initializeDevice()
except Exception as err:
self.skipTest("No IntegraDevice connected")

def tearDown(self):
self.device.shutdownDevice()
Expand All @@ -39,8 +42,8 @@ def setUp(self):
self.port = USBPort(idVendor=0x1ad5, idProduct=0x0300, interfaceNumber=0, defaultEndPoints=(1,2))
try:
self.port.open()
except:
raise (unittest.SkipTest("No devices connected"))
except Exception as err:
self.skipTest("No IntegraDevice connected")

def tearDown(self):
self.port.close()
Expand Down
2 changes: 1 addition & 1 deletion hardwarelibrary/tests/testIntellidrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def setUp(self):
self.portPath = None
ports = serial.tools.list_ports.comports()
for port in ports:
if port.vid == 0x0403 and port.pid == 0x6001: # Sutter Instruments
if port.vid == 0x0403 and port.pid == 0x6001:
self.portPath = "/dev/cu.usbserial-{0}".format(serialNumber)

if self.portPath is None:
Expand Down
9 changes: 6 additions & 3 deletions hardwarelibrary/tests/testLabjackU3.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
class TestLabjackDevice(unittest.TestCase):
def setUp(self):
super().setUp()
self.device = LabjackDevice()
self.assertIsNotNone(self.device)
self.device.initializeDevice()
try:
self.device = LabjackDevice()
self.assertIsNotNone(self.device)
self.device.initializeDevice()
except Exception as err:
self.skipTest("No Labjack connected")

def tearDown(self):
super().tearDown()
Expand Down
8 changes: 7 additions & 1 deletion hardwarelibrary/tests/testLinearMotionDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,14 @@ def setUp(self):

class TestRealSutterDeviceBase(BaseTestCases.TestLinearMotionDevice):
def setUp(self):
self.device = SutterDevice()

try:
self.device = SutterDevice()
except Exception as err:
self.skipTest("No Sutter device connected")

super().setUp()


if __name__ == '__main__':
unittest.main()
Loading