Read configuration from central configuration file.

This commit is contained in:
Achim D. Brucker 2025-03-02 15:16:24 +00:00
parent 86a5abd1b8
commit 2880cf3db3
6 changed files with 31 additions and 10 deletions

View File

@ -8,8 +8,12 @@ from yawning_titan.networks.node import Node
from logging import getLogger
# Constants
HOST = '172.16.12.69'
PORT = 2048
from yawning_titan_server.settings.base import BASE_DIR
import yaml
config = yaml.safe_load(open(BASE_DIR.parent.parent / "config.yaml"))
HOST = config['server']['host']
PORT = config['server']['port']
SPIKE_SIZE = struct.calcsize('<QB') # 9 bytes per spike
logger = getLogger(__name__)

View File

@ -11,8 +11,12 @@ from yawning_titan.envs.generic.core.network_interface import NetworkInterface
from yawning_titan.networks.node import Node
from logging import getLogger
HOST = "172.16.12.69"
PORT = 2048
from yawning_titan_server.settings.base import BASE_DIR
import yaml
config = yaml.safe_load(open(BASE_DIR.parent.parent / "config.yaml"))
HOST = config['server']['host']
PORT = config['server']['port']
SPIKE_SIZE = struct.calcsize("<QB") # 9 bytes per spike
# Define action channel ranges

View File

@ -9,8 +9,11 @@ import time
# Test script - takes spikes and timestamp into sb3 for AI training. Needs Neuron computer, jupyter neuron script runs 5 secs data then hands over to this script.
HOST = "172.16.12.69"
PORT = 2048
from yawning_titan_server.settings.base import BASE_DIR
import yaml
config = yaml.safe_load(open(BASE_DIR.parent.parent / "config.yaml"))
HOST = config['server']['host']
PORT = config['server']['port']
SPIKE_SIZE = struct.calcsize("<QB") # 9 bytes per spike

View File

@ -4,8 +4,11 @@ import struct
# Script for recieving basic timestamp and channel information, needs jupyter script on neuron computer.
HOST = "172.16.12.69"
PORT = 2048
from yawning_titan_server.settings.base import BASE_DIR
import yaml
config = yaml.safe_load(open(BASE_DIR.parent.parent / "config.yaml"))
HOST = config['server']['host']
PORT = config['server']['port']
SPIKE_SIZE = struct.calcsize("<QB") # 9 bytes per spike

View File

@ -3,8 +3,11 @@ import struct
# Script for recieving basic timestamp and channel information, needs jupyter script on neuron computer. Produces only one spike.
HOST = "172.16.12.69"
PORT = 2048
from yawning_titan_server.settings.base import BASE_DIR
import yaml
config = yaml.safe_load(open(BASE_DIR.parent.parent / "config.yaml"))
HOST = config['server']['host']
PORT = config['server']['port']
SPIKE_SIZE = struct.calcsize("<QB") # 9 bytes per spike

4
config.yaml Normal file
View File

@ -0,0 +1,4 @@
server:
# port: 172.16.12.69
host: 127.0.0.1
port: 2048