noises#

Modules#

binaries#

narrowbands#

naturals#

whites#

Functions#

pseudo_white_spectrum([shape, amplitude, rng])

Create pseudorandom white noise spectrum

overview([skip])

Generate example stimuli from this module

plot_overview([mask, save, units])

Plot overview of examples in this module (and submodules)

stimupy.noises.pseudo_white_spectrum(shape=(100, 100), amplitude=2.0, rng=None)[source]#

Create pseudorandom white noise spectrum

Code translated and adapted from Matlab scripts provided by T. Peromaa

Parameters:
  • shape (int or (int, int)) – Shape of noise array in pixels (height, width)

  • amplitude – Amplitude of noise power spectrum

  • rng (numpy.random.Generator, optional) – Random number generator to use. If None, a new default_rng is created. By passing in a custom rng, you can control the randomness of the noise generation, e.g., make it replicable.

Returns:

Shifted 2d complex number spectrum. DC = 0. Amplitude of each (pos/neg) frequency component = A/2 Power of each (pos/neg) frequency component = (A/2)**2

Return type:

spectrum

stimupy.noises.overview(skip=False)[source]#

Generate example stimuli from this module

Returns:

Dict mapping names to individual stimulus dicts

Return type:

dict[str, dict]

stimupy.noises.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