Git Product home page Git Product logo

tvnsrtools's Introduction

TVNS-R Tools

License

Version

The current version is 0.1. It has been tested, but not thoroughly so. Windows compatibility still needs testing.

This package was developed in a research setting. The developer is not associated with the device manufacturer (tVNS-R, tVNS technologies GmbH). Please take note of the disclaimer on the bottom of this readme.

Installation

Your OS needs Python >=3.8 installed. From the command line, use the following command:

pip install git+https://github.com/syntheticdinosaur/tvnsrtools.git

The command line tool 'tvnsMockServer' is also automatically installed.

Introduction

This Python package provides two components:

  1. TVNS Mock Server: A mock server that simulates an HTTP interface to control a tVNS-R device. It allows you to initiate treatment and stimulation commands with a specified failure probability. The server can be used via the command line.

  2. TVNS Manager Interface Module: This Python module allows communication with a tVNS-R Stimulator device via HTTP commands. It includes a Logger class for recording events with timestamps to a log file.

TVNS Mock Server

The TVNS Mock Server creates a mock server that simulates an HTTP interface for controlling a tVNS-R device. It provides the following functionality:

  • The server listens for HTTP POST requests with specific command bodies and responds accordingly.
  • Simulates failures with a specified probability for each command.
  • Command-line usage.

It responds to the HTTP Post requests as the tVNS-R decive would and can be used as a replacement while developing experiments.

Usage

After a successful install tvnsMockServer is available from the command line. Run the script with optional command-line arguments to set the port and failure probability.

Command-line Arguments

  • -p, --port: Port for the HTTP server (default: 51523).
  • -f, --failure-probability: Failure probability for tVNS-R commands (0.0 to 1.0, default: 0.0).

Example

To start the server on port 8080 with a 20% failure probability for commands:

tvnsMockServer --port 8080 --failure-probability 0.2

or, with identical meaning:

tvnsMockServer -p 8080 -f 0.2

TVNS Manager Interface Module

The TVNS Manager Interface Module allows communication with a tVNS-R Stimulator device via HTTP commands. It includes a Logger class for recording events with timestamps to a log file.

Usage

  1. Replace the tvns_manager_url variable with the actual URL where tVNS Manager is listening.
  2. Optionally, set the log_file_name variable to specify the log file name.
  3. Create an instance of the TVNSManager class and use its methods to interact with the tVNS device.

Example Usage

tvns_manager = TVNSManager(tvns_manager_url, log_file_name)
tvns_manager.initialize_connection()
tvns_manager.start_treatment()
tvns_manager.start_stimulation()
tvns_manager.stop_stimulation()
tvns_manager.stop_treatment()

Testing

A sample test script is included in the module to demonstrate the TVNS Manager Interface Module's usage. The test script initiates the connection, starts treatment, starts and stops stimulation, and performs a series of stimulation pulses.

License

This package is open-source and is provided under the MIT License. You are free to use, modify, and distribute it according to the terms of the license.

Author

  • Author: Joshua P. Woller

Acknowledgments

If this toolbox is useful for you, feel free to acknowledge it in a suitable way.


Disclaimer: This package is for research and testing purposes only. Use at your own risk, the software is provided as is. No liability is taken and no warranty given. It is strictly not intended for medical use, and any medical applications should be implemented with appropriate medical device certifications and regulatory approvals.

tvnsrtools's People

Contributors

syntheticdinosaur avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.