diff --git a/biosignals.bat b/biosignals.bat new file mode 100644 index 0000000..b94e080 --- /dev/null +++ b/biosignals.bat @@ -0,0 +1,5 @@ +@ECHO on +call C:\Users\MTG-user\anaconda3\Scripts\activate.bat activate art-bio +cd C:\Users\MTG-user\Desktop\art-bio-biosignalsplux +python art-bio.py -d biosignalsplux -c reeg ws -c recg ws -c reda ws -c reeg file -c recg file -c reda file --filename readings.txt +PAUSE \ No newline at end of file diff --git a/examples/banana_demo/heart.png b/examples/banana_demo/heart.png new file mode 100644 index 0000000..28dced8 Binary files /dev/null and b/examples/banana_demo/heart.png differ diff --git a/examples/banana_demo/lungs1.png b/examples/banana_demo/lungs1.png new file mode 100644 index 0000000..ea2904b Binary files /dev/null and b/examples/banana_demo/lungs1.png differ diff --git a/examples/banana_demo/visualize_biosignals.html b/examples/banana_demo/visualize_biosignals.html new file mode 100644 index 0000000..14a4019 --- /dev/null +++ b/examples/banana_demo/visualize_biosignals.html @@ -0,0 +1,422 @@ + + + + Raw data visualizer + + + + + +
La sesión ha iniciado.
+ +
+ +

Ritmo cardíaco

+ +

Respiración

+ + +

Alpha

+ + +
+
+ + + + + + + diff --git a/router.py b/router.py index 7254a09..7eae571 100644 --- a/router.py +++ b/router.py @@ -20,6 +20,9 @@ def digital_out(): pass self.digital_out_func = digital_out + #self.current_time = time.time() + self.ini_time = 0 + def init_destinations(self, connections): destinations = [] @@ -32,22 +35,30 @@ def init_destinations(self, connections): self.osc_client = udp_client.SimpleUDPClient(address_port[0], int(address_port[1])) if 'file' in destinations: self.file_handle = open(self.filename, 'w') - print("initializing file " + self.filename) + print("initializing file" + self.filename) + + self.ini_time = time.time() + self.file_handle.write('{}: {}\n'.format('initial time',self.ini_time)) + + if 'ws' in destinations: self.ws_server = WSServer(self.ws_port) def route_data(self, source, connections, features, raw_data): source_connections = [] + + current_time = time.time() + if source in connections: source_connections += connections[source] - current_time = time.time() - + + # raw data if 'r' + source in connections: source_connections += connections['r' + source] - for destination in connections['r' + source]: + for destination in connections['r' + source]: for i, channel in enumerate(raw_data): src = source if i > 0: @@ -59,7 +70,7 @@ def route_data(self, source, connections, features, raw_data): osc_address = self.osc_prefix + osc_dest self.osc_client.send_message(osc_address, data) elif destination == 'file': - self.file_handle.write('{} {}: {}\n'.format(current_time, osc_dest, str(raw_data))) + self.file_handle.write('{} {}: {}\n'.format(current_time-self.ini_time, osc_dest, str(raw_data))) elif destination == 'ws': self.ws_server.add_message('{}|{}/{}'.format(current_time, osc_dest, str(raw_data))) @@ -78,12 +89,9 @@ def route_data(self, source, connections, features, raw_data): if destination == 'osc': self.osc_client.send_message(self.osc_prefix + osc_dest, data) elif destination == 'file': - self.file_handle.write('{} {}: {}\n'.format(current_time, osc_dest, str(data))) + self.file_handle.write('{} {}: {}\n'.format(current_time-self.ini_time, osc_dest, str(data))) elif destination == 'ws': self.ws_server.add_message('{}|{}/{}'.format(current_time, osc_dest, str(data))) elif destination == 'digital': if self.digital_out_func: self.digital_out_func() - - -