stimupy.stimuli.waves#

Demos#

Functions#

sine_linear

Linear (horizontal, vertical, oblique) sine-wave grating, with some phase(s) as target(s)

square_linear

Linear (horizontal, vertical, oblique) square-wave grating (set of bars), with some bar(s) as target(s)

staircase_linear

Linear staircase, with some bar(s) as target(s)

sine_radial

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

square_radial

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

staircase_radial

Radial staircase, with some ring(s) as target(s)

sine_rectilinear

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

square_rectilinear

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

staircase_rectilinear

Rectilinear staircase, with some frame(s) as target(s)

sine_angular

Angular sine-wave grating (set of segments) over the whole image, with some segment(s) as target(s)

square_angular

Angular square-wave grating (set of segments) over the whole image, with some segment(s) as target(s)

staircase_angular

Angular staircase, with some segment(s) as target(s)

sine_linear(visual_size=None, ppd=None, shape=None, frequency=None, n_bars=None, bar_width=None, period='ignore', rotation=0.0, phase_shift=0, intensities=(0.0, 1.0), target_indices=(), intensity_target=0.5, origin='corner', round_phase_width=True)[source]#

Linear (horizontal, vertical, oblique) sine-wave grating, with some phase(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_bars (int, or None (default)) – number of bars in the grating

  • bar_width (Number, or None (default)) – width of a single bar, 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

  • intensities (Sequence[float, float] or None (default)) – min and max intensity of sine-wave

  • 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 (default) if “mean”: set origin to hypothetical image center if “center”: set origin to real center (closest existing value to mean)

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

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]

square_linear(visual_size=None, ppd=None, shape=None, frequency=None, n_bars=None, bar_width=None, period='ignore', rotation=0.0, phase_shift=0, intensity_bars=(0.0, 1.0), target_indices=(), intensity_target=0.5, origin='corner', round_phase_width=True)[source]#

Linear (horizontal, vertical, oblique) square-wave grating (set of bars), with some bar(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_bars (int, or None (default)) – number of bars in the grating

  • bar_width (Number, or None (default)) – width of a single bar, 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_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

  • 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 (default) if “mean”: set origin to hypothetical image center if “center”: set origin to real center (closest existing value to mean)

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

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]

staircase_linear(visual_size=None, ppd=None, shape=None, frequency=None, n_bars=None, bar_width=None, period='ignore', rotation=0.0, phase_shift=0, intensity_bars=(0.0, 1.0), target_indices=(), intensity_target=0.5, origin='corner', round_phase_width=True)[source]#

Linear staircase, with some bar(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_bars (int, or None (default)) – number of bars in the grating

  • bar_width (Number, or None (default)) – width of a single bar, 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_bars (Sequence[float, ...]) – min and max intensity of sine-wave, by default (0.0, 1.0). Can also specify as many intensities as n_bars

  • 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 (default) if “mean”: set origin to hypothetical image center if “center”: set origin to real center (closest existing value to mean)

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

  • intensity_bars – if len(intensity_bars)==2, intensity range of staircase (default 0.0, 1.0); if len(intensity_bars)>2, intensity value for each bar. Can specify as many intensity_bars as n_bars. If fewer intensity_bars are passed than n_bars, cycles through intensities.

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]

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

Circular sine-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

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

  • 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

  • intensities (Sequence[float, float] or None (default)) – min and max intensity of sine-wave

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

square_radial(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)[source]#

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]

staircase_radial(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)[source]#

Radial staircase, 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, ...]) – if len(intensity_rings)==2, intensity range of staircase (default 0.0, 1.0); if len(intensity_rings)>2, intensity value for each ring. Can specify as many intensity_rings as n_rings. If fewer intensity_bars are passed than n_rings, cycles through intensities.

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

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

Rectilinear sine-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

  • frame_width (Number, or None (default)) – width of a single frame, in degrees

  • 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

  • intensities (Sequence[float, float] or None (default)) – min and max intensity of sine-wave

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

square_rectilinear(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)[source]#

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]

staircase_rectilinear(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)[source]#

Rectilinear staircase, 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, ...]) – if len(intensity_frames)==2, intensity range of staircase (default 0.0, 1.0); if len(intensity_frames)>2, intensity value for each frame. Can specify as many intensity_frames as n_frames. If fewer intensity_frames are passed than n_frames, cycles through intensities.

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

sine_angular(visual_size=None, ppd=None, shape=None, frequency=None, n_segments=None, segment_width=None, period='ignore', rotation=0.0, phase_shift=0, intensities=(0.0, 1.0), target_indices=(), intensity_target=0.5, origin='mean', round_phase_width=True)[source]#

Angular sine-wave grating (set of segments) over the whole image, with some segment(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 image

  • n_segments (int, or None (default)) – number of segments

  • segment_width (Number, or None (default)) – width of a single segment, in degrees

  • 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

  • intensities (Sequence[float, float] or None (default)) – min and max intensity of sine-wave

  • 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 (default) if “mean”: set origin to hypothetical image center if “center”: set origin to real center (closest existing value to mean)

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

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]

square_angular(visual_size=None, ppd=None, shape=None, frequency=None, n_segments=None, segment_width=None, period='ignore', rotation=0.0, phase_shift=0, intensity_segments=(0.0, 1.0), target_indices=(), intensity_target=0.5, origin='mean', round_phase_width=True)[source]#

Angular square-wave grating (set of segments) over the whole image, with some segment(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 image

  • n_segments (int, or None (default)) – number of segments in the grating

  • segment_width (Number, or None (default)) – width of a single segment, 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_segments (Sequence[float, ...]) – intensity value for each segment, by default (1.0, 0.0). Can specify as many intensities as n_segments; If fewer intensities are passed than n_segments, cycles through intensities

  • 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 (default) if “mean”: set origin to hypothetical image center if “center”: set origin to real center (closest existing value to mean)

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

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]

staircase_angular(visual_size=None, ppd=None, shape=None, frequency=None, n_segments=None, segment_width=None, period='ignore', rotation=0.0, phase_shift=0, intensity_segments=(0.0, 1.0), target_indices=(), intensity_target=0.5, origin='center', round_phase_width=True)[source]#

Angular staircase, with some segment(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 image

  • n_segments (int, or None (default)) – number of segments in the grating

  • segment_width (Number, or None (default)) – width of a single segment, 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_segments (Sequence[float, ...]) – if len(intensity_segments)==2, intensity range of staircase (default 0.0, 1.0); if len(intensity_segments)>2, intensity value for each segment. Can specify as many intensity_segments as n_segments. If fewer intensity_segments are passed than n_segments, cycles through intensities.

  • 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 (default) if “mean”: set origin to hypothetical image center if “center”: set origin to real center (closest existing value to mean)

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

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]