This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Unicorn2lsl streams data from a Unicorn Hybrid Black EEG system to LSL | |
# | |
# Copyright (C) 2022 Robert Oostenveld | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% | |
cfg = []; | |
cfg.layout = 'CTF275_helmet.mat'; | |
layout = ft_prepare_layout(cfg); | |
sel275 = {'MLC11', 'MLC12', 'MLC13', 'MLC14', 'MLC15', 'MLC16', 'MLC17', 'MLC21', 'MLC22', 'MLC23', 'MLC24', 'MLC25', 'MLC31', 'MLC32', 'MLC41', 'MLC42', 'MLC51', 'MLC52', 'MLC53', 'MLC54', 'MLC55', 'MLC61', 'MLC62', 'MLC63', 'MLF11', 'MLF12', 'MLF13', 'MLF14', 'MLF21', 'MLF22', 'MLF23', 'MLF24', 'MLF25', 'MLF31', 'MLF32', 'MLF33', 'MLF34', 'MLF35', 'MLF41', 'MLF42', 'MLF43', 'MLF44', 'MLF45', 'MLF46', 'MLF51', 'MLF52', 'MLF53', 'MLF54', 'MLF55', 'MLF56', 'MLF61', 'MLF62', 'MLF63', 'MLF64', 'MLF65', 'MLF66', 'MLF67', 'MLO11', 'MLO12', 'MLO13', 'MLO14', 'MLO21', 'MLO22', 'MLO23', 'MLO24', 'MLO31', 'MLO32', 'MLO33', 'MLO34', 'MLO41', 'MLO42', 'MLO43', 'MLO44', 'MLO51', 'MLO52', 'MLO53', 'MLP11', 'MLP12', 'MLP21', 'MLP22', 'MLP23', 'MLP31', 'MLP32', 'MLP33', 'MLP34', 'MLP35', 'MLP41', 'MLP42', 'MLP43', 'MLP44', 'MLP45', 'MLP51', 'MLP52', 'M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
filename = sys.argv[1] | |
f=open(filename,"rb") | |
s=f.read() | |
f.close() | |
s=s.replace(b'OLDSTRING',b'NEWSTRING') | |
f = open(filename, "wb") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
from EEGsynth import preprocessing, spectral, plotspectral, plotsignal, historycontrol, postprocessing | |
inipath = '/home/stephen/PycharmProjects/eegsynth/module/inputcontrol/' | |
patch = [] | |
patch.append(preprocessing(inifile=inipath + 'preprocessing.ini')) | |
patch.append(spectral(inifile=inipath + 'spectral.ini')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scale = prefixscale(old, new) | |
% PREFIXSCALE determines the scaling factor to convert an SI unit from one to another prefix | |
% | |
% For example | |
% prefixscale('kg', 'mg') | |
% returns 1000000. | |
% Copyright (C) 2019, Robert Oostenveld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function truncate(filename) | |
% TRUNCATE a file to 0 bytes, i.e. replace the file with an empty one | |
% | |
% Use as | |
% truncate(filename) | |
assert(exist(filename,'file'), 'file does not exists'); | |
fid = fopen(filename, 'w'); | |
fclose(fid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rename_brainvision_files(oldheaderfile, newheaderfile) | |
% RENAME_BRAINVISION_FILES renames a BrainVision EEG dataset, which consists of a vhdr header | |
% file, vmrk marker file and a data file that usually has the extension dat, eeg or seg. | |
% | |
% Use as | |
% rename_brainvision_files(oldname, newname) | |
% where both the old and the new filename should be strings corresponding to the | |
% header file, i.e. including the vhdr extension. | |
% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hdr = ft_read_header(filename, varargin) | |
filetype = ft_getopt(varargin, 'filetype'); | |
if isempty(filetype) | |
filetype = ft_filetype(filename); | |
end | |
switch filetype | |
case 'aaa': | |
% do whatever it used to be doing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [varargout] = example_format(varargin) | |
% EXAMPLE_FORMAT demonstrates the plugin format for the FieldTrip fileio module. | |
% | |
% Use as | |
% hdr = ft_read_data('test.mff', 'headerformat', 'example_format') | |
% dat = ft_read_data('test.mff', 'headerformat', 'example_format', 'dataformat', 'example_format') | |
st = dbstack; | |
if length(st)>1 && strcmp(st(2).name, 'ft_read_header') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int sockfd; | |
struct addrinfo hints, *servinfo, *p; | |
int rv; | |
memset(&hints, 0, sizeof hints); | |
hints.ai_family = AF_UNSPEC; // use AF_INET6 to force IPv6 | |
hints.ai_socktype = SOCK_STREAM; | |
if ((rv = getaddrinfo(host, "http", &hints, &servinfo)) != 0) { | |
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv)); |
NewerOlder