essfile
Pure Python reader and analysis tools for dserv ESS experiment log files.
Installation
pip install essfile
This installs essfile with numpy and dgread (for stimulus parameter decoding).
For pandas DataFrame support:
pip install essfile[pandas]
Quick Start
Inspect an ESS file from the command line
essread session.ess
essread session.ess --raw # show flat datapoint stream
Read in Python
from essfile import ESSFile
f = ESSFile('session.ess')
print(f.identity) # {'ess': 'hapticvis', 'subject': 'human', ...}
print(f.params) # {'stim_duration': '30000', ...}
print(f.n_obs) # 12
print(f.stimdg) # dict of numpy arrays (stimulus parameters)
Extract trials
from essfile import ESSFile
from essfile.extract.hapticvis import extract_trials
f = ESSFile('session.ess')
trials = extract_trials(f)
print(trials['rt']) # reaction times
print(trials['correct']) # 0/1 accuracy
# Convert to DataFrame
import pandas as pd
df = pd.DataFrame(trials)
Low-level access
from essfile import read_dslog, read_ess
# Flat datapoint stream (varname, timestamp, vals columns)
d = read_dslog('session.ess')
# Obs-period oriented with parsed preamble
ess = read_ess('session.ess')
Architecture
The package has three layers:
| Layer | Function | Description |
|---|---|---|
essread |
read_dslog() |
Binary parser → flat datapoint stream |
essread |
read_ess() |
Segments into obs periods, parses preamble |
essfile |
ESSFile |
Event query API (select, sparse, nested) |
extract.* |
extract_trials() |
System-specific trial extraction |
ESSFile API
The ESSFile class provides methods matching the Tcl df::File API:
f = ESSFile('session.ess')
# Event selection (returns list of bool arrays, one per obs)
mask = f.select_evt('ENDTRIAL')
mask = f.select_evt('STIMULUS', 'ON')
# Sparse extraction (one value per trial, fill=-1 if missing)
valid = np.where(some_condition)[0]
times = f.event_time_sparse(valid, 'RESP')
params = f.event_param_sparse(valid, 'STIMTYPE')
subtypes = f.event_subtype_sparse(valid, 'ENDTRIAL')
# Nested extraction (variable count per trial)
decide_times = f.event_times_nested(valid, 'DECIDE', 'SELECT')
# Name lookups
f.type_id('ENDTRIAL') # -> 40
f.subtype_id('ENDTRIAL', 'CORRECT') # -> 1
f.has_event_type('CHOICES') # -> True
Writing Extractors
System-specific extractors live in essfile.extract. Each provides an
extract_trials(f) function that takes an ESSFile and returns a dict
of equal-length arrays (one entry per valid trial).
See essfile/extract/hapticvis.py for a complete example.
File Format
ESS files use the dslog binary format produced by dserv's logger:
- 16-byte header: magic
dslog, version, timestamp - Sequence of datapoint records: varname, timestamp, type, data
- Events encoded with type/subtype/puttype in a 4-byte union
- Pre-obs preamble contains event name tables, parameters, stimdg
Requirements
- Python ≥ 3.9
- numpy
- dgread (for stimulus parameter decoding)
- pandas (optional, for DataFrame conversion)
License
MIT
Metadata
Release files for essfile 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| essfile-0.3.4.tar.gz | 21.2 kB | Without provenance | Details for essfile-0.3.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| essfile-0.3.4-py3-none-any.whl | Python 3 | none | any | Details for essfile-0.3.4-py3-none-any.whl |
Total release size: 43.4 kB
Release files / essfile-0.3.4.tar.gz
| Download URL | essfile-0.3.4.tar.gz |
|---|---|
| Size | 21.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f84cd8bac068a166f0abbc3371b2bd0e54ce6d5af643214782cf33e4f0dfd3f7
|
|
BLAKE2b-256 checksum How to use checksums |
1602fa82b401e90a9ea22322eeb8f7eab87700e8727a4f69412606b19f9b2a94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.1
|
Release files / essfile-0.3.4-py3-none-any.whl
| Download URL | essfile-0.3.4-py3-none-any.whl |
|---|---|
| Size | 22.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5d06d22def973c901dca364dd971cbd1b460e5d507010d6878e1a0c272738fa9
|
|
BLAKE2b-256 checksum How to use checksums |
c52ca4f6570461cd55e823bb93f1fe65d310afbc78e2aa9d3d96afb36392971f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.1
|
Security for essfile 0.3.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.