Skip to content

mirrornode/INPphase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

INPphase

Reorganizing Old Transient Adaptations Neurologically

React frontend for visualizing dynamical system data from a Python WebSocket backend.

Setup

  1. Install dependencies:

    npm install
    # or
    yarn install
  2. Start the development server:

    npm run dev
    # or
    yarn dev

WebSocket Protocol

The frontend communicates with the Python backend using WebSocket messages in JSON format.

Message Types

Frontend → Backend

  1. Configuration:
{
  "type": "config",
  "payload": {
    "sampleRate": 50,
    "bufferSize": 400,
    "poincarePoints": 200
  }
}
  1. Commands:
{
  "type": "command",
  "payload": {
    "action": "reset"
  }
}
  1. Disconnect:
{
  "type": "disconnect",
  "payload": {
    "reason": "user_initiated"
  }
}

Backend → Frontend

  1. State Update:
{
  "type": "state",
  "payload": {
    "tau": number,
    "phi": number,
    "energy": number,
    "field": [number, number, number],
    "velocities": [number, number, number]
  }
}
  1. Phase Data:
{
  "type": "phase",
  "payload": {
    "tau": number,
    "x0": number,
    "v0": number,
    "x1": number,
    "v1": number,
    "x2": number,
    "v2": number
  }
}
  1. Poincaré Data:
{
  "type": "poincare",
  "payload": {
    "x": number,
    "v": number
  }
}
  1. Spectrum Data:
{
  "type": "spectrum",
  "payload": [{
    "freq": number,
    "magnitude": number,
    "db": number
  }]
}
  1. Error:
{
  "type": "error",
  "payload": {
    "message": string
  }
}

Component Usage

Import and use the RotanBridge component in your React application:

import RotanBridge from './components/RotanBridge';

function App() {
  return (
    <div>
      <RotanBridge />
    </div>
  );
}

The component handles WebSocket connection management, data visualization, and system state automatically. Make sure your Python backend is running on ws://localhost:8765 before connecting.

Features

  • Real-time visualization of dynamical system data
  • Phase space trajectories
  • Poincaré sections
  • Frequency spectrum analysis
  • Protocol logging
  • Automatic reconnection
  • Graceful error handling

About

Reorganizing Old Transient Adaptations Neurologically

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published