Browse Source

Dateien hochladen nach „“

master
Nicole Weber 2 years ago
parent
commit
8d132a63d2
4 changed files with 22 additions and 13 deletions
  1. 12
    5
      UIModellVisuell.py
  2. 9
    8
      dll.cpp
  3. BIN
      dll.so
  4. 1
    0
      start.sh

+ 12
- 5
UIModellVisuell.py View File

@@ -5,6 +5,7 @@ Das Visuelle Model steuert den Ablauf der aufrufe der Openvibe Funktionen fuer d
from subprocess import *
from threading import Thread
import time
import re

from UIModell import Modell

@@ -132,19 +133,20 @@ class ModellVisuell(Modell):
process = Popen(command, stdout=PIPE, universal_newlines=True)

self.openVibeAktiv = True
counter = 0
counter = 0
acc = 0
while True:
output = process.stdout.readline()
print(output.strip())
x = output.find("aka Classifier trainer")
accuracy = output.find("Training set accuracy is")
accuracy = output.find("Cross-validation test accuracy is ")
y = output.find("Error")
if(x != -1):
counter = counter +1
#counter = 18
if(counter >= 17):
print("Training finished")
self.controller.addInfoText('Beenden des Training\n')
self.controller.addInfoText('Beenden des Training (' + acc + ')\n')
process.terminate()
self.controller.stop("save")
break
@@ -154,8 +156,13 @@ class ModellVisuell(Modell):
self.controller.addInfoText("Fehler beim Classifier Training aufgetaucht\n")
process.terminate()
break
elif(accuracy != -1):
print("ACCURACY" + output)
if(accuracy != -1):
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
test = output.encode("windows-1252").decode("utf-8")
i = len("Cross-validation test")
acc_s = test[accuracy+i:accuracy+i+41].strip()
acc = ansi_escape.sub('', acc_s)
print(acc)
if not self.aktiv:
print("stop")
break

+ 9
- 8
dll.cpp View File

@@ -19,10 +19,10 @@ extern "C"{
string pathSpatialCFG_visuell = "Projekte/OpenVibe_THN-p300-bci-main/p300-visual/cfg/p300-spatial-filter.cfg";
string PATH_DEFAULT_visuell = "Projekte/OpenVibe_THN-p300-bci-main/p300-visual/datasets";

string fileCopySpellingVisuell = "p300-visual-1-acquisition.xml";
string filefreeSpellingVisuell = "p300-visual-4-online.xml";
string fileXDawnTrainingVisuell = "p300-visual-2-train-xDAWN.xml";
string fileClassifierTrainingVisuell = "p300-visual-3-train-classifier.xml";
string fileCopySpellingVisuell = "p300-xdawn-1-acquisition.xml";
string filefreeSpellingVisuell = "p300-xdawn-4-online.xml";
string fileXDawnTrainingVisuell = "p300-xdawn-2-train-xDAWN.xml";
string fileClassifierTrainingVisuell = "p300-xdawn-3-train-classifier.xml";

//taktil
//------------------------------------------------------------------------------------------------------------------------------------
@@ -70,7 +70,7 @@ extern "C"{
char* getCommandFreespellingVisuell()
{
string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append(config).append(" ").append(PATH_FILES_ConfigFile).append(" ").append( play).append(" ").append(PATH_FILES_Visual).append(filefreeSpellingVisuell).append(" ").append(nogui);
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES_Visual).append(filefreeSpellingVisuell).append(" ").append(nogui);
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
@@ -90,7 +90,7 @@ extern "C"{
char* getCommandCopyspellingVisuell()
{
string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append(config).append(" ").append(PATH_FILES_ConfigFile).append(" ").append( play).append(" ").append(PATH_FILES_Visual).append(fileCopySpellingVisuell).append(" ").append(nogui);
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES_Visual).append(fileCopySpellingVisuell).append(" ").append(nogui);
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
@@ -110,7 +110,7 @@ extern "C"{
char* getCommandXDawn_visuell()
{
string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append(config).append(" ").append(PATH_FILES_ConfigFile).append(" ").append( playFast).append(" ").append(PATH_FILES_Visual).append(fileXDawnTrainingVisuell).append(" ").append(nogui);
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( playFast).append(" ").append(PATH_FILES_Visual).append(fileXDawnTrainingVisuell).append(" ").append(nogui);
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
@@ -120,7 +120,7 @@ extern "C"{
char* getCommandClassifier_visuell()
{
string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append(config).append(" ").append(PATH_FILES_ConfigFile).append(" ").append( playFast).append(" ").append(PATH_FILES_Visual).append(fileClassifierTrainingVisuell).append(" ").append(nogui);
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( playFast).append(" ").append(PATH_FILES_Visual).append(fileClassifierTrainingVisuell).append(" ").append(nogui);
char char_array[s.length()+1];
strcpy(char_array, s.c_str());
char* s_convert = char_array;
@@ -136,6 +136,7 @@ extern "C"{
char* s_convert = char_array;
return s_convert;
}

char* getCommandStartAquisitionServer()
{

BIN
dll.so View File


+ 1
- 0
start.sh View File

@@ -6,3 +6,4 @@ cd ~/bci/
chmod +rw log.txt
./gui >> log.txt



Loading…
Cancel
Save