Metadata-Version: 2.1
Name: stimuli
Version: 0.4.2
Summary: Simple auditory and visual stimuli avoiding PsychoPy.
Author-email: Mathieu Scheltienne <mathieu.scheltienne@fcbg.ch>
Maintainer-email: Mathieu Scheltienne <mathieu.scheltienne@fcbg.ch>
License: MIT License        
        Copyright (c) 2022 Mathieu Scheltienne        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.        
Project-URL: homepage, https://github.com/mscheltienne/simple-stimuli
Project-URL: documentation, https://github.com/mscheltienne/simple-stimuli
Project-URL: source, https://github.com/mscheltienne/simple-stimuli
Project-URL: tracker, https://github.com/mscheltienne/simple-stimuli/issues
Keywords: audio,auditory,python,stimuli,visual
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: matplotlib
Requires-Dist: psutil
Requires-Dist: numpy (>=1.21)
Requires-Dist: opencv-python
Requires-Dist: scipy
Requires-Dist: screeninfo
Requires-Dist: sounddevice
Provides-Extra: all
Requires-Dist: stimuli[build] ; extra == 'all'
Requires-Dist: stimuli[doc] ; extra == 'all'
Requires-Dist: stimuli[style] ; extra == 'all'
Requires-Dist: stimuli[test] ; extra == 'all'
Provides-Extra: build
Requires-Dist: build ; extra == 'build'
Requires-Dist: twine ; extra == 'build'
Provides-Extra: doc
Requires-Dist: furo ; extra == 'doc'
Requires-Dist: matplotlib ; extra == 'doc'
Requires-Dist: memory-profiler ; extra == 'doc'
Requires-Dist: numpydoc ; extra == 'doc'
Requires-Dist: sphinx ; extra == 'doc'
Requires-Dist: sphinxcontrib-bibtex ; extra == 'doc'
Requires-Dist: sphinx-copybutton ; extra == 'doc'
Requires-Dist: sphinx-design ; extra == 'doc'
Requires-Dist: sphinx-gallery ; extra == 'doc'
Requires-Dist: sphinx-issues ; extra == 'doc'
Provides-Extra: full
Requires-Dist: stimuli[all] ; extra == 'full'
Provides-Extra: style
Requires-Dist: black ; extra == 'style'
Requires-Dist: codespell ; extra == 'style'
Requires-Dist: isort ; extra == 'style'
Requires-Dist: flake8 ; extra == 'style'
Requires-Dist: pydocstyle[toml] ; extra == 'style'
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pytest-cov ; extra == 'test'

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![codecov](https://codecov.io/gh/mscheltienne/simple-stimuli/branch/main/graph/badge.svg?token=92BKRPSD0V)](https://codecov.io/gh/mscheltienne/simple-stimuli)
[![tests](https://github.com/mscheltienne/simple-stimuli/actions/workflows/pytest.yml/badge.svg?branch=main)](https://github.com/mscheltienne/simple-stimuli/actions/workflows/pytest.yml)
[![build](https://github.com/mscheltienne/simple-stimuli/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/mscheltienne/simple-stimuli/actions/workflows/build.yml)
[![doc](https://github.com/mscheltienne/simple-stimuli/actions/workflows/doc.yml/badge.svg?branch=main)](https://github.com/mscheltienne/simple-stimuli/actions/workflows/doc.yml)
[![PyPI version](https://badge.fury.io/py/stimuli.svg)](https://badge.fury.io/py/stimuli)
[![Downloads](https://static.pepy.tech/personalized-badge/stimuli?period=total&units=international_system&left_color=grey&right_color=blue&left_text=pypi%20downloads)](https://pepy.tech/project/stimuli)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/stimuli.svg)](https://anaconda.org/conda-forge/stimuli)
[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/stimuli.svg)](https://anaconda.org/conda-forge/stimuli)
[![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/stimuli.svg)](https://anaconda.org/conda-forge/stimuli)
[![DOI](https://zenodo.org/badge/497873209.svg)](https://zenodo.org/badge/latestdoi/497873209)

# Simple-stimuli

This repository contains simple auditory and visual stimuli that do not require
[PsychoPy](https://www.psychopy.org/). The auditory stimuli use the python
[sounddevice](https://python-sounddevice.readthedocs.io/en/0.4.4/) library and
the visual stimuli use the python [opencv](https://docs.opencv.org/4.x/)
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()
```
