Skip to main content

Add your description here

Project description

TokEye Logo

TokEye

Python package

TokEye is a open-source Python-based application for automatic classification and localization of fluctuating signals. It is designed to be used in the context of plasma physics, but can be used for any type of fluctuating signal.

Check out this poster from APS DPP 2025 or this preprint for more information.

Example Demonstration

Expected processing time:

  • V100: < 0.5 seconds on any size spectrogram after warmup.
  • CPU: ~5-10 seconds.

Verified Datatypes

  • DIII-D Fast Magnetics (cite)
  • DIII-D CO2 Interferometer (cite)
  • DIII-D Electron Cyclotron Emission (cite)
  • DIII-D Beam Emission Spectroscopy (cite)

Evaluation

Recall Scores:

  • TJII2021: 0.8254
  • DCLDE2011 (Delphinus capensis): 0.7708
  • DCLDE2011 (Delphinus delphis): 0.7953

With more data, comes better models. Please contribute to the project!

Installation

uv (recommended)

git clone git@github.com:PlasmaControl/TokEye.git
cd TokEye
uv sync

pip (from PyPI)

pip install tokeye

pip (from source)

git clone git@github.com:PlasmaControl/TokEye.git
cd TokEye
python3 -m venv .venv
source venv/bin/activate
pip install uv
uv sync

Usage

python -m TokEye.app

This will start a web app on http://localhost:8888.

If you are on a remote server, you can use SSH port forwarding to access the web app on your local machine:

ssh -L 8888:localhost:7860 user@remote_server

Then open your web browser and navigate to http://localhost:8888.

Models

Pre-trained models are available at this link.

(soon to be deprecated) Pre-trained models are available at this link.

Copy them into the models/ directory after downloading them.

  • big_mode_v1.pt: Original training regime (window = 1024, hop = 128)
  • big_mode_v2.pt: Trained on multiscale (multiwindow, multihop) spectrograms
  • big_tf_unet_251210.pt: Trained on multiscale (multiwindow, multihop) spectrograms

Input should be a tensor that has shape (B, 1, H, W) where B, H, and W can vary Output will be a tensor of shape (B, 2, H, W)

Best performance when spectrograms are oriented so that when they are plotted with matplotlib, the lowest frequency bin is oriented with the bottom when origin='lower'. Spectrograms should be standardized (mean = 0, std = 1). If baseline activity is very strong, clipping the input may help, but is generally not needed.

The first channel of the output will return preferential measurements of coherent activity (useful for most tasks) THe second channel of the output will return preferential measurements of transient activity

Data

Right now, keep all data as 1d numpy float arrays. No need to normalize or preprocess them. Copy them into the data/ directory.

Citation

If you use this code in your research, please cite:

@article{chen_TokEye_2026,
  title={TokEye: Fast Signal Extraction for Fluctuating Time Series via Offline Self-Supervised Learning From Fusion Diagnostics to Bioacoustics},
  author={Chen, Nathaniel},
  year={2026},
  publisher={ArXiv},
  doi={10.48550/arXiv.2602.20317},
  url={https://www.arxiv.org/abs/2602.20317}
}

Contact

Please check back for updates or reach out to Nathaniel Chen at nathaniel [at] princeton [dot] edu.

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

tokeye-0.9.5.tar.gz (188.3 kB view details)

Uploaded Source

Built Distribution

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

tokeye-0.9.5-py3-none-any.whl (258.4 kB view details)

Uploaded Python 3

File details

Details for the file tokeye-0.9.5.tar.gz.

File metadata

  • Download URL: tokeye-0.9.5.tar.gz
  • Upload date:
  • Size: 188.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tokeye-0.9.5.tar.gz
Algorithm Hash digest
SHA256 57033a189e2e834fe2c9c137c7bee541e476cd3db7fad105cb3033b66088384f
MD5 eb6d11833b50c5946a4e20abee0fa189
BLAKE2b-256 4e28ca74cea3c98d5ce60b54d813adc4cff89b9549d33637c2ae70a19dc3da4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokeye-0.9.5.tar.gz:

Publisher: python-publish.yml on PlasmaControl/tokeye

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokeye-0.9.5-py3-none-any.whl.

File metadata

  • Download URL: tokeye-0.9.5-py3-none-any.whl
  • Upload date:
  • Size: 258.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tokeye-0.9.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3824e4a455a307ab2d52343a1dd693b3d7b5fbc9d4295fb6f984fb0060a17276
MD5 58e6b2071412c34ece63d139e002ac00
BLAKE2b-256 50750b647cd6d941d2ea9024bbf6813809ba27b61c8860ac27074a0fb4287bfc

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokeye-0.9.5-py3-none-any.whl:

Publisher: python-publish.yml on PlasmaControl/tokeye

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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