I have a question, why I can’t achieve the above result with the variables in the condition file, and the program also reports an error: variable not defined. Is this because the variables in the condition file cannot be used to define the stimulus shape.
Thank you for your kindness.
Yours truly hu.
Running: E:\psychopy 文件\5555\untitled_lastrun.py ###############
1091.6264 INFO Loaded monitor calibration from [‘2023_05_29 18:19’]
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. Contribute - pygame wiki
3.9639 WARNING User requested fullscreen with size [1024 768], but screen is actually [1920, 1080]. Using actual size
Traceback (most recent call last):
File “E:\psychopy 文件\5555\untitled_lastrun.py”, line 106, in
edges=targetshape, size=(0.5, 0.5),
NameError: name ‘targetshape’ is not defined
0.5919 WARNING Monitor specification not found. Creating a temporary one…
################ Experiment ended with exit code 1 [pid:21596] #################
1102.2698 INFO Loaded monitor calibration from [‘2023_05_29 18:19’]
Hello,
Can you please share the condition file?
Please also shows us where you try using this variable (take a screenshot of the component properties).
Hi Chen.
Thank you very much for your advice, but I can’t upload the image due to network problem or whatever reason. Every time I upload an image there is always an error and it reminds me "sorry , there was an error uploading that file. please try again. “. So, to make my problem more clear, I will describe in words how I set up the experiment.
Conditions.xlsx(targetshape=[4,5])----components----polygon----shape:regular polygon ----num.vertices:$targetshape. I imported the conditions file into the loop, rendering in The output says the variable targetshape is not defined. What is the reason for this?
Thank you once more for your kindness.
Yours truly Hu
Hi Jens.
I made a typo here, but the variables used in Psychopy are correct, and I still can’t solve the problem. Is it possible that regular polygon cannot use the variables($) in the condition file?
Best wishes Hu
Due to the time difference, I am just responding to you now. I am unable to upload image information, perhaps due to network restrictions or other reasons. Whenever I try to upload an image, I get the message “Sorry, there was an error uploading that file. Please try again.” Therefore, to make my question clearer, I will use text to describe how I set up the experiment.
In the loop, I imported “Conditions.xlsx(targetshape=[4,5])” → components → polygon → shape: regular polygon → num.vertices: $targetshape.
the code-component initializes targetshape in a Begin experiment tab with a value that won’t be used in the experiment. Without this PsychoPy throws the error-message that targetshape is not defined. This is due to the fact that the polygon is defined before targetshape from the condition-file become available.
Anyway setting set every repeat or set every frame throws an error: AttributeError: ‘Polygon’ object has no attribute ‘setNVertices’. So, this is not the way to go. I also receive a warning: I don’t know the appropriate default value for a ‘nVertices’ parameter.
one way to get the experiment running is to define the polygons you want to use via the Builder and change their opacity depending on the condition. The following experiment uses three predefined polygons, triangle, square and star. Their opacity is set based on the value of the variable condition.