Skip to main content

An NWB extension for storing bipolar scheme

Project description

ndx-bipolar-scheme Extension for NWB

Structure for storing the bipolar schema of a recording in an NWB file.

PyPI version codecov License

schema schema

python installation

$ pip install ndx-bipolar-scheme

python usage

from pynwb import NWBHDF5IO, NWBFile
from pynwb.file import DynamicTableRegion
from datetime import datetime
from ndx_bipolar_scheme import BipolarSchemeTable, EcephysExt
from pynwb.ecephys import ElectricalSeries

import numpy as np

nwbfile = NWBFile('description', 'id', datetime.now().astimezone())

device = nwbfile.create_device('device_name')

electrode_group = nwbfile.create_electrode_group('electrode_group',
                                                 'desc', 'loc', device=device)

for i in np.arange(20.):
    nwbfile.add_electrode(i, i, i, np.nan, 'loc', 'filt', electrode_group)

bipolar_scheme_table = BipolarSchemeTable(name='bipolar_scheme_table',
                                          description='desc')

bipolar_scheme_table.add_row(anodes=[0], cathodes=[1])
bipolar_scheme_table.add_row(anodes=[0, 1], cathodes=[2, 3])
bipolar_scheme_table.add_row(anodes=[0, 1], cathodes=[2])

bipolar_scheme_table.anodes.table = nwbfile.electrodes
bipolar_scheme_table.cathodes.table = nwbfile.electrodes

bipolar_scheme_region = DynamicTableRegion(
    name='electrodes',
    data=np.arange(0, 3),
    description='desc',
    table=bipolar_scheme_table)

ec_series = ElectricalSeries(name='test_ec_series',
                             description='desc',
                             data=np.random.rand(100, 3),
                             rate=1000.,
                             electrodes=bipolar_scheme_region)

nwbfile.add_acquisition(ec_series)

ecephys_ext = EcephysExt(name='ecephys_ext')
ecephys_ext.bipolar_scheme_table = bipolar_scheme_table
nwbfile.add_lab_meta_data(ecephys_ext)

with NWBHDF5IO('test_nwb.nwb', 'w') as io:
    io.write(nwbfile)

with NWBHDF5IO('test_nwb.nwb', 'r', load_namespaces=True) as io:
    nwbfile = io.read()
    print(nwbfile.acquisition['test_ec_series'].electrodes.table['anodes'][2]['x'])

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-bipolar-scheme-0.3.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

ndx_bipolar_scheme-0.3.0-py2.py3-none-any.whl (6.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ndx-bipolar-scheme-0.3.0.tar.gz.

File metadata

  • Download URL: ndx-bipolar-scheme-0.3.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for ndx-bipolar-scheme-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d687e552c345d494c2082cb5a6e24459d65c60e5107938136cf5e7c97e00d2d3
MD5 1f683be166a289781d35e97257f70f0b
BLAKE2b-256 8e87534f976efd31d5ea682f62863183cf30cf150f525013663216b93fe2c23d

See more details on using hashes here.

File details

Details for the file ndx_bipolar_scheme-0.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: ndx_bipolar_scheme-0.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for ndx_bipolar_scheme-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2ef46a65abe8478dd33af3216604f005fd12fae40cb5d1a8e9f6cd93a5d241d9
MD5 37f4d3ed9caf361905c7c160a5a5a25d
BLAKE2b-256 091f3ae44f6310edd0a2b6b76444db0e4b2b62de2eb87492633d3176c613f178

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