stimupy.stimuli.rings#

Demos#

Functions#

circular

Circular square-wave grating (set of rings) over the whole image, with some ring(s) as target(s)

circular_generalized

Sequential set of circular rings with specified radii and targets

circular_two_sided

Circular square-wave grating (set of rings) over the whole image, with some ring(s) as target(s)

rectangular

Rectilinear square-wave grating (set of frames) over the whole image, with some frame(s) as target(s)

rectangular_generalized

Draw sequential set of square frames with specified radii and targets

rectangular_two_sided

Rectilinear square-wave grating (set of frames) over the whole image, with some frame(s) as target(s)

circular(visual_size=None, ppd=None, shape=None, frequency=None, n_rings=None, ring_width=None, period='ignore', rotation=0.0, phase_shift=0, intensity_rings=(0.0, 1.0), target_indices=(), intensity_target=0.5, origin='mean', round_phase_width=True, clip=False, intensity_background=0.5)#

Circular square-wave grating (set of rings) over the whole image, with some ring(s) as target(s)

Parameters:
  • 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]

  • shape (Sequence[Number, Number], Number, or None (default)) – shape [height, width] of image, in pixels

  • frequency (Number, or None (default)) – spatial frequency of grating, in cycles per degree visual angle

  • n_rings (int, or None (default)) – number of rings in the grating

  • ring_width (Number, or None (default)) – width of a single ring, in degrees visual angle

  • period ("even", "odd", "either" or "ignore" (default)) – ensure whether the grating has “even” number of phases, “odd” number of phases, either or whether not to round the number of phases (“ignore”)

  • rotation (float, optional) – rotation (in degrees), counterclockwise, by default 0.0 (horizontal)

  • phase_shift (float) – phase shift of grating in degrees

  • intensity_rings (Sequence[float, float]) – intensity value for each ring, by default (1.0, 0.0).

  • target_indices (int, or Sequence[int, ...]) – indices segments where targets will be placed

  • 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

  • origin ("corner", "mean" or "center") – if “corner”: set origin to upper left corner if “mean”: set origin to hypothetical image center (default) if “center”: set origin to real center (closest existing value to mean)

  • round_phase_width (Bool) – if True, round width of rings given resolution

  • clip (Bool) – if True, clip stimulus to image size (default: False)

  • intensity_background (float (optional)) – intensity value of background (if clipped), by default 0.5

Returns:

dict with the stimulus (key: “img”), mask with integer index for each target (key: “target_mask”), and additional keys containing stimulus parameters

Return type:

dict[str, Any]

circular_generalized(visual_size=None, ppd=None, shape=None, radii=None, intensity_rings=(0.0, 1.0), intensity_background=0.5, target_indices=(), intensity_target=0.5, origin='mean')[source]#

Sequential set of circular rings with specified radii and targets

Parameters:
  • 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]

  • shape (Sequence[Number, Number], Number, or None (default)) – shape [height, width] of image, in pixels

  • radii (Sequence[Number] or None (default)) – radii of each ring, in degrees visual angle

  • intensity_rings (Sequence[float, float]) – intensities of rings, by default (1.0, 0.0)

  • intensity_background (float (optional)) – intensity value of background, by default 0.5

  • target_indices (int, or Sequence[int, ...]) – indices rings where targets will be placed

  • 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

  • origin ("corner", "mean" or "center") – if “corner”: set origin to upper left corner if “mean”: set origin to hypothetical image center (default) if “center”: set origin to real center (closest existing value to mean)

Returns:

dict with the stimulus (key: “img”), mask with integer index for each ring (key: “target_mask”), and additional keys containing stimulus parameters

Return type:

dict[str, Any]

circular_two_sided(visual_size=None, ppd=None, shape=None, frequency=None, n_rings=None, ring_width=None, period='ignore', rotation=0.0, phase_shift=0, intensity_rings=(0.0, 1.0), target_indices=(), intensity_target=0.5, origin='mean', round_phase_width=True, clip=False, intensity_background=0.5)#

Circular square-wave grating (set of rings) over the whole image, with some ring(s) as target(s)

Parameters:
  • 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]

  • shape (Sequence[Number, Number], Number, or None (default)) – shape [height, width] of image, in pixels

  • frequency (Number, or None (default)) – spatial frequency of grating, in cycles per degree visual angle

  • n_rings (int, or None (default)) – number of rings in the grating

  • ring_width (Number, or None (default)) – width of a single ring, in degrees visual angle

  • period ("even", "odd", "either" or "ignore" (default)) – ensure whether the grating has “even” number of phases, “odd” number of phases, either or whether not to round the number of phases (“ignore”)

  • rotation (float, optional) – rotation (in degrees), counterclockwise, by default 0.0 (horizontal)

  • phase_shift (float) – phase shift of grating in degrees

  • intensity_rings (Sequence[float, float]) – intensity value for each ring, by default (1.0, 0.0).

  • target_indices (int, or Sequence[int, ...]) – indices segments where targets will be placed

  • 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

  • origin ("corner", "mean" or "center") – if “corner”: set origin to upper left corner if “mean”: set origin to hypothetical image center (default) if “center”: set origin to real center (closest existing value to mean)

  • round_phase_width (Bool) – if True, round width of rings given resolution

  • clip (Bool) – if True, clip stimulus to image size (default: False)

  • intensity_background (float (optional)) – intensity value of background (if clipped), by default 0.5

Returns:

dict with the stimulus (key: “img”), mask with integer index for each target (key: “target_mask”), and additional keys containing stimulus parameters

Return type:

dict[str, Any]

rectangular(visual_size=None, ppd=None, shape=None, frequency=None, n_frames=None, frame_width=None, period='ignore', rotation=0.0, phase_shift=0, intensity_frames=(0.0, 1.0), target_indices=(), intensity_target=0.5, origin='mean', round_phase_width=True, clip=False, intensity_background=0.5)#

Rectilinear square-wave grating (set of frames) over the whole image, with some frame(s) as target(s)

Parameters:
  • 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]

  • shape (Sequence[Number, Number], Number, or None (default)) – shape [height, width] of image, in pixels

  • 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 ("even", "odd", "either" or "ignore" (default)) – ensure whether the grating has “even” number of phases, “odd” number of phases, either or whether not to round the number of phases (“ignore”)

  • rotation (float, optional) – rotation (in degrees), counterclockwise, by default 0.0 (horizontal)

  • phase_shift (float) – phase shift of grating in degrees

  • intensity_frames (Sequence[float, float]) – intensity value for each frame, by default (1.0, 0.0).

  • target_indices (int, or Sequence[int, ...]) – indices segments where targets will be placed

  • 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

  • origin ("corner", "mean" or "center") – if “corner”: set origin to upper left corner if “mean”: set origin to hypothetical image center (default) if “center”: set origin to real center (closest existing value to mean)

  • round_phase_width (Bool) – if True, round width of frames given resolution

  • clip (Bool) – if True, clip stimulus to image size (default: False)

  • intensity_background (float (optional)) – intensity value of background (if clipped), by default 0.5

Returns:

dict with the stimulus (key: “img”), mask with integer index for each target (key: “target_mask”), and additional keys containing stimulus parameters

Return type:

dict[str, Any]

rectangular_generalized(visual_size=None, ppd=None, shape=None, radii=None, intensity_frames=(0.0, 1.0), intensity_background=0.5, target_indices=(), intensity_target=0.5, origin='mean', rotation=0.0)[source]#

Draw sequential set of square frames with specified radii and targets

Parameters:
  • 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]

  • shape (Sequence[Number, Number], Number, or None (default)) – shape [height, width] of image, in pixels

  • radii (Sequence[Number] or None (default)) – radii of each frame, in degrees visual angle

  • intensity_frames (Sequence[float, float]) – min and max intensity of square-wave, by default (0.0, 1.0)

  • intensity_background (float (optional)) – intensity value of background, by default 0.5

  • target_indices (int, or Sequence[int, ...]) – indices frames where targets will be placed

  • 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

  • origin ("corner", "mean" or "center") – if “corner”: set origin to upper left corner if “mean”: set origin to hypothetical image center (default) if “center”: set origin to real center (closest existing value to mean)

  • rotation (float, optional) – rotation (in degrees), counterclockwise, by default 0.0 (horizontal)

Returns:

dict with the stimulus (key: “img”), mask with integer index for each frame (key: “target_mask”), and additional keys containing stimulus parameters

Return type:

dict[str, Any]

rectangular_two_sided(visual_size=None, ppd=None, shape=None, frequency=None, n_frames=None, frame_width=None, period='ignore', rotation=0.0, phase_shift=0, intensity_frames=(0.0, 1.0), target_indices=(), intensity_target=0.5, origin='mean', round_phase_width=True, clip=False, intensity_background=0.5)#

Rectilinear square-wave grating (set of frames) over the whole image, with some frame(s) as target(s)

Parameters:
  • 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]

  • shape (Sequence[Number, Number], Number, or None (default)) – shape [height, width] of image, in pixels

  • 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 ("even", "odd", "either" or "ignore" (default)) – ensure whether the grating has “even” number of phases, “odd” number of phases, either or whether not to round the number of phases (“ignore”)

  • rotation (float, optional) – rotation (in degrees), counterclockwise, by default 0.0 (horizontal)

  • phase_shift (float) – phase shift of grating in degrees

  • intensity_frames (Sequence[float, float]) – intensity value for each frame, by default (1.0, 0.0).

  • target_indices (int, or Sequence[int, ...]) – indices segments where targets will be placed

  • 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

  • origin ("corner", "mean" or "center") – if “corner”: set origin to upper left corner if “mean”: set origin to hypothetical image center (default) if “center”: set origin to real center (closest existing value to mean)

  • round_phase_width (Bool) – if True, round width of frames given resolution

  • clip (Bool) – if True, clip stimulus to image size (default: False)

  • intensity_background (float (optional)) – intensity value of background (if clipped), by default 0.5

Returns:

dict with the stimulus (key: “img”), mask with integer index for each target (key: “target_mask”), and additional keys containing stimulus parameters

Return type:

dict[str, Any]