Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New graph adds #5

Open
wants to merge 100 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
0f87c30
Fixed bugs, code now works
laurarodgers Jun 8, 2018
1529e87
Fixed buffer issue
laurarodgers Jun 8, 2018
4b14908
AA update
laurarodgers Jun 8, 2018
ef9a28a
logging enabled
Jun 13, 2018
b93a85c
logging pt
Jun 13, 2018
b9c57c3
added video sync
Jun 13, 2018
ab528b5
gitignore update
Jun 13, 2018
a479d20
editing video playback
Jun 13, 2018
3fd7705
video logging complete
Jun 13, 2018
30debba
logs are now csvs
Jun 13, 2018
c1d31ea
added video callback and joystick pre-vis logging
Jun 13, 2018
6cd6836
sensor now logging...again
Jun 13, 2018
6ad9794
working bar graph
Jun 13, 2018
a7bd592
added vis
Jun 14, 2018
5382563
readme update
Jun 14, 2018
bd0217f
readme update
Jun 14, 2018
6e71eb5
readme update
Jun 14, 2018
712a906
reorder csv
Jun 14, 2018
eef815d
vis 2
Jun 14, 2018
79a5a17
vis 2
Jun 14, 2018
01c045c
removed separate joystick update stream, set index joystick vals to u…
laurarodgers Jun 21, 2018
12986e1
put the gauge beside the thing
laurarodgers Jun 21, 2018
fe88b07
some layout changes
laurarodgers Jun 21, 2018
fd44fc9
alternate visualization so they don't have to move their eyes. less s…
laurarodgers Jun 21, 2018
4fa99b3
Merge pull request #1 from ubcspin/L_update_621
laurarodgers Jun 22, 2018
f25a3e9
has code to shift color
laurarodgers Jun 22, 2018
3ec234d
added test movie
laurarodgers Jun 22, 2018
26c0a33
changed video name
laurarodgers Jun 22, 2018
7ff9300
changed video file name
laurarodgers Jun 22, 2018
8bdb854
now there is a bar on the side
laurarodgers Jun 22, 2018
c71bcdc
Put the bar in the centre
laurarodgers Jun 26, 2018
19b9374
Merge pull request #2 from ubcspin/centred_bar
laurarodgers Jun 28, 2018
0d9dcac
Cleaned and updated, see extended
laurarodgers Jun 28, 2018
1cc6fce
Created css file with all necessary non-dynamic styles
laurarodgers Jun 28, 2018
9edeb37
Cleaned up api
laurarodgers Jun 28, 2018
fa8eade
Deleted unused jsx
laurarodgers Jun 28, 2018
acbb3ff
removed unused
laurarodgers Jun 28, 2018
a75a23d
removed unused
laurarodgers Jun 28, 2018
be1a54a
removed broken css ref, changed msg
laurarodgers Jun 28, 2018
2b38459
cleaned up and edited
laurarodgers Jun 28, 2018
3a9c5ca
new name for video
laurarodgers Jun 28, 2018
641cc95
Add files via upload
laurarodgers Jun 28, 2018
2d09c48
removed unused
laurarodgers Jun 28, 2018
74a7d66
removed incorrect
laurarodgers Jun 28, 2018
f50f62d
removed unused
laurarodgers Jun 28, 2018
c2219fc
removed unused
laurarodgers Jun 28, 2018
7b82ed0
Merge pull request #3 from ubcspin/clean_updated
laurarodgers Jun 28, 2018
c5ceecf
Added code to send sync signal to arduino
laurarodgers Jun 30, 2018
d6b7eae
added sync button sending signal to arduino
laurarodgers Jun 30, 2018
536c8b1
added sync button style
laurarodgers Jun 30, 2018
d7ea96f
stabilized joystick viz
laurarodgers Jul 3, 2018
9dbfbe8
cosmetic change to sync button
laurarodgers Jul 3, 2018
f1bb8a6
improved button
laurarodgers Jul 9, 2018
4953490
improved button
laurarodgers Jul 9, 2018
1f183ee
correct signal for reverse logic, no delay
laurarodgers Jul 9, 2018
b5e138b
commented
laurarodgers Jul 9, 2018
c632568
Merge pull request #4 from ubcspin/smoothing_and_sync
laurarodgers Jul 9, 2018
6dc41a6
added video time select
laurarodgers Jul 11, 2018
2eefb71
added video time selector
laurarodgers Jul 11, 2018
ff01221
Update styles.css
laurarodgers Jul 11, 2018
b3de3c5
better smoothing
laurarodgers Jul 12, 2018
7c033d3
turned off debug
laurarodgers Jul 12, 2018
b553c6f
Added delay for digital write
laurarodgers Jul 12, 2018
b0d8aa1
added preflight checklist
laurarodgers Aug 14, 2018
e480e62
added matlab scripts
laurarodgers Sep 1, 2018
916a350
updated matlab things
laurarodgers Sep 25, 2018
3e84d7e
all scripts updated, now they're better
laurarodgers Oct 5, 2018
720181b
added adding path
laurarodgers Oct 5, 2018
60f5d4b
now clears vars
laurarodgers Oct 5, 2018
0d58acf
Create readme
laurarodgers Oct 5, 2018
5d2e780
Updated readme
laurarodgers Oct 5, 2018
da10b8f
fixed mac issue on video excerpt
laurarodgers Oct 5, 2018
6a25e44
Merge branch 'master' of https://github.com/ubcspin/EEGTouch
laurarodgers Oct 5, 2018
06342e6
file change
laurarodgers Oct 5, 2018
8b06da0
fixed plot
laurarodgers Oct 5, 2018
a87be86
plot fsr and feeltrace is now way better
laurarodgers Oct 6, 2018
f278e8c
fixed axis problem
laurarodgers Oct 6, 2018
1bdb38f
now smooths feeltrace so it's less uggo
laurarodgers Oct 6, 2018
cc4224a
now prettier
laurarodgers Oct 6, 2018
4a03d36
Update matlab/fsr_gameplay_align.m
lauracang Oct 12, 2018
d19c74e
fixed eeg plot script, added fsr plot script
laurarodgers Oct 20, 2018
4600e48
overlay plot
laurarodgers Oct 26, 2018
d3f9206
fix empty feeltrace_data bug & save file after scripts
lauracang Oct 26, 2018
1b7b2cf
made graphing script tryagain better
laurarodgers Oct 31, 2018
0d1a987
fixed align invu and FINAL ver graph
laurarodgers Nov 2, 2018
c5d0da3
fixed again align_interview
laurarodgers Nov 2, 2018
6903563
saving final pre-invuticks
laurarodgers Nov 2, 2018
fe11118
FINAL FINAL plot, also fixed for empty invu timestamps)
laurarodgers Nov 3, 2018
25b997a
fixed interview empty stamps
laurarodgers Nov 3, 2018
66e93f2
fixed invu bug
laurarodgers Nov 7, 2018
cdb8daa
update
laurarodgers Jan 21, 2019
979c5e7
many refactors
laurarodgers Jan 23, 2019
89d8a34
refactor near completion
laurarodgers Jan 24, 2019
18b6471
fixed many problems
laurarodgers Jan 26, 2019
7ae9c93
Merge branch 'master' into new_graph_adds
laurarodgers Jan 26, 2019
0559170
slight changes
laurarodgers Jan 26, 2019
0302b3e
redo*
laurarodgers Jan 26, 2019
fd8db7b
a
laurarodgers Jan 26, 2019
d29cfa4
align interview
laurarodgers Jan 26, 2019
d094fd3
align interview
laurarodgers Jan 26, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
*/node_modules/*
*/localtest/*
*/localtest/*
*/logs/log_*
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@ to get the development server running. That should pop up a webpage to:
which will have the interface running.


To *rebuild* the the package for production-ready
-------------------------------------------------

`npm run build`


To run during session
---------------------

To run at `http://localhost:3000/` (note the different localhost port) for the gaming session, AFTER building, run:

`npm run server`


Logs
----

The server will always log to a new file every time it's run, named with the UNIX timestamp of when it started. They are under `../node/logs`.


Notes
=====

Expand Down
10 changes: 8 additions & 2 deletions arduino/fsr_test/fsr_test.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
http://www.arduino.cc/en/Tutorial/AnalogReadSerial
*/
// the setup routine runs once when you press reset:
int dPIN[5] = {12,11,9,8,7};
int dPIN[6] = {12,11,9,8,7,6};
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
Expand Down Expand Up @@ -48,6 +48,10 @@ void loop() {
// }
// digitalWrite(dPIN[4],HIGH);
int sensorValue4 = analogRead(A4);
delay(10);

int sensorValue5 = analogRead(A5);

// print out the value you read:
Serial.print(sensorValue0);
Serial.print("\t\t");
Expand All @@ -57,6 +61,8 @@ void loop() {
Serial.print("\t\t");
Serial.print(sensorValue3);
Serial.print("\t\t");
Serial.println(sensorValue4);
Serial.print(sensorValue4);
Serial.print("\t\t");
Serial.println(sensorValue5);
delay(10); // delay in between reads for stability
}
119 changes: 119 additions & 0 deletions matlab/align_interview.asv
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
%interview_filename = 'interview-17.csv';

%extract unique-timestamp interview data and timestamps
%and compile concise array
%name of interview file

%trial_directory = get_trial_directory();
%processed_directory = get_processed_directory();
%processed_data = get_processed_data();

trial_directory = get_trial_directory();
processed_directory = get_processed_directory();
processed_data = get_processed_data(processed_directory);

% if (~exist('processed_directory'))
% waitfor(warndlg('Unknown processed data directory. Please select processed data directory.'));
% processed_directory = uigetdir(path,"Select directory to save processed data in.");
% end
% if ~exist('aligned_data')
% data_file = dir(fullfile(processed_directory,'processed_data.mat'));
% if ~isempty(data_file)
% data_name = data_file.name;
% data_path = data_file.folder;
% else
% waitfor(warndlg('Unable to automatically locate processed data file for this trial. Please find it manually. The file is usually called processed_data.mat and in the processed data directory. If the data from this trial has not been processed, please process data instead of running this script alone.'));
% [data_name, data_path] = uigetfile('*.mat','Find processed data .mat file');
% isdlg = 'No';
% while (data_name(1) == 0) && strcmp(questdlg('No processed data matlab file was opened. If the data from this trial has not been processed, please process data instead of running this script alone. Do you want to keep looking for this file yourself?',''),'Yes')
% [data_name, data_path] = uigetfile('*.mat','Find processed data .mat file');
% end
% if data_name(1) == 0
% waitfor(errordlg('Aborting data processing: no processed data file'));
% throw(MException('Custom:Custom','Failure: unable to find processed data file to add interview timestamps to'));
% end
% end
%
% if ~contains(data_name,pathsep)
% data_name = fullfile(data_path,data_name);
% end
% load (data_name);
% end

lavell =

dir(fullfile(trial_directory,'interview*.csv'));
if ~isempty(interview_file)
interview_name = interview_file.name;
interview_path = interview_file.folder;
else
waitfor(warndlg('Unable to automatically locate interview data for this trial. Please find it manually. The file is usually called intervew-[number].csv and in the main trial directory.'));
[interview_name, interview_path] = uigetfile('*.csv','Find inteview csv');
isdlg = 'No';
while (interview_name(1) == 0) && strcmp(questdlg('No interview csv was opened. Do you want to keep looking for this file yourself?',''),'Yes')
[interview_name, interview_path] = uigetfile('*.csv','Find interview csv');
end
if interview_name(1) == 0
waitfor(errordlg('Aborting data processing: no valid interview csv file'));
throw(MException('Custom:Custom','Failure: unable to find valid interview csv file'));
end
end

if ~contains(interview_name,pathsep)
interview_name = fullfile(interview_path,interview_name);
end

f = waitbar(0.5,'Importing interview data','Name','Data Processing');

fid = fopen(interview_name, 'rt', 'n', 'UTF16LE');
fread(fid, 2, '*uint8'); %adjust the 2 to fit the UTF encoding
filecontent = fread(fid, [1 inf], '*char');
datacell = textscan(filecontent, '%s%s%s%s%s%s', 'Delimiter', ' ', 'HeaderLines', 1);
a = size(datacell{1});
num_markers = a(1);
interview_comments = strings(num_markers);
interview_ms_timestamps = zeros(num_markers,1);
k = 1;
l = 1;
while k <= num_markers
if (~isempty(datacell{3}{k}) && ~(datacell{3}{k} == ""))
int_timestamp_strings = strsplit(datacell{3}{k}, ':');
mins = int_timestamp_strings(2);
secs = int_timestamp_strings(3);
frames = int_timestamp_strings(4);
int_timestamp = round((str2num(mins{1})*60*1000) + (str2num(secs{1})*1000) + (str2num(frames{1})*1000/30));
if ~(int_timestamp == 0)
interview_ms_timestamps(l) = int_timestamp;
interview_comments(l) = datacell{1}{l};
l = l+1;
end
end
k = k+1;
end

interview_ms_timestamps = interview_ms_timestamps(1:find(interview_ms_timestamps,1,'last'));
interview_comments = interview_comments(1:length(interview_ms_timestamps));



interview_ms_timestamps = round(interview_ms_timestamps - processed_data.scalars.sync_frame*1000 / processed_data.scalars.frame_rate);

interview_table = table(interview_ms_timestamps, interview_comments.', 'VariableNames', {'timestamp_ms','label'});
processed_data.interview = interview_table;
% %align feeltrace data to master array
% aligned_data(1).interview = [];
% l = 1;
% a = length(interview_ms_timestamps);
% for k=1:length([aligned_data.timestamp_ms])
% if l > a
% break;
% end
% if interview_ms_timestamps(l) == aligned_data(k).timestamp_ms
% aligned_data(k).interview =interview_comments(l);
% l = l+1;
% else
% aligned_data(k).interview = [];
% end
% end

save(fullfile(processed_directory, 'processed_data.mat'),'processed_data');
100 changes: 100 additions & 0 deletions matlab/align_interview.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
%interview_filename = 'interview-17.csv';

%extract unique-timestamp interview data and timestamps
%and compile concise array
%name of interview file

%trial_directory = get_trial_directory();
%processed_directory = get_processed_directory();
%processed_data = get_processed_data();

load_globals;

% if (~exist('processed_directory'))
% waitfor(warndlg('Unknown processed data directory. Please select processed data directory.'));
% processed_directory = uigetdir(path,"Select directory to save processed data in.");
% end
% if ~exist('aligned_data')
% data_file = dir(fullfile(processed_directory,'processed_data.mat'));
% if ~isempty(data_file)
% data_name = data_file.name;
% data_path = data_file.folder;
% else
% waitfor(warndlg('Unable to automatically locate processed data file for this trial. Please find it manually. The file is usually called processed_data.mat and in the processed data directory. If the data from this trial has not been processed, please process data instead of running this script alone.'));
% [data_name, data_path] = uigetfile('*.mat','Find processed data .mat file');
% isdlg = 'No';
% while (data_name(1) == 0) && strcmp(questdlg('No processed data matlab file was opened. If the data from this trial has not been processed, please process data instead of running this script alone. Do you want to keep looking for this file yourself?',''),'Yes')
% [data_name, data_path] = uigetfile('*.mat','Find processed data .mat file');
% end
% if data_name(1) == 0
% waitfor(errordlg('Aborting data processing: no processed data file'));
% throw(MException('Custom:Custom','Failure: unable to find processed data file to add interview timestamps to'));
% end
% end
%
% if ~contains(data_name,pathsep)
% data_name = fullfile(data_path,data_name);
% end
% load (data_name);
% end

interview_name = get_path_ui(pwd, 'interview*.csv', 'interview csv', 'The file is usually called intervew-[number].csv and in the main trial directory.', true);

% if ~contains(interview_name,pathsep)
% interview_name = fullfile(interview_path,interview_name);
% end

%f = waitbar(0.5,'Importing interview data','Name','Data Processing');

fid = fopen(interview_name, 'rt', 'n', 'UTF16LE');
fread(fid, 2, '*uint8'); %adjust the 2 to fit the UTF encoding
filecontent = fread(fid, [1 inf], '*char');
datacell = textscan(filecontent, '%s%s%s%s%s%s', 'Delimiter', ' ', 'HeaderLines', 1);
a = size(datacell{1});
num_markers = a(1);
interview_comments = strings(num_markers);
interview_ms_timestamps = zeros(num_markers,1);
k = 1;
l = 1;
while k <= num_markers
if (~isempty(datacell{3}{k}) && ~(datacell{3}{k} == ""))
int_timestamp_strings = strsplit(datacell{3}{k}, ':');
mins = int_timestamp_strings(2);
secs = int_timestamp_strings(3);
frames = int_timestamp_strings(4);
int_timestamp = round((str2num(mins{1})*60*1000) + (str2num(secs{1})*1000) + (str2num(frames{1})*1000/30));
if ~(int_timestamp == 0)
interview_ms_timestamps(l) = int_timestamp;
interview_comments(l) = datacell{1}{l};
l = l+1;
end
end
k = k+1;
end

interview_ms_timestamps = interview_ms_timestamps(1:find(interview_ms_timestamps,1,'last'));
interview_comments = interview_comments(1:length(interview_ms_timestamps));



interview_ms_timestamps = round(interview_ms_timestamps - processed_data.scalars.sync_frame*1000 / processed_data.scalars.frame_rate);

interview_table = table(interview_ms_timestamps, interview_comments.', 'VariableNames', {'timestamp_ms','label'});
processed_data.interview = interview_table;
% %align feeltrace data to master array
% aligned_data(1).interview = [];
% l = 1;
% a = length(interview_ms_timestamps);
% for k=1:length([aligned_data.timestamp_ms])
% if l > a
% break;
% end
% if interview_ms_timestamps(l) == aligned_data(k).timestamp_ms
% aligned_data(k).interview =interview_comments(l);
% l = l+1;
% else
% aligned_data(k).interview = [];
% end
% end

%save(fullfile(processed_directory, 'processed_data.mat'),'processed_data');
Loading