pydapsys

Package to read Dapsys files with Python

https://github.com/digital-c-fiber/pydapsys

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 7 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.8%) to scientific vocabulary

Keywords

neurophysiology
Last synced: 10 months ago · JSON representation ·

Repository

Package to read Dapsys files with Python

Basic Info
  • Host: GitHub
  • Owner: Digital-C-Fiber
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 107 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 6
Topics
neurophysiology
Created over 3 years ago · Last pushed almost 3 years ago
Metadata Files
Readme License Citation

README.md

PyDapsys - Read DAPSYS recordings with Python

PyPI DOI (Article) DOI (Zenodo)

PyDapsys is a package to read neurography recordings made with DAPSYS (Data Acquisition Processor System). It is based on a reverse-engineered specification of the binary data format used by the latest DAPSYS version.

Optionally, the library provides functionality to store loaded data into Neo datastructures, from where they can be exported into various other formats.

Installation

Either download the wheel file for offline installation or use pypi.

Basic functionalities

Will only offer the data representation of PyDapsys, without ability to convert to Neo. Has only numpy as sole dependency.

pip install pydapsys

pip install {name_of_downloaded_wheel}.whl

With Neo converters

Install base library with additional dependencies required to load data into Neo datastructures. Writing Neo datastructures to some formats may require additional dependencies. Please see the Neo documentation for further information.

pip install pydapsys[neo]

pip install {name_of_downloaded_wheel}.whl[neo]

Usage

Quickstart

A DAPSYS file is made up of two parts: A sequential list of blocks or pages, which store either a text with a timestamp or a waveform with associated timestamps, and a table of contents (toc). The toc consists of folders and streams. Each page has an id unique in the context of the file. Streams in the toc have an array of ids of the pages belonging to the stream. A stream is either a text stream (referring only to text pages) or a data stream (referring only to recording pages).

Load a file

Use File.from_binary to read from a BinaryIO object. python from pydapsys import read_file from pathlib import Path MY_DAPSYS_FILE = Path(".")/"to"/"my"/"dapsys_file.dps" with open(MY_DAPSYS_FILE, 'rb') as file: file = read_file(file) The File object has two fields, the root of the table of contents and a dictionary mapping the page ids to their respective pages.

Inspect file structure

To inspect the ToC structure of a loaded file, use the structure property of the toc Root, preferable together with pprint: python import pprint pprint.PrettyPrinter(indent=4).pprint(file.toc.structure) This will print the structure, names and types of all elements in the table of contents. For Streams, the number of associated pages it also printed after their type.

Access data from a file

To access data, use the File.get_data method. The method takes a path from the toc structure (WITHOUT THE NAME OF THE ROOT!) and will return all associated pages. Please note, that the path is case insensitive python from pydapsys.toc import StreamType my_texts = list(file.get_data("myrecording/my text stream", stype=StreamType.Text)) my_waveforms = list(file.get_data("myrecording/somewhere else/ my waveform stream", stype=StreamType.Waveform))

Text pages

A text page consists of three fields:

  • text: The text stored in the page, string

  • timestamp_a: The first timestamp of the page, float64 (seconds)

  • timestamp_b: The second timestamp of the page (float64, seconds), which sometimes is not presented and is thus set to None

Waveform pages

Waveform pages consist of three fields:

  • values: Values of the waveform, float32 (volt)

  • timestamps: Timestamps corresponding to values, float64 (seconds)

  • interval: Interval between values, float64 (seconds)

In continuously sampled waveforms, only the timestamp of the first value will be present, in addition to the sampling interval. The timestamps of the other values can be calculated by this two values.

Irregularly sampled waveforms will have one timestamp for each value, but no interval.

Neo converters

The module pydapsys.neo_convert contains classes to convert a Dapsys recording to the Neo format. IMPORTANT: importing the module without installing neo first will raise an exception

As Dapsys files may have different structures, depending on how it was configured and what hardware is used, different converters are required for each file structure.

Currently there is only one converter available, for recordings made using a NI Pulse stimulator.

NI Pulse stimulator

Converter class for Dapsys recording created using an NI Pulse stimulator. Puts everything into one neo sequence. Waveform pages of the continuous recording are merged if the difference between a pair of consecutive pages is less than a specified threshold (grouping_tolerance).

```python from pydapsys.neo_converters import NIPulseStimRecordingConverter

convert a recording to a neo block

neoblock = NIPulseStimRecordingConverter(file, groupingtolerance=1e-9).to_neo() ```

Expected file structure

{stimfolder} must be one of "NI Puls Stimulator", "pulse stimulator", "NI Pulse stimulator", but can be changed by adding entries to `NIPulseStimulatorToNeo.stimfoler_names`

  • Root

    • [Text] Comments -> Converted into a single event called "comments"
    • {stim_folder}
    • [Text] Pulses -> Converted into one neo event streams, one per unique text
    • [Waveform] Continuous recording -> Converted into multiple AnalogSignals
    • Responses

      • Tracks for All Responses -> Optional. Will silently ignore spike trains if this folder does not exist
      • ... [Text] tracks... -> Converted into spike trains

Citation

(for details see the CITATION.cff) If you refer to this project in an article, we would appreciate it if you cited the publication "PyDapsys: an open-source library for accessing electrophysiology data recorded with DAPSYS" (doi:10.3389/fninf.2023.1250260) published in Frontiers in Neuroinformatics Vol. 17.

If you actively used the library to gain results in your publication, it might also make sense for you to cite the specific release via the Zenodo archive. On the right side, you will see an individual DOI listed for each version released since v0.2.1. Just pick the DOI matching your version. Alternatively, you can also cite all versions of this library.

Owner

  • Name: Digital-C-Fiber
  • Login: Digital-C-Fiber
  • Kind: organization

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: PyDapsys
message: 'If you use this software, please cite it as below.'
type: software
authors:
  - family-names: Konradi
    given-names: Peter
    orcid: 'https://orcid.org/0000-0001-7755-0199'
  - family-names: Troglio
    given-names: Alina
    orcid: 'https://orcid.org/0000-0001-7770-4389'
  - family-names: Namer
    given-names: Barbara
    orcid: 'https://orcid.org/0000-0001-7500-2842'
  - family-names: Kutafina
    given-names: Ekaterina
    orcid: 'https://orcid.org/0000-0002-3430-5123'
identifiers:
  - type: doi
    value: 10.5281/zenodo.7970520
    description: Repository DOI (all versions)
repository-code: 'https://github.com/Digital-C-Fiber/PyDapsys'
url: 'https://github.com/Digital-C-Fiber/PyDapsys'
repository-artifact: 'https://pypi.org/project/pydapsys/'
keywords:
  - neurophysiology
  - microneurography
  - open data
license: BSD-3-Clause
commit: 4b2a8a3c937bb967f29a4d3f666cac2338327f6e
version: 0.2.1
date-released: '2023-05-25'
preferred-citation:
  type: article
  title: "PyDapsys: an open-source library for accessing electrophysiology data recorded with DAPSYS"
  journal: Frontiers in Neuroinformatics
  volume: 17
  month: 9
  year: 2023
  identifiers:
  - type: doi
    value: 10.3389/fninf.2023.1250260
  authors:
  - family-names: Konradi
    given-names: Peter
    orcid: 'https://orcid.org/0000-0001-7755-0199'
  - family-names: Troglio
    given-names: Alina
    orcid: 'https://orcid.org/0000-0001-7770-4389'
  - family-names: Perez Garriga
    given-names: Ariadna
    orcid: 'https://orcid.org/0000-0001-8840-1770'
  - family-names: Pérez Martín
    given-names: Aarón
    orcid: 'https://orcid.org/0000-0001-6741-1435'
  - family-names: Röhrig
    given-names: Rainer
    orcid: 'https://orcid.org/0000-0002-0032-5118'
  - family-names: Namer
    given-names: Barbara
    orcid: 'https://orcid.org/0000-0001-7500-2842'
  - family-names: Kutafina
    given-names: Ekaterina
    orcid: 'https://orcid.org/0000-0002-3430-5123'

GitHub Events

Total
  • Fork event: 1
Last Year
  • Fork event: 1

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 4
  • Average time to close issues: N/A
  • Average time to close pull requests: about 23 hours
  • Total issue authors: 0
  • Total pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • codingchipmunk (3)
  • alinatroglio (1)
Top Labels
Issue Labels
Pull Request Labels
bug (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 35 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 6
  • Total maintainers: 2
pypi.org: pydapsys

Read recordings made with DAPSYS

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 35 Last month
Rankings
Dependent packages count: 7.0%
Downloads: 17.5%
Average: 18.3%
Dependent repos count: 30.5%
Maintainers (2)
Last synced: 11 months ago

Dependencies

pyproject.toml pypi
  • neo ^0.11.1
  • numpy ^1.21
  • python ^3.8