Skip to content

Commit

Permalink
frames.bullseye
Browse files Browse the repository at this point in the history
  • Loading branch information
JorisVincent committed Dec 6, 2022
1 parent 1d80c01 commit 1b1b35c
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions stimuli/illusions/frames.py
Expand Up @@ -89,3 +89,69 @@ def frames(
stim["mask"] = targets_mask

return stim


def bullseye(
shape=None,
visual_size=None,
ppd=None,
frequency=None,
n_frames=None,
frame_width=None,
period="ignore",
intensity_frames=(0.0, 1.0),
target_indices=(),
intensity_target=0.5,
):
"""Square "bullseye", i.e., set of rings with target in center
Essentially frames(target_indices=1)
Parameters
----------
shape : Sequence[Number, Number], Number, or None (default)
shape [height, width] of image, in pixels
visual_size : Sequence[Number, Number], Number, or None (default)
visual size [height, width] of image, in degrees
ppd : Sequence[Number, Number], Number, or None (default)
pixels per degree [vertical, horizontal]
frequency : Number, or None (default)
spatial frequency of grating, in cycles per degree visual angle
n_frames : int, or None (default)
number of frames in the grating
frame_width : Number, or None (default)
width of a single frame, in degrees visual angle
period : "full", "half", "ignore" (default)
whether to ensure the grating only has "full" periods,
half "periods", or no guarantees ("ignore")
intensity_bars : Sequence[float, ...]
intensity value for each bar, by default [1.0, 0.0].
Can specify as many intensities as n_bars;
If fewer intensities are passed than n_bars, cycles through intensities
intensity_target : float, or Sequence[float, ...], optional
intensity value for each target, by default 0.5.
Can specify as many intensities as number of target_indices;
If fewer intensities are passed than target_indices, cycles through intensities
Returns
----------
dict[str, Any]
dict with the stimulus (key: "img"),
mask with integer index for each target (key: "mask"),
and additional keys containing stimulus parameters
"""

stim = frames(
shape=shape,
visual_size=visual_size,
ppd=ppd,
frequency=frequency,
n_frames=n_frames,
frame_width=frame_width,
period=period,
intensity_frames=intensity_frames,
target_indices=1,
intensity_target=intensity_target,
)

return stim

0 comments on commit 1b1b35c

Please sign in to comment.