/iohub_docs/iohub/api_and_manual/devices.rst

https://github.com/jeremygray/psychopy · ReStructuredText · 96 lines · 74 code · 22 blank · 0 comment · 0 complexity · 638d24b9b53e2db6fd7b669ed8afcad6 MD5 · raw file

  1. ###################################
  2. ioHub Device and Device Event API
  3. ###################################
  4. Devices and DeviceEvents refer to the classes associated with monitoring both physical and
  5. virtual devices, and bundling these data for use by the ioHub Process for storage in the
  6. ioDataStore and/or by the PsychoPy process for event handling in the experiment script.
  7. The device and device event API has been designed to try and provide a consistent
  8. interface across different device and event types, only breaking from this common
  9. framework when required.
  10. Two abstract classes (i.e. you never get a instance of one of the classes directly)
  11. construct the basis for all Device and DeviceEvent classes used within
  12. the ioHub.
  13. In general, attributes of a class are named using '_' format (e.g., eventclass.device_time),
  14. while method names of a class use camel case format (i.e. deviceclass.getEvents() ).
  15. I find these notations make it very easy to distinguish attributes from methods or functions when scanning
  16. a code completion list for a class in your IDE of choice for example.
  17. If device events are being saved to the ioDataStore, the hdf5 table for a given event class
  18. contains columns with the same names as the attributes of the event object that is
  19. stored in the table. This makes it somewhat easier to remember both event object
  20. attributes and event data storage tables formats.
  21. .. note:: A user script never creates an instance of a Device or DeviceEvent class.
  22. The ioHub Event Framework creates all Device and DeviceEvent representations for
  23. PsychoPy Process as needed.
  24. .. note:: Technically, the Device and DeviceEvent classes documented here are used by
  25. the ioHub Process only. The PsychoPy Process accesses the Device class instances
  26. via a dynamically created PsychoPy Process side class called
  27. an ioHubDeviceView. However, the ioHubDeviceView instance created on the
  28. PsychoPy Process associated with an actual ioHub Process Device instance
  29. has an identical public interface that is used by the PsychoPy script.
  30. Therefore, providing documentation for the ioHub Process Devices and DeviceEvents
  31. is also providing the API specification that can be used by the PsychoPy Process
  32. ( and it is much easier to document classes that exist for a period longer than
  33. just when the PsychoPy process runs.) :)
  34. The Root Device and DeviceEvent Classes
  35. #########################################
  36. All device and event types supported by the ioHub are extensions of two abstract
  37. class definitions.
  38. ioHub Device Class
  39. ===============================
  40. The parent class of all supported ioHub Device types.
  41. .. autoclass:: psychopy.iohub.devices.Device
  42. :exclude-members: ALL_EVENT_CLASSES, CLASS_ATTRIBUTE_NAMES, DEVICE_BUFFER_LENGTH_INDEX, DEVICE_CLASS_NAME_INDEX, DEVICE_MAX_ATTRIBUTE_INDEX, DEVICE_TIMEBASE_TO_SEC, DEVICE_TYPE_ID, DEVICE_TYPE_ID_INDEX, DEVICE_TYPE_STRING, DEVICE_USER_LABEL_INDEX, NUMPY_DTYPE, e, DEVICE_FIRMWARE_VERSION_INDEX, DEVICE_HARDWARE_VERSION_INDEX,DEVICE_MANUFACTURER_NAME_INDEX,DEVICE_MODEL_NAME_INDEX, DEVICE_MODEL_NUMBER_INDEX, DEVICE_NUMBER_INDEX, DEVICE_SERIAL_NUMBER_INDEX, DEVICE_SOFTWARE_VERSION_INDEX, EVENT_CLASS_NAMES
  43. :member-order: bysource
  44. ioHub DeviceEvent Class
  45. ==========================
  46. The parent class of all ioHub DeviceEvents, regardless of the device type has
  47. generated the event.
  48. .. autoclass:: psychopy.iohub.devices.DeviceEvent
  49. :exclude-members: filter_id, device_id, NUMPY_DTYPE, DEVICE_ID_INDEX, BASE_EVENT_MAX_ATTRIBUTE_INDEX, CLASS_ATTRIBUTE_NAMES, EVENT_CONFIDENCE_INTERVAL_INDEX, EVENT_DELAY_INDEX, EVENT_DEVICE_TIME_INDEX, EVENT_EXPERIMENT_ID_INDEX, EVENT_FILTER_ID_INDEX, EVENT_HUB_TIME_INDEX, EVENT_ID_INDEX, EVENT_LOGGED_TIME_INDEX, EVENT_SESSION_ID_INDEX, EVENT_TYPE_ID, EVENT_TYPE_ID_INDEX, EVENT_TYPE_STRING, IOHUB_DATA_TABLE, PARENT_DEVICE, createEventAsClass, createEventAsDict, createEventAsNamedTuple, e, namedTupleClass
  50. :member-order: bysource
  51. Device Type Constants
  52. #########################
  53. .. autoclass:: psychopy.iohub.constants.DeviceConstants
  54. :member-order: bysource
  55. Device Event Type Constants
  56. ############################
  57. .. autoclass:: psychopy.iohub.constants.EventConstants
  58. :member-order: bysource
  59. Available ioHub Device and DeviceEvent Types
  60. ##############################################
  61. Details on each supported ioHub Device, and associated DeviceEvent types, can be
  62. found in the following sections.
  63. .. toctree::
  64. :maxdepth: 3
  65. Analog to Digitial Input <device_details/daq>
  66. Computer <device_details/computer>
  67. Display <device_details/display>
  68. EventPublisher and RemoteEventSubscriber <device_details/event_pub_sub>
  69. Experiment <device_details/experiment>
  70. Eye Tracker <device_details/eyetracker>
  71. Keyboard <device_details/keyboard>
  72. Mouse <device_details/mouse>
  73. Touch Screen <device_details/touch>
  74. XInput Gamepad <device_details/xinput_gamepad>