Skip to content

Commit

Permalink
added circular bullseye (function+demo)
Browse files Browse the repository at this point in the history
  • Loading branch information
LynnSchmittwilken committed Oct 27, 2022
1 parent 3ef39fb commit ed759d2
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 2 deletions.
45 changes: 45 additions & 0 deletions demo/circular.ipynb
Expand Up @@ -155,6 +155,51 @@
"display(ui, out)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# circular_bullseye\n",
"\n",
"This function produces the same stimulus as `circular_white()` but always with a single central target."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from stimuli.illusions.circular import circular_bullseye"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Parameterization"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"params = {\n",
" \"visual_size\": (10., 10.),\n",
" \"ppd\": 40.0,\n",
" \"frequency\": 1.,\n",
" \"intensity_discs\": (0., 1.),\n",
" \"intensity_background\": 0.5,\n",
" \"intensity_target\": 0.5,\n",
"}\n",
"\n",
"stim = circular_bullseye(**params)\n",
"plot_stim(stim)\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
51 changes: 49 additions & 2 deletions stimuli/illusions/circular.py
Expand Up @@ -5,7 +5,7 @@

def circular_white(
visual_size=(10, 10),
ppd=18,
ppd=30,
frequency=1,
intensity_discs=(0., 1.),
intensity_background=0.2,
Expand Down Expand Up @@ -107,6 +107,52 @@ def circular_white(
return {"img": img, "mask": mask.astype(int), **params}


def circular_bullseye(
visual_size=(10, 10),
ppd=30,
frequency=1,
intensity_discs=(0., 1.),
intensity_background=0.2,
intensity_target=0.5,
ssf=1,
):
"""
Circular Bullsseye stimulus
Parameters
----------
visual_size : (float, float)
The shape of the stimulus in degrees of visual angle. (y,x)
ppd : int
pixels per degree (visual angle)
frequency : float
the spatial frequency of the circular grating in cycles per degree
intensity_discs : (float, float)
intensity values of discs
intensity_background : float
intensity value of background
intensity_target : float
intensity value of target discs
ssf : int (optional)
the supersampling-factor used for anti-aliasing if >1. Default is 1.
Warning: produces smoother circles but might introduce gradients that affect vision!
Returns
----------
A stimulus dictionary with the stimulus ['img'] and target mask ['mask']
"""
stim = circular_white(
visual_size=visual_size,
ppd=ppd,
frequency=frequency,
intensity_discs=intensity_discs,
intensity_background=intensity_background,
intensity_target=intensity_target,
target_indices=0,
ssf=ssf)
return stim


def radial_white(
visual_size=(10, 12),
ppd=20,
Expand Down Expand Up @@ -247,7 +293,8 @@ def radial_white(
from stimuli.utils import plot_stimuli

stims = {
"Circular White's effect": circular_white(),
"Circular Whites": circular_white(),
"Circular Bullseye": circular_bullseye(),
"Radial white": radial_white(),
}

Expand Down

0 comments on commit ed759d2

Please sign in to comment.