与Cedrus Xid设备接口的Python库,例如StimTracker、RB-X40、C-POD和Lumina。

pyxid2的Python项目详细描述


用于与所有cedrus xid设备通信的python库:stimtracker、rb-x40响应板、c-pod、lumina和sv-1。

xid(实验接口设备)设备与superlab、presentation和e-prime等软件一起用于接收输入,作为刺激/反应测试实验的一部分。

这将处理python项目中xid设备的所有低级设备处理。使用此库的开发人员必须轮询连接的设备以获取响应。 下面是一个如何发送TTL信号的示例:

import pyxid
import time

# get a list of all attached XID devices
devices = pyxid.get_xid_devices()

dev = devices[0] # get the first device to use
print(dev)
dev.reset_base_timer()
dev.reset_rt_timer()

if dev.is_response_device():
    while not dev.has_response():
        dev.poll_for_response()

    response = dev.get_next_response()
    print(response)
    dev.clear_response_queue()

dev.set_pulse_duration(300)

sleep_flash = .3
for bm in range(0, 16):
    mask = 2 ** bm
    print("activate_line bitmask: ", mask)
    #dev.activate_line(lines=[1,3,5,7,9,11,13,15])
    dev.activate_line(bitmask=mask)

    time.sleep(sleep_flash)

响应是一个python dict,具有以下键:

pressed: True if the key was pressed, False if it was released
key: Response pad key pressed by the subject
port: Device port the response was from (typically 0)
time: value of the Response Time timer when the key was hit/released

通过库发送ttl脉冲信号可以通过以下方法完成:

set_pulse_duration()
activate_line()
clear_line()

有关如何使用它的文档,请参见activate_line()的docstring。

计时器

每个xid设备都有一个内部计时器。这个计时器可以通过USB命令重置,或者在光线传感器或音频开始时自动重置。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java类。getConstructor找不到兼容的构造函数   java单元测试自定义输入和输出格式   javascript Java UI线程内存不足错误被阻止   多线程在Java并发API中从线程池中选择线程的逻辑是什么?   java在MySQL数据库上存储歌曲(BLOb支持)   java快速且可扩展的IO传递   jsf c:forEach-inside-primeface(例如p:panelgrid)inside-ui:repeat   tomcat与JavaServlet3.0文件上传,如何获取maxfilesize值   java JNI,加载2次相同的dll(不同的名称),如何选择使用哪一个?   java将InputStream复制到OutputStream将停止,除非我也向系统写入。出来   java Set反向安全约束   比如在java中使用整数时?   java使用@接口抑制IntelliJ中的某些警告   java我的ASCII艺术在JLabel上是错误的   JavaSpring工具源代码(或带有SpringIde的Eclipse)崩溃   向片段添加ListView时出现java错误   循环Java循环错误需要重新审视   JavaAspectJ:匹配GenericServlet。带注释子类实例的init()调用