在 Psychopy 中变得不准确 response.corr
Getting inaccurate response.corr in Psychopy
我在 Mac 中使用 psychopy2 v1.85.2 进行实验。我在实验后收到如下消息,尽管在 excel 中得到了准确的 response.keys,但在不准确的 response.corr 中遇到了一些麻烦。请告诉我如何获得准确的 response.corr.
FutureWarning:elementwise comparison failed;returning scalar
instead,but in the future will perform elementwise comparison
if (response0.keys == str(correctAns0) or (response0.keys == correctAns0):
response0.keys
将 return 一个列表,即使它只包含一个值。这就是它被命名为 .keys
而不是 .key
的原因。例如如果主题按下 'a'
键,结果将是单个元素列表 ['a']
。
您应该将其视为一个列表,并像您一样将其与该列表中指定的单个项目进行比较。例如
# test against the zeroth list item rather than the entire list:
if response0.keys[0] == str(correctAns0): # etc
我在 Mac 中使用 psychopy2 v1.85.2 进行实验。我在实验后收到如下消息,尽管在 excel 中得到了准确的 response.keys,但在不准确的 response.corr 中遇到了一些麻烦。请告诉我如何获得准确的 response.corr.
FutureWarning:elementwise comparison failed;returning scalar
instead,but in the future will perform elementwise comparison
if (response0.keys == str(correctAns0) or (response0.keys == correctAns0):
response0.keys
将 return 一个列表,即使它只包含一个值。这就是它被命名为 .keys
而不是 .key
的原因。例如如果主题按下 'a'
键,结果将是单个元素列表 ['a']
。
您应该将其视为一个列表,并像您一样将其与该列表中指定的单个项目进行比较。例如
# test against the zeroth list item rather than the entire list:
if response0.keys[0] == str(correctAns0): # etc