stimupy.stimuli#
Modules#
Functions#
Indicate elements as targets |
|
Place targets in stimulus |
|
Generate example stimuli from this module |
|
Plot overview of examples in this module (and submodules) |
- mask_targets(element_mask, target_indices)[source]#
Indicate elements as targets
Creates a new target_mask from a mask of elements (e.g., grating bars, rings, frames, etc.), by indexing these elements.
- Parameters:
element_mask (numpy.ndarray) – mask with integer values for different elements / regions in a stimulus
target_indices (Sequence[int] or int) – index or indices of elements to be designated as targets. Index 0 should always refer to background region. Indices can be negative, which results in “counting backwards” from the highest index in element_mask.
- Returns:
target mask, with integer values indicating target regions, in order that they appear in target_indices
- Return type:
- Raises:
ValueError – if a target_idx is greater than any value in the element_mask
- place_targets(stim, element_mask_key, target_indices, intensity_target=0.5)[source]#
Place targets in stimulus
Turns image regions/elements defined by element_mask_key and indicated by target_indices, into targets. Targets are defined in a new target_mask, and drawn into image with intensity_target.
- Parameters:
stim (dict[str, Any]) – stimulus dictionary, with at least an “img” key, and mask indicated by element_mask_key
element_mask_key (str) – key of the mask in stim-dict indicating image “elements”/regions
target_indices (Sequence[int] or int) – index or indices of elements to be designated as targets
intensity_target (float, optional) – intensity value for target, by default 0.5
- Returns:
dict with the stimulus (key: “img”) with targets placed, mask with integer index for the target (key: “target_mask”)
- Return type:
- plot_overview(mask=False, save=None, units='deg')[source]#
Plot overview of examples in this module (and submodules)
- Parameters:
mask (bool or str, optional) – If True, plot mask on top of stimulus image (default: False). If string is provided, plot this key from stimulus dictionary as mask
save (None or str, optional) – If None (default), do not save the plot. If string is provided, save plot under this name.
units ("px", "deg" (default), or str) – what units to put on the axes, by default degrees visual angle (“deg”). If a str other than “deg”(/”degrees”) or “px”(/”pix”/”pixels”) is passed, it must be the key to a tuple in stim