2/19/2023 0 Comments Psychopy draw rectangle![]() ![]() For a start, the \$ symbol is not valid Python syntax and should have caused an explicit error, and directions is just the name of a variable, not an attribute of a stimulus, so we will assume you’re actually doing something other than what you describe, and won’t be able to help much. in narrative form, a statement like “if I call ‘nums’ as a value for the dot’s directions (i.e., direction = $nums) nothing happens” is not very useful. PS when you’re discussing problems with code, please give the actual code verbatim. It might be possible to do that by specifying vertices too, but I’m not sure how. your rectangle) would just be to pass a bitmap image of rectangle as the tex parameter. The easiest way to specify the texture to draw (i.e. What you probably want here is the ElementArrayStim, which would allow you to quickly draw 100 copies of a single rectangle, but each can have its own independent attributes (such as orientation). ![]() As the DotStim is built to display, well, dots, orientation isn’t something it provides for. I think the issue here is that the dir attribute of a DotStim is the direction of motion of the elements, not their orientation. I’ve reduced *range*(100) to *range*(1) and that resolves the error and the experiment works, but the rectangles are still all oriented the same way (i.e., it’s just one rectangle repeated 100 times).Īny further suggestions would be greatly appreciated- thanks. ValueError: operands could not be broadcast together with shapes (2,) (2,2,100) If I call ‘nums’ as a value for the rectangle’s orientations (i.e., orientation = $nums), I get an error message: However, when I run this code one of two things happens if I call ‘nums’ as a value for the dot’s directions (i.e., direction = $nums) nothing happens (I’m assuming because the one rectangle is being repeated 100 times by dotStim). # generate an array of 100 values (type int) and append to var 'nums' # for trials with stimuli pointing to the right, mu=45, and for left, mu=135 I’ve tried running script from a previous experiment that used dotStim to sample a gaussian distribution successfully: nums = UPDATE: after playing around with the values, I’ve noticed that something is not quite right- I’ve managed to draw 100 rectangles at the same time, but they are all oriented the same direction (i.e., it’s taking one rectangle and repeating so not a gaussian distribution). My apologies, there was a typo elsewhere in my code all fixed and working now. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |