Skip to main content

A toolkit for processing and analyzing physiological signals

Project description

FRENZ TOOLKIT

The Frenz Streaming Toolkit enables scientists to stream data from the Frenz Brainband to their laptop or PC, facilitating the development of custom applications. It provides access to distinct brain signals, offering a valuable alternative to PSG, the gold standard in brain signal recording. [1].

I. Getting started

You can install the Frenz Streaming Toolkit on your PC using pip:

pip install frenztoolkit

Alternatively, you can download the package and build it from source.

Product Key Requirement

A valid product key is required to use the toolkit. Please contact our sales department to obtain your product key.

System Requirements

Before using the toolkit, ensure you have the following:

  • A Frenz Brainband
  • A laptop (Mac/Windows/Linux) with Bluetooth and internet connectivity
  • A product key (contact Earable’s sales department if you don’t have one)

II. Connecting to Your Device

To connect your Frenz Brainband, you first need to identify its Bluetooth ID. The toolkit provides a Scanner utility to help you retrieve this ID.

Scanning for Available Devices

from frenztoolkit import Scanner

scanner = Scanner()
print(scanner.scan())

Example Output:

["DEVICE_1", "DEVICE_2", "DEVICE_3"]

This function returns a list of available Frenz Brainbands that are not currently connected to any phone or laptop.

III. Start your session

Once you have the band’s Bluetooth ID, you can start your session.

Refer to the following code snippets for guidance on how to:

  • Connect to a Frenz Brainband
  • Start a session
  • Access real-time data
  • Stop a session
import time
from frenztoolkit import Streamer

PRODUCT_KEY = "YOUR_PRODUCT_KEY"
DEVICE_ID = "YOUR_BRAIN_BAND_BLUETOOTH_ID"

# START A SESSION
# Config your streamer
streamer = Streamer(
		device_id = DEVICE_ID, 
    product_key = PRODUCT_KEY,
    data_folder = "./" # The folder stored your 
										   # session data when it be completed
)

# Start a session
streamer.start()

# ACCESS TO DATA
# When the session sucessfully started, 
# you can access to the raw brain signals.
# This is a array shape [4, N] where stored 
# data of 4 channels from the band with ordered
# LF, RF, OTEL, OTER; and the data are continuously
# added to the END of the array.
streamer.DATA["RAW"]["EEG"]

# You also can access to the filtered signals, which have
# applied power-line noise, propriate band-pass filter to 
# remove noises from the signals. 
# The filtered signals is much better for human to read 
# dirrectly.
# The data are continuously added to the END of the array.
streamer.DATA["FILTERED"]["EEG"]

# Similary, you can access to the IMU signals, 
# which is recorded from the IMU sensor.
# The data have a shape of [6, M], stored 6 channels of
# data accordingly: x, y, z, gx, gy, gz; 
# where x, y, z: accelerometers
# and gx, gy, gz: gyroscopes
# The data are continuously added to the END of the array.
streamer.DATA["RAW"]["IMU"]

# You can access to the PPG signals:
# which have shape [3, K], stored data of 3 channel:
# GREEN, RED, INFRARED
# The data are continuously added to the END of the array.
streamer.DATA["RAW"]["PPG"]

# You also can access to the calculated scores
# from our machine learning models:

# POAS: probability of falling asleep
# Shape: [1, N], calculated for every 30 second
# Value: from 0-1
# The data are continuously added to the END of the array.
streamer.SCORES["POAS"]

# posture: posture
# Shape: [1, N], calculated for every 4 second
# The data are continuously added to the END of the array.
streamer.SCORES["posture"]

# eye_gesture
# Shape: [1, N], calculated for every 1 second
# The data are continuously added to the END of the array.
streamer.SCORES["eye_gesture"]

# eye_blink
# Shape: [1, N], calculated for every 1 second
# The data are continuously added to the END of the array.
streamer.SCORES["eye_blink"]

# emg_event_channel
# Shape: [1, N], calculated for every 1 second
# The data are continuously added to the END of the array.
streamer.SCORES["emg_event_channel"]

# To be updated: We still have many more scores.

# STOP YOUR SESSION
# Limit your session by durration
while True:
    if streamer.session_dur > 1000:
        streamer.stop()
        break 
    # YOUR CAN DO SOMETHING WITH THE REALTIME STREAMING DATA HERE
    time.sleep(1)

# Or press[CTRL + Q] for window or [CMD+Q] For Mac to quit the session.
# When the session stoped, raw signals and scores will be stored in the 
# data_folder folder.

Reference

[1] Nguyen, A., Pogoncheff, G., Dong, B.X. et al. A comprehensive study on the efficacy of a wearable sleep aid device featuring closed-loop real-time acoustic stimulation. Sci Rep 13, 17515 (2023). https://doi.org/10.1038/s41598-023-43975-1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

frenztoolkit-0.1.6-py3-none-any.whl (5.8 MB view details)

Uploaded Python 3

File details

Details for the file frenztoolkit-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: frenztoolkit-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 5.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for frenztoolkit-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4ec5d1fd05a315529940ed5a1c47887adbb6f9f33a1fabad9e9a08079cb2bef3
MD5 f3a4112d9516f93c5c6d216f2af3c920
BLAKE2b-256 e20d46297c2f0860ad555d19fff14dfbe4f9ec26335c700b2a816027e9956663

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