Skip to main content

Simple auditory and visual stimuli avoiding PsychoPy.

Project description

Code style: black Imports: isort codecov tests build 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.1.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

stimuli-0.4.1-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for stimuli-0.4.1.tar.gz
Algorithm Hash digest
SHA256 b55ca30a0a1c30735f5ed349055a2ab1b7ee0158fc83d82c9390c0b9e1fb3e7f
MD5 9a689f99b870a266ece1dc27583f4f50
BLAKE2b-256 5f2c62b50ca24aa9886ebf20426f2b3b965150e497d9ab9125d063af9e7e1daf

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for stimuli-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d71719c487de20356ec4e7c6a78c5c8efe37c6853334c3355a88de3ff402403
MD5 d3a200dfd2b0b03372dc88228e748f64
BLAKE2b-256 21c7a479978913217b319a097aeb97abd4ec9e1b00ab5206c80c04aef61fa79c

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