Skip to main content

Represent acoustic stimuli and responses

Project description

ndx-sound Extension for NWB

NWB extension of sounds.

Installation

pip install ndx-sound

Usage

Python

Add to an NWB file

from pynwb import NWBFile
from scipy.io import wavfile
from ndx_sound import AcousticWaveformSeries

sampling_rate, samples = wavfile.read(filepath)

acoustic_waveform_series = AcousticWaveformSeries(
    name="acoustic_stimulus",
    data=samples,
    rate=sampling_rate,
    description="acoustic stimulus",
)

nwbfile = NWBFile(...)
# if a recording of behavior, add to acquisition
nwbfile.add_acquisition(acoustic_waveform_series)

# if a stimulus, add to stimulus
nwbfile.add_stimulus(acoustic_waveform_series)

Visualization

Use plot_sound on its own outside nwbwidgets.

from ndx_sound.widgets import plot_sound

plot_sound(nwbfile.stimulus["acoustic_stimulus"])

Use acoustic_waveform_widget to include an Audio element that plays the sound.

from ndx_sound.widgets import acoustic_waveform_widget

acoustic_waveform_widget(nwb.stimulus["acoustic_stimulus"])

You can also have the sound widget automatically loaded into nwb2widget.

from ndx_sound import widgets

Then run nwb2widget as normal.

from nwbwidgets import nwb2widget

nwb2widget(nwbfile)

This extension was created using ndx-template.

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

ndx-sound-0.1.0.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

ndx_sound-0.1.0-py2.py3-none-any.whl (5.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ndx-sound-0.1.0.tar.gz.

File metadata

  • Download URL: ndx-sound-0.1.0.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for ndx-sound-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ee2d88f7b73c47be2bd2fa370c86bdea0386efe4c6e220e1eb3107d74a18b922
MD5 2934aa513d4e87e3e2ec8dd49d0a212f
BLAKE2b-256 4d8c19ae4bd6332e673b4c284b36ed0e304159ba827fb7c73ea09a428fcdb101

See more details on using hashes here.

File details

Details for the file ndx_sound-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: ndx_sound-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for ndx_sound-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0bac054935935d60eacdd7b2f14596126d28aae2754cc4c990815213f6d75507
MD5 ea664d652e7afef2642bc2d12abf681c
BLAKE2b-256 bc7ad3c8fe4621a4cb1416ecca3df2c261866ac1aebbf9ced2121dd5baee27a1

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