Skip to main content

Simple auditory and visual stimuli avoiding PsychoPy.

Project description

Code style: black Imports: isort codecov tests build doc PyPI version Downloads Conda Version Conda Downloads Conda Platforms DOI

Simple-stimuli

This repository contains simple auditory and visual stimuli that do not require PsychoPy. The auditory stimuli use the python sounddevice library and the visual stimuli use the python opencv library.

Installation

This repository is available for python ≥ 3.8 on pip with the command pip install stimuli or on conda-forge with the command conda install -c conda-forge stimuli.

Usage

Audio stimulus

from stimuli.audio import Tone

sound = Tone(volume=80, frequency=1000)
sound.play()

The volume can be set independently for each channel (stereo) by providing a tuple (L, R).

Visual stimulus

Visual stimulus can be grouped into 2 categories:

  • simple visuals that are drawn on top of each other
  • feedback visuals that are drawn once and updated

Simple visual

from stimuli.visuals import Text

visual = Text()
visual.background = "lightgrey"  # equivalent to visual.draw_background()
visual.putText("Top secret not-so-secret instructions!")
visual.show()

Feedback visual

import numpy as np

from stimuli.visuals import FillingBar

visual = FillingBar()
visual.background = "lightgrey"  # equivalent to visual.draw_background()
visual.putBar(length=200, width=20, margin=2, color="black", fill_color="teal")

for k in np.arange(0, 1, 0.1):
    visual.fill_perc = k  # update the visual
    visual.show(100)  # wait 100 ms

visual.close()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stimuli-0.4.2.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

stimuli-0.4.2-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

Details for the file stimuli-0.4.2.tar.gz.

File metadata

  • Download URL: stimuli-0.4.2.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for stimuli-0.4.2.tar.gz
Algorithm Hash digest
SHA256 36479bf20ad5f16a0962fc153356ff88b1a1a3740c55436923803f3935db68fa
MD5 799255bcfdffed902abfb585abce8355
BLAKE2b-256 e6bbcf8eab5c7a3466cab68c8b72240c16b7c2c41bdd5a9770b52f554c2fe741

See more details on using hashes here.

File details

Details for the file stimuli-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: stimuli-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 31.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for stimuli-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 444f0be4a7da7324851b4128f74bcf97cfadf3ec9a81a88ab3cec11014f0520d
MD5 c0d75510acf430fea991966eeb5fcdfc
BLAKE2b-256 56558fc2ec65a85987da238929cc38c60d04ebd88cd8e124785e8e8abea99731

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page