Skip to content

Commit

Permalink
FF: Remove reference to Riponda stuff in BaseXid class
Browse files Browse the repository at this point in the history
  • Loading branch information
TEParsons committed Oct 2, 2024
1 parent 0842cca commit 9a5eb76
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions psychopy_cedrus/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, pad, channels=1):
self.parent = BaseXidDevice.resolve(pad)
# reference self in parent
self.parent.nodes.append(self)
# # Riponda photodiode should be key 3, but this attribute can be changed if needed
# Xid photodiode should be key 3, but this attribute can be changed if needed
self.keys = [3]
# initialise base class
photodiode.BasePhotodiodeGroup.__init__(self, channels=channels)
Expand All @@ -32,8 +32,8 @@ def isSameDevice(self, other):
Parameters
----------
other : RipondaPhotodiodeGroup, dict
Other RipondaPhotodiodeGroup to compare against, or a dict of params (which must include
other : BaseXidPhotodiodeGroup, dict
Other BaseXidPhotodiodeGroup to compare against, or a dict of params (which must include
`index` as a key)
Returns
Expand All @@ -42,7 +42,7 @@ def isSameDevice(self, other):
True if the two objects represent the same physical device
"""
if isinstance(other, type(self)):
# if given another RipondaPhotodiodeGroup, compare parent boxes
# if given another BaseXidPhotodiodeGroup, compare parent boxes
other = other.parent
elif isinstance(other, dict) and "pad" in other:
# if given a dict, make sure we have a `port` rather than a `pad`
Expand Down Expand Up @@ -84,7 +84,7 @@ def resetTimer(self, clock=logging.defaultClock):

def dispatchMessages(self):
"""
Dispatch messages from parent Riponda to this photodiode group
Dispatch messages from parent BaseXid to this photodiode group
Returns
-------
Expand Down Expand Up @@ -128,8 +128,8 @@ def isSameDevice(self, other):
Parameters
----------
other : RipondaButtonGroup, dict
Other RipondaButtonGroup to compare against, or a dict of params (which must include
other : BaseXidButtonGroup, dict
Other BaseXidButtonGroup to compare against, or a dict of params (which must include
`index` as a key)
Returns
Expand All @@ -138,7 +138,7 @@ def isSameDevice(self, other):
True if the two objects represent the same physical device
"""
if isinstance(other, type(self)):
# if given another RipondaButtonGroup, compare parent boxes
# if given another BaseXidButtonGroup, compare parent boxes
other = other.parent
elif isinstance(other, dict) and "pad" in other:
# if given a dict, make sure we have a `port` rather than a `pad`
Expand All @@ -148,7 +148,7 @@ def isSameDevice(self, other):

def dispatchMessages(self):
"""
Dispatch messages from parent Riponda to this button group
Dispatch messages from parent BaseXid to this button group
Returns
-------
Expand Down Expand Up @@ -198,7 +198,7 @@ def __init__(self, pad=0, channels=1, threshold=None):
self.parent = BaseXidDevice.resolve(pad)
# reference self in parent
self.parent.nodes.append(self)
# Riponda voicekey should be key 2, but this attribute can be changed if needed
# BaseXid voicekey should be key 2, but this attribute can be changed if needed
self.keys = [2]
# initialise base class
voicekey.BaseVoiceKeyGroup.__init__(self, channels=channels, threshold=threshold)
Expand Down Expand Up @@ -235,7 +235,7 @@ def _setThreshold(self, threshold, channel=None):

def isSameDevice(self, other):
if isinstance(other, type(self)):
# if given another RipondaVoiceKeyGroup, compare parent boxes
# if given another BaseXidVoiceKeyGroup, compare parent boxes
other = other.parent
elif isinstance(other, dict) and "pad" in other:
# if given a dict, make sure we have a `port` rather than a `pad`
Expand Down Expand Up @@ -291,7 +291,7 @@ def __init__(
):
# give error if no device connected
if not len(self.getAvailableDevices()):
raise ConnectionError("No Cedrus Riponda response pad is connected.")
raise ConnectionError("No Cedrus device is connected.")
# get xid device
self.index = index
self.xid = pyxid2.get_xid_device(index)
Expand All @@ -306,12 +306,12 @@ def __init__(
@classmethod
def resolve(cls, requested):
"""
Take a value given to a device which has a Riponda as its parent and, from it,
find/make the associated Riponda object.
Take a value given to a device which has a BaseXidDevice as its parent and, from it,
find/make the associated BaseXidDevice object.
Parameters
----------
requested : str, int or Riponda
requested : str, int or BaseXidDevice
Value to resolve
"""
# if requested is already a handle, return as is
Expand All @@ -325,19 +325,19 @@ def resolve(cls, requested):
return pad
# try to get by index
if isinstance(requested, int):
pad = DeviceManager.getDeviceBy("index", requested, deviceClass="psychopy_cedrus.riponda.Riponda")
pad = DeviceManager.getDeviceBy("index", requested, deviceClass="psychopy_cedrus.base.BaseXidDevice")
# if found, return
if pad is not None:
return pad
# if given an index of a not-yet setup device, set one up
if requested is None or isinstance(requested, int):
return DeviceManager.addDevice(
deviceClass="psychopy_cedrus.riponda.Riponda",
deviceName=f"Riponda@{requested}",
deviceClass="psychopy_cedrus.base.BaseXidDevice",
deviceName=f"XidDevice@{requested}",
index=requested
)
# if still not found, raise error
raise ManagedDeviceError(f"Could not find/create any Riponda object from the value {requested}")
raise ManagedDeviceError(f"Could not find/create any BaseXidDevice object from the value {requested}")

def isSameDevice(self, other):
"""
Expand All @@ -346,8 +346,8 @@ def isSameDevice(self, other):
Parameters
----------
other : Riponda, dict
Other Riponda to compare against, or a dict of params (which much include
other : BaseXidDevice, dict
Other BaseXidDevice to compare against, or a dict of params (which much include
`index` as a key)
Returns
Expand Down Expand Up @@ -382,12 +382,12 @@ def getAvailableDevices():

def addListener(self, listener):
"""
Add a listener, which will receive all the messages dispatched by this Riponda.
Add a listener, which will receive all the messages dispatched by this BaseXidDevice.
Parameters
----------
listener : hardware.listener.BaseListener
Object to duplicate messages to when dispatched by this Riponda.
Object to duplicate messages to when dispatched by this BaseXidDevice.
"""
# add listener to all nodes
for node in self.nodes:
Expand Down

0 comments on commit 9a5eb76

Please sign in to comment.