Skip to main content

EGI PyNetStation

egi-pynetstation sends event markers from Python to EGI Net Station / Amp Server Pro through the Experimental Control Interface (ECI).

Install

pip install egi-pynetstation

For a development checkout:

git clone https://github.com/nimh-sfim/egi-pynetstation.git
cd egi-pynetstation
pip install -e .

The five commands

from egi_pynetstation import NetStation

ns = NetStation('10.10.10.42', 55513)

ns.connect(ntp_ip='10.10.10.51')
ns.begin_rec()
ns.send_event(event_type='stim')
ns.end_rec()
ns.disconnect()

That is the complete lifecycle for most experiments:

  1. connect() opens ECI and starts background clock sampling.
  2. begin_rec() starts a recording and synchronizes its timestamp epoch.
  3. send_event() timestamps and queues an event marker.
  4. end_rec() flushes queued events and stops the recording.
  5. disconnect() closes ECI and its background workers.

Timing validation

Run a photocell timing test once for every experiment and physical setup:

python example5_psychopy_photocell_drift.py amp --fullscreen \
  --log timing.csv --error-log timing_errors.jsonl \
  --frame-interval-log timing_frames.csv

Also verify local clock precision:

python -m egi_pynetstation.check_clocks

The ordinary drift model uses at least 13 samples spanning 180 seconds. If the photocell test shows meaningful startup drift, either connect earlier so the model can collect evidence before begin_rec(), or enable the optional provisional model:

ns.connect(ntp_ip='10.10.10.51', drift_warmup=True)

The provisional model can engage after five samples spanning 20 seconds and permanently hands off to the ordinary model when it is ready. Validate the choice on the actual stimulus computer, display, network, and amplifier used for the experiment.

See the Timing Test and Advanced guide for the full procedure.

PsychoPy

Mark the flip that presents a stimulus:

stim.draw()
win.callOnFlip(ns.send_event, event_type='stim')
win.flip()

send_event() captures the time immediately and performs network I/O on a worker thread, so it is safe to use in a flip callback.

Documentation

Run the timing test once for every experiment and physical setup before collecting data. At the end of a validation or production run, inspect ns.session_summary().

License

This software is a United States Government Work. See LICENSE.

Metadata

Release files for egi_pynetstation 2.1.0

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

Source distribution (sdist)

Source distribution for egi_pynetstation 2.1.0
File Size Uploaded
egi_pynetstation-2.1.0.tar.gz 96.9 kB Details

Built distribution (wheel)

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

Total release size: 204.2 kB

Release files / egi_pynetstation-2.1.0.tar.gz

Download URL egi_pynetstation-2.1.0.tar.gz
Size 96.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3d62b45bdf69033f19058cd6a2c10f8bda1a8b57b329e20400837a35d74c407a
BLAKE2b-256 checksum
How to use checksums
3e63a0178e68c498433129c0488b97f0731230dd9373f0f0fcfdddf0b5920777
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.2 CPython/3.13.7 Darwin/25.6.0

Release files / egi_pynetstation-2.1.0-py3-none-any.whl

Download URL egi_pynetstation-2.1.0-py3-none-any.whl
Size 107.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
354a852fe528151453d1273c09bf1357a46269e8d4f369d9f09f8dd48075dae4
BLAKE2b-256 checksum
How to use checksums
52d8d7de64dd9236577382bf60244d9ebfef55cd48ac2693f6258d6a3ac84f6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.2 CPython/3.13.7 Darwin/25.6.0

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

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