Skip to main content

Sarmadtec NeuroPort driver for Fascin8/Ultim8 neuro headstages with faker mode for offline testing.

Project description

Sarmadtec NeuroPort Driver (pip package)

Python driver for Fascin8/Ultim8 neuro headstages with optional fake signal generation for offline testing. The code is packaged as sarmadtec_neuroport so it can be installed via pip and reused outside this GUI app.

Install locally

  • Editable/development install from this repo: pip install -e .
  • One-off install from a checkout or tarball: pip install .
  • Requires Python 3.8+ and pyserial (pulled in automatically).

Quickstart (faker mode)

from time import sleep
from sarmadtec_neuroport import Device

def on_data(samples):
    if samples:
        first = samples[0]
        print(f"{len(samples)} samples; seq={first[0]} channels={len(first)-1}")

device = Device(
    debug_mode=True,               # print driver logs
    faker=True,                    # built-in signal generator instead of hardware
    data_ready_callback=on_data,   # called when new samples arrive
    data_chunk=0,                  # 0=flush everything each callback
)

device.sampling_rate = 500        # 250/500/1000/2000 Hz
device.gain = 24                  # ADS1299 gain setting for primary channels
device.exgain = 24                # gain for extra channels
device.leadoffMode = True         # enable lead-off detection

device.configure_settings()       # push settings to device (no-op for faker)
device.start()                    # begin streaming
sleep(3)
device.stop()
device.shutdown()                 # cleanly close worker threads/serial port

Run python examples/basic_usage.py --faker --duration 3 for a ready-made script. Drop --faker to talk to real hardware over USB/serial.

Real hardware notes

  • Plug in the Fascin8/Ultim8 so the OS exposes a CDC/serial port (Mac: /dev/tty.*, Windows: COMx).
  • The driver auto-scans for descriptors containing “USB Serial Device” or “STM32 Virtual ComPort”.
  • You can observe connection changes by registering connection_state_callback:
    Device(connection_state_callback=lambda connected, port, reason: print(connected, port, reason))
    
  • Call reset_device() to force a reconnect/re-handshake without recreating the object.

API cheat sheet

  • Device(debug_mode=False, data_ready_callback=None, settings_written_callback=None, data_chunk=0, faker=False, faker_data=None, connection_state_callback=None, connection_check_interval=1.0)
    • Instantiation starts internal I/O + watchdog threads and kicks off connect_async().
    • faker=True bypasses serial I/O and emits synthetic samples; optionally replay faker_data (list of channel-value lists).
    • data_chunk=0 flushes all buffered samples per callback; otherwise batches that many.
  • Core methods:
    • connect_async(force=False) / reset_device() — handshake with the headstage.
    • configure_settings() — send current sampling/gain/lead-off/channel flags.
    • start() / stop() — start/stop streaming; parsed samples surface via callbacks or get_data().
    • set_signal_generator_mode(enabled, faker_data=None) — toggle faker mode on an existing instance.
    • set_data_ready_callback(cb) / set_connection_state_callback(cb) — register runtime callbacks.
    • shutdown() — close serial, stop worker threads/watchdog, and reset state.

Samples are parsed as Python lists: [sequence, ch1, ch2, ...] (Fascin8 produces 21 primary + 3 extra channels; Ultim8 produces 8 primary).

Build and publish a wheel/sdist

python -m pip install --upgrade build twine
python -m build            # creates dist/*.whl and dist/*.tar.gz
# twine upload dist/*      # push to PyPI when ready

That is all that is needed to ship the driver as a pip package. Update the version in pyproject.toml and neuroport_driver/__init__.py before publishing new releases.

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

sarmadtec_neuroport-0.1.0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sarmadtec_neuroport-0.1.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file sarmadtec_neuroport-0.1.0.tar.gz.

File metadata

  • Download URL: sarmadtec_neuroport-0.1.0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for sarmadtec_neuroport-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7952aa52f122e417718204f0c06343de48909a07397c69a20a66d1ebd1bed062
MD5 3d47065d2e2e4650bf5e04eb7c347f9d
BLAKE2b-256 979068c8deed35d23c0b468a4cfda2375cb008f472251659fff37e936889fa0f

See more details on using hashes here.

File details

Details for the file sarmadtec_neuroport-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sarmadtec_neuroport-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b99abd322fb5d214f399e626a910c981fc1e152948efd7fdce19435a2c40390
MD5 a92726afbdb7c5b3da810bc73ffc42c4
BLAKE2b-256 f024857bc01e923f9d0e9040e11dc55c6496cae055deac4e1daa2255d7691ac4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page