Skip to content

Commit

Permalink
Fixed binary masks for todorovic, circular and sbc
Browse files Browse the repository at this point in the history
  • Loading branch information
matko.matic committed Jul 15, 2021
2 parents ad11f9d + 1890dfc commit 06d291b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions stimuli/illusions/checkerboard_sbc.py
Expand Up @@ -62,10 +62,10 @@ def checkerboard_contrast(ppd=10, board_shape=(8,8), check_size=1.0, target1_coo


def domijan2015():
return checkerboard_contrast(ppd=10, n_checks=8, check_size=1.0, target1_coords=(3, 2), target2_coords=(5, 5), extend_targets=False, padding=(.9,1.1,.9,1.1), check1=1., check2=9., target=5.)
return checkerboard_contrast(ppd=10, board_shape=(8,8), check_size=1.0, target1_coords=(3, 2), target2_coords=(5, 5), extend_targets=False, padding=(.9,1.1,.9,1.1), check1=1., check2=9., target=5.)

def domijan2015_extended():
return checkerboard_contrast(ppd=10, n_checks=8, check_size=1.0, target1_coords=(3, 2), target2_coords=(5, 5), extend_targets=True, padding=(.9,1.1,.9,1.1), check1=1., check2=9., target=5.)
return checkerboard_contrast(ppd=10, board_shape=(8,8), check_size=1.0, target1_coords=(3, 2), target2_coords=(5, 5), extend_targets=True, padding=(.9,1.1,.9,1.1), check1=1., check2=9., target=5.)

def RHS2007_Checkerboard016():
total_height, total_width, ppd = (32,) * 3
Expand Down
2 changes: 1 addition & 1 deletion stimuli/illusions/sbc.py
Expand Up @@ -35,7 +35,7 @@ def simultaneous_brightness_contrast(ppd=10, target_shape=(5,5), padding=(2,2,2,

mask1 = pad_img(mask, inner_padding, ppd, 0)
mask2 = pad_img(mask, inner_padding, ppd, 0)
mask = np.hstack((mask1, mask2))
mask = np.hstack((mask1, mask2*2))

img = pad_img(img, padding, ppd, target)
mask = pad_img(mask, padding, ppd, 0)
Expand Down
2 changes: 1 addition & 1 deletion stimuli/illusions/todorovic.py
Expand Up @@ -76,7 +76,7 @@ def todorovic_illusion(target_shape=(4,4), ppd=10, covers_shape=(2.5, 2.5), spac
stim2 = todorovic_illusion(target_shape=target_shape, ppd=ppd, covers_shape=covers_shape, spacing=spacing,
padding=(0,0,0,0), inner_padding=inner_padding, back=grid, grid=back, target=target, double=False)
img = np.hstack([img, stim2.img])
mask = np.hstack([mask, stim2.target_mask])
mask = np.hstack([mask, stim2.target_mask*2])

img = pad_img(img, padding, ppd, target)
mask = pad_img(mask, padding, ppd, 0)
Expand Down
13 changes: 7 additions & 6 deletions stimuli/illusions/whites.py
Expand Up @@ -275,7 +275,6 @@ def RHS2007_WE_anderson():
return stimuli.illusions.whites.white_anderson(shape=(height, width), ppd=ppd, frequency=frequency, target_height=target_height,
target_indices_top=(5,), target_offsets_top=(target_height / 2,), target_indices_bottom=(10,), target_offsets_bottom=(-target_height / 2,),
height_bars=height_bars, height_horizontal_top=height_horizontal, padding=padding)
return img

def RHS2007_WE_howe():
total_height, total_width, ppd = (32,)*3
Expand All @@ -291,7 +290,6 @@ def RHS2007_WE_howe():
return stimuli.illusions.whites.white_anderson(shape=(height, width), ppd=ppd, frequency=frequency, target_height=target_height,
target_indices_top=(5,), target_offsets_top=(0,), target_indices_bottom=(10,), target_offsets_bottom=(0,),
height_bars=height_bars, height_horizontal_top=height_horizontal, padding=padding)
return img

def RHS2007_WE_radial_thick_small():
total_height, total_width, ppd = (32,)*3
Expand Down Expand Up @@ -330,6 +328,7 @@ def RHS2007_WE_circular1():
padding = (padding_vertical, padding_vertical, 0, 0)
stim1 = stimuli.illusions.whites.circular_white(radius=radius, ppd=ppd, frequency=frequency, target_indices=(4,), start='high', padding=padding)
stim2 = stimuli.illusions.whites.circular_white(radius=radius, ppd=ppd, frequency=frequency, target_indices=(4,), start='low', padding=padding)
stim2.target_mask *= 2

stim = Stimulus()
stim.img = np.hstack((stim1.img, stim2.img))
Expand All @@ -344,8 +343,9 @@ def RHS2007_WE_circular05():
frequency = n_cycles / radius
padding_vertical = (total_height - 2 * radius) / 2
padding = (padding_vertical, padding_vertical, 0, 0)
stim1 = stimuli.illusions.whites.circular_white(radius=radius, ppd=ppd, frequency=frequency, target_indices=(10,), start='high', padding=padding)
stim2 = stimuli.illusions.whites.circular_white(radius=radius, ppd=ppd, frequency=frequency, target_indices=(10,), start='low', padding=padding)
stim1 = stimuli.illusions.whites.circular_white(radius=radius, ppd=ppd, frequency=frequency, target_indices=(4,), start='high', padding=padding)
stim2 = stimuli.illusions.whites.circular_white(radius=radius, ppd=ppd, frequency=frequency, target_indices=(4,), start='low', padding=padding)
stim2.target_mask *= 2

stim = Stimulus()
stim.img = np.hstack((stim1.img, stim2.img))
Expand All @@ -360,8 +360,9 @@ def RHS2007_WE_circular025():
frequency = n_cycles / radius
padding_vertical = (total_height - 2 * radius) / 2
padding = (padding_vertical, padding_vertical, 0, 0)
stim1 = stimuli.illusions.whites.circular_white(radius=radius, ppd=ppd, frequency=frequency, target_indices=(22,), start='high', padding=padding)
stim2 = stimuli.illusions.whites.circular_white(radius=radius, ppd=ppd, frequency=frequency, target_indices=(22,), start='low', padding=padding)
stim1 = stimuli.illusions.whites.circular_white(radius=radius, ppd=ppd, frequency=frequency, target_indices=(4,), start='high', padding=padding)
stim2 = stimuli.illusions.whites.circular_white(radius=radius, ppd=ppd, frequency=frequency, target_indices=(4,), start='low', padding=padding)
stim2.target_mask *= 2

stim = Stimulus()
stim.img = np.hstack((stim1.img, stim2.img))
Expand Down
1 change: 1 addition & 0 deletions stimuli/papers/RHS2007.py
Expand Up @@ -154,6 +154,7 @@ def bullseye_thick():

if st.target_mask is not None:
plt.subplot(M, 2, 2 * i + 2)
plt.colorbar()
plt.title(stim_name + " - mask")
plt.imshow(st.target_mask, cmap='gray')

Expand Down
1 change: 1 addition & 0 deletions stimuli/papers/domijan2015.py
Expand Up @@ -80,6 +80,7 @@ def checkerboard_extended():

if st.target_mask is not None:
plt.subplot(M, 2, 2*i+2)
plt.colorbar()
plt.title(stim_name + " - mask")
plt.imshow(st.target_mask, cmap='gray')

Expand Down

0 comments on commit 06d291b

Please sign in to comment.