source: trunk/synapse/Puzzlebox/Synapse/Configuration.py @ 174

Last change on this file since 174 was 174, checked in by sc, 11 years ago

synapse/Puzzlebox/Synapse/Interface_Design.py:

  • tabCharts added

synapse/Puzzlebox/Synapse/Interface_Plot.py:

  • class chartEEGMatplotlibCanvas added
  • rawEEG wave graph labels fixed

synapse/Puzzlebox/Synapse/Interface.py:

  • tabCharts added for graphing eSense and EEG Power bands

synapse/Puzzlebox/Synapse/Configuration.py:

  • INTERFACE_CHART_STYLES values added
File size: 6.1 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4# Copyright Puzzlebox Productions, LLC (2010)
5#
6# This code is released under the GNU Pulic License (GPL) version 2
7# For more information please refer to http://www.gnu.org/copyleft/gpl.html
8
9__changelog__ = """\
10Last Update: 2010.08.09
11
12"""
13
14import os, sys
15
16#####################################################################
17# General configuration
18#####################################################################
19
20DEBUG = 1
21
22CONFIGURATION_FILE_PATH = 'puzzlebox_synapse_configuration.ini'
23
24if (sys.platform != 'win32'):
25        if not os.path.exists(CONFIGURATION_FILE_PATH):
26                CONFIGURATION_FILE_PATH = \
27                        os.path.join('/etc/puzzlebox_synapse', CONFIGURATION_FILE_PATH)
28
29INTERFACE_CHART_STYLES = { \
30        'attention': 'r-', \
31        'meditation': 'b-', \
32        'delta': 'g-', \
33        'theta': 'y-', \
34        'lowAlpha': 'c-', \
35        'highAlpha': 'b-', \
36        'lowBeta': 'r-', \
37        'highBeta': 'm-', \
38        'lowGamma': 'k-', \
39        'highGamma': 'k-', \
40}
41
42#The following color abbreviations are supported:
43#character      color
44#‘b’        blue
45#‘g’        green
46#‘r’        red
47#‘c’        cyan
48#‘m’        magenta
49#‘y’        yellow
50#‘k’        black
51#‘w’        white
52
53#The following format string characters are accepted to control the line style or marker:
54#character      description
55#'-'    solid line style
56#'--'   dashed line style
57#'-.'   dash-dot line style
58#':'    dotted line style
59#'.'    point marker
60#','    pixel marker
61#'o'    circle marker
62#'v'    triangle_down marker
63#'^'    triangle_up marker
64#'<'    triangle_left marker
65#'>'    triangle_right marker
66#'1'    tri_down marker
67#'2'    tri_up marker
68#'3'    tri_left marker
69#'4'    tri_right marker
70#'s'    square marker
71#'p'    pentagon marker
72#'*'    star marker
73#'h'    hexagon1 marker
74#'H'    hexagon2 marker
75#'+'    plus marker
76#'x'    x marker
77#'D'    diamond marker
78#'d'    thin_diamond marker
79#'|'    vline marker
80#'_'    hline marker
81
82
83#####################################################################
84# Network addresses
85#####################################################################
86
87THINKGEAR_SERVER_INTERFACE = '' # listen on all of server's network interfaces
88#THINKGEAR_SERVER_HOST = '127.0.0.1'
89THINKGEAR_SERVER_HOST = '*'
90THINKGEAR_SERVER_PORT = 13854
91
92
93#####################################################################
94# ThinkGear Device configuration
95#####################################################################
96
97DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_WINDOWS = 'COM2'
98DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_LINUX = '/dev/rfcomm0'
99
100if (sys.platform == 'win32'):
101        THINKGEAR_DEVICE_SERIAL_PORT = DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_WINDOWS
102else:
103        THINKGEAR_DEVICE_SERIAL_PORT = DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_LINUX
104
105# Use Bluetooth MAC address for Linux
106THINKGEAR_DEVICE_BLUETOOTH_ADDRESS = ''
107# THINKGEAR_DEVICE_BLUETOOTH_ADDRESS = '00:13:EF:xx:xx:xx' # Linux example
108
109
110#####################################################################
111# Server configuration
112#####################################################################
113
114CLIENT_NO_REPLY_WAIT = 5 # how many seconds before considering a component dead
115
116
117#####################################################################
118# ThinkGear Connect configuration
119#####################################################################
120
121THINKGEAR_DELIMITER = '\r'
122
123THINKGEAR_CONFIGURATION_PARAMETERS = {"enableRawOutput": False, "format": "Json"}
124
125ENABLE_THINKGEAR_AUTHORIZATION = False
126
127THINKGEAR_AUTHORIZATION_REQUEST = { \
128        "appName": "Puzzlebox Brainstorms", \
129        "appKey": "2e285d7bd5565c0ea73e7e265c73f0691d932408"
130        }
131
132THINKGEAR_EEG_POWER_BAND_ORDER = ['delta', \
133                                  'theta', \
134                                  'lowAlpha', \
135                                  'highAlpha', \
136                                  'lowBeta', \
137                                  'highBeta', \
138                                  'lowGamma', \
139                                  'highGamma']
140
141THINKGEAR_EMULATION_MAX_ESENSE_VALUE = 100
142THINKGEAR_EMULATION_MAX_EEG_POWER_VALUE = 16384
143
144THINKGEAR_ATTENTION_MULTIPLIER = 1.0
145THINKGEAR_MEDITATION_MULTIPLIER = 1.0
146
147THINKGEAR_EEG_POWER_MULTIPLIERS = { \
148        'delta': 1.0, \
149        'theta': 1.0, \
150        'lowAlpha': 1.0, \
151        'highAlpha': 1.0, \
152        'lowBeta': 1.0, \
153        'highBeta': 1.0, \
154        'lowGamma': 1.0, \
155        'highGamma': 1.0, \
156}
157
158
159#####################################################################
160# ThinkGear Connect Server Emulator configuration
161#####################################################################
162
163THINKGEAR_ENABLE_SIMULATE_HEADSET_DATA = True
164
165THINKGEAR_BLINK_FREQUENCY_TIMER = 6 # blink every 6 seconds
166                                    # (6 seconds is listed by Wikipedia
167                                    # as being the average number of times
168                                    # an adult blinks in a laboratory setting)
169
170THINKGEAR_DEFAULT_SAMPLE_WAVELENGTH = 30 # number of seconds from 0 to max
171                                         # and back to 0 for any given
172                                         # detection value below
173
174
175#####################################################################
176# Flash socket policy handling
177#####################################################################
178
179FLASH_POLICY_FILE_REQUEST = \
180        '<policy-file-request/>%c' % 0 # NULL byte termination
181FLASH_SOCKET_POLICY_FILE = '''<?xml version="1.0"?>
182<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
183<cross-domain-policy>
184   <site-control permitted-cross-domain-policies="all" />
185   <allow-access-from domain="*" to-ports="%i" />
186</cross-domain-policy>%c''' % (THINKGEAR_SERVER_PORT, 0)
187
188
189#####################################################################
190# Configuration File Parser
191#####################################################################
192
193if os.path.exists(CONFIGURATION_FILE_PATH):
194       
195        file = open(CONFIGURATION_FILE_PATH, 'r')
196       
197        for line in file.readlines():
198                line = line.strip()
199                if len(line) == 0:
200                        continue
201                if line[0] == '#':
202                        continue
203                if line.find('=') == -1:
204                        continue
205                if (line == "THINKGEAR_DEVICE_SERIAL_PORT = ''"):
206                        # use operating system default if device not set manually
207                        continue
208                try:
209                        exec line
210                except:
211                        if DEBUG:
212                                print "Error recognizing configuration option:",
213                                print line
214
Note: See TracBrowser for help on using the repository browser.