Skip to main content

toelis

ProjectStatus Version BuildStatus License PythonVersions

Toelis stands for Time Of Event LISt and refers to a type of data consisting of a series of events occurring at discrete times. Each event is associated with a specific channel (i.e. source), and trial (i.e. presentation of a stimulus or set of experimental conditions), and is defined by a positive or negative temporal from a defined reference time. This project (1) defines a file format for storing toelis data in plain text files (original developed by Amish Dave), and (2) contains a Python module with data structures for storing toelis data and functions for reading and writing files in the toelis format.

toelis files

Toelis files must be ISO-8859-1 or UTF-8 text encoding, and must have the format specified by the following ABNF grammar:

toelis-file   = num-channels NL num-trials NL *channel-index *channel
num-channels  = 1*DIGIT
num-reps      = 1*DIGIT
channel-index = 1*DIGIT NL           ; starting line for each channel
                                     ; number of channel-index items must equal num-channels
channel       = event-counts events
event-counts  = *(1*DIGIT NL)        ; number of events in each repetition
                                     ; number of event-count lines must equal num-reps
events        = *(time NL)
time          = [%x1D] 1*DIGIT [%x1E *DIGIT] ; floating point number
NL            = CR / CRLF / LF       ; all file encodings accepted

The time elements indicate a positive or temporal interval from an externally defined reference time (e.g., the onset of a stimulus), and should be in units of milliseconds.

Informally, the file consists of a series of integers and floating point numbers on separate lines. The first two lines give the number of channels and trials in the file. For each channel, there is a line giving the offset of the channel in the file. These offsets indicate the start of a block which begins with a series of integers giving the number of events in each trial, followed by a series of floating point numbers giving the time of the events. All channels must have the same number of trials.

python module

The toelis module requires numpy 1.19+ and has been tested on CPython 3.7-3.12 and PyPy 3.7-3.10. To install:

pip install toelis

Or to install from source:

python setup.py install

The module contains functions for reading and writing toelis files, as well as for manipulating toelis data, which are represented as lists of numpy arrays. The functions are well-documented within Python.

An example of loading two files, concatenating the trials, restricting the trials to a time window, and writing a new file. The functional programming style allows for compact, expressive syntax:

import toelis as tl

files = ('file1.toe_lis', 'file2.toe_lis')
t_merged = tl.merge(tl.read(open(fname, 'rU'))[0] for fname in files)
with open('merged.toe_lis', 'wt') as fp:
    tl.write(fp, tl.subrange(t_merge, 0, 1000))

acknowledgments and license

The toelis format was originally developed by Amish Dave (http://amishdave.net) for Dan Margoliash’s lab at the University of Chicago (http://margoliashlab.uchicago.edu). The formalized ABNF grammar and python implementation were written by Dan Meliza (http://meliza.org).

See COPYING for license information.

Release files for toelis 2.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for toelis 2.1.4
File Size Uploaded
toelis-2.1.4.tar.gz 8.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for toelis 2.1.4
File Interpreter ABI Platform
toelis-2.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 15.1 kB

Release files / toelis-2.1.4.tar.gz

Download URL toelis-2.1.4.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ee8eeb24a461a5cf5fb1259d14f1258719f812c3061d43a285e11422104f8a31
BLAKE2b-256 checksum
How to use checksums
b62f5391cbc0ed0755190b7ac504bdcab31f8159fb8362a036cc530f131bcbac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.9

Release files / toelis-2.1.4-py3-none-any.whl

Download URL toelis-2.1.4-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80cbb1259980f25d64e98c026717b9a17a3b88bbc2f4dd85e74f1223c05807fc
BLAKE2b-256 checksum
How to use checksums
6068e33e8913b8771f6cf9d56a9d5d5b13683a3e4708137626c26e1c1bcea623
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.9

Release history Release notifications | RSS feed

This release

2.1.4 This release

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page