Skip to content

Commit

Permalink
added checkerboard component
Browse files Browse the repository at this point in the history
  • Loading branch information
LynnSchmittwilken committed Jun 30, 2022
1 parent 1dad027 commit 938faaf
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions stimuli/components/components.py
Expand Up @@ -215,3 +215,23 @@ def square_wave(
]
stim[:, index] = low if start == "low" else high
return (stim, pixels_per_cycle)


def checkerboard(
ppd=10,
board_shape=(8, 8),
check_size=1.0,
vcheck1=0.0,
vcheck2=1.0,
):

check_size_px = degrees_to_pixels(check_size, ppd)
nchecks_height, nchecks_width = board_shape

img = np.ndarray((nchecks_height, nchecks_width))

for i, j in np.ndindex((nchecks_height, nchecks_width)):
img[i, j] = vcheck1 if i % 2 == j % 2 else vcheck2

img = img.repeat(check_size_px, axis=0).repeat(check_size_px, axis=1)
return img

0 comments on commit 938faaf

Please sign in to comment.