Thanks @dvbridges, I understand what you did and know why there is psychopy_object
and psychopy_object2
(to handle the inner circle that is different from the outer one. For now, ignore that.
Going back to the “black and white segment per angular x radial section”. Setting it to n_radial_sections = 1.5
, indeed visually we can achieve that visuals that matches the expected outcome. But doing so, we can’t manage each section individually. What do I mean by that? After designing the layout of the radial, at each frame, I would like to decide which segment is white and which are black. See the code below.
import numpy as np
import psychopy.visual
import psychopy.event
from psychopy import visual, core
stim_diameter_pix = 512
n_angular_sections = 4
n_radial_sections = 3
angular_phase = 0.25
angular_size_deg = 360 / n_angular_sections
with psychopy.visual.Window(
size=(600, 600), color=(-1,) * 3, units="pix", fullscr=False
) as win:
sections = []
for i_radial_section in range(n_radial_sections):
for i_angular_section in range(n_angular_sections):
sections.append(
psychopy.visual.RadialStim(
win=win,
size=(stim_diameter_pix,) * 2,
units="pix",
visibleWedge=(0, angular_size_deg),
ori=i_angular_section * angular_size_deg,
angularCycles=n_angular_sections,
radialCycles=n_radial_sections,
angularPhase=angular_phase,
)
)
print("sections", len(sections))
for i in range(4):
# imagine this is per frame, where I would like to decide which section is black or white
for section in sections:
section.contrast = np.random.choice([-1, 1]) # instead of random, we have an array to keep track at each frame whether this is black or white
section.draw()
win.flip()
core.wait(1.0) # added just so we can see the change (for this ticket example only)
psychopy.event.waitKeys()
This code works, and we almost had it, but each angular x radial section contain both the black and the white portion (two portions). Instead, we just want to have one portion per section (lets say 1
for white, and -1
for black).
Greatly appreciate your inputs thus far.