Skip to content

Commit

Permalink
Clean up imports
Browse files Browse the repository at this point in the history
  • Loading branch information
JorisVincent committed Oct 7, 2022
1 parent 6055a66 commit 7688d17
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
1 change: 1 addition & 0 deletions stimuli/components/__init__.py
@@ -1 +1,2 @@
from .checkerboard import checkerboard
from .components import *
6 changes: 3 additions & 3 deletions stimuli/components/checkerboard.py
Expand Up @@ -4,7 +4,7 @@
from stimuli.utils import resolution


def resolve_checkerboard_params(
def resolve_params(
ppd=None,
shape=None,
visual_size=None,
Expand Down Expand Up @@ -148,11 +148,11 @@ def checkerboard(
See also
--------
stimuli.components.checkerboard.resolve_checkerboard_params :
stimuli.components.checkerboard.resolve_params :
how the size & resolution parameters can be resolved
"""

params = resolve_checkerboard_params(
params = resolve_params(
ppd=ppd,
shape=shape,
visual_size=visual_size,
Expand Down
13 changes: 3 additions & 10 deletions stimuli/illusions/checkerboards.py
@@ -1,5 +1,5 @@
import numpy as np
from stimuli.components.checkerboard import checkerboard as board
from stimuli.components import checkerboard as board
from stimuli.utils import degrees_to_pixels, resolution


Expand All @@ -13,15 +13,8 @@ def mask_from_idx(checkerboard_stim, check_idc):

mask = np.zeros(checkerboard_stim["shape"])
for coords in check_idc:
if (
coords[0] < 0
or coords[0] > coords[0]
or coords[1] < 0
or coords[1] > board_shape[1]
):
raise ValueError(
f"Cannot provide mask for check {coords} outside board {board_shape}"
)
if coords[0] < 0 or coords[0] > coords[0] or coords[1] < 0 or coords[1] > board_shape[1]:
raise ValueError(f"Cannot provide mask for check {coords} outside board {board_shape}")
ypos = int(coords[0] * check_size_px.height)
xpos = int(coords[1] * check_size_px.width)
mask[
Expand Down
6 changes: 3 additions & 3 deletions tests/test_checkerboard.py
@@ -1,5 +1,5 @@
import pytest
from stimuli.components.checkerboard import checkerboard, resolve_checkerboard_params
from stimuli.components.checkerboard import checkerboard, resolve_params


@pytest.mark.parametrize(
Expand All @@ -17,7 +17,7 @@
),
)
def test_valid_params(ppd, shape, visual_size, board_shape, check_visual_size):
resolve_checkerboard_params(
resolve_params(
ppd=ppd,
shape=shape,
visual_size=visual_size,
Expand All @@ -37,7 +37,7 @@ def test_valid_params(ppd, shape, visual_size, board_shape, check_visual_size):
)
def test_too_many_unknowns(ppd, shape, visual_size, board_shape, check_visual_size):
with pytest.raises(ValueError):
resolve_checkerboard_params(
resolve_params(
ppd=ppd,
shape=shape,
visual_size=visual_size,
Expand Down

0 comments on commit 7688d17

Please sign in to comment.