Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NeuroPype-Pipeline
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Group 92
NeuroPype-Pipeline
Commits
af6957a2
Commit
af6957a2
authored
2 years ago
by
William G. Tresselt
Browse files
Options
Downloads
Patches
Plain Diff
Added failsafe for speller, will only take as much data as duration says
parent
50ac8cfd
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
jitter/ BCISpeller/BCISpellerV2.py
+8
-3
8 additions, 3 deletions
jitter/ BCISpeller/BCISpellerV2.py
jitter/ BCISpeller/BCISpellerV3.py
+7
-2
7 additions, 2 deletions
jitter/ BCISpeller/BCISpellerV3.py
with
15 additions
and
5 deletions
jitter/ BCISpeller/BCISpellerV2.py
+
8
−
3
View file @
af6957a2
...
@@ -12,6 +12,8 @@ channels = ['Fp1', 'Fz', 'F3', 'F7', 'F9', 'FC5', 'FC1', 'C3', 'T7', 'CP5', 'CP1
...
@@ -12,6 +12,8 @@ channels = ['Fp1', 'Fz', 'F3', 'F7', 'F9', 'FC5', 'FC1', 'C3', 'T7', 'CP5', 'CP1
removed_channels
=
[
'
Fp1
'
,
'
F8
'
,
'
F7
'
,
'
Fp2
'
,
'
F3
'
,
'
F4
'
]
removed_channels
=
[
'
Fp1
'
,
'
F8
'
,
'
F7
'
,
'
Fp2
'
,
'
F3
'
,
'
F4
'
]
#frequencies_main = [4,5,6,7,9,11]
#frequencies_main = [4,5,6,7,9,11]
frequencies_main
=
[
4
,
5
,
5.5
,
6
,
7
,
7.4
]
frequencies_main
=
[
4
,
5
,
5.5
,
6
,
7
,
7.4
]
#frequencies_main = [8.18,9,10,11.25,12.86,15]
frequencies
=
[
'
8.18_sin_h1
'
,
'
8.18_cos_h1
'
,
'
8.18_sin_h2
'
,
'
8.18_cos_h2
'
,
'
8.18_sin_h3
'
,
'
8.18_cos_h3
'
,
frequencies
=
[
'
8.18_sin_h1
'
,
'
8.18_cos_h1
'
,
'
8.18_sin_h2
'
,
'
8.18_cos_h2
'
,
'
8.18_sin_h3
'
,
'
8.18_cos_h3
'
,
'
9_sin_h1
'
,
'
9_cos_h1
'
,
'
9_sin_h2
'
,
'
9_cos_h2
'
,
'
9_sin_h3
'
,
'
9_cos_h3
'
,
'
9_sin_h1
'
,
'
9_cos_h1
'
,
'
9_sin_h2
'
,
'
9_cos_h2
'
,
'
9_sin_h3
'
,
'
9_cos_h3
'
,
'
10_sin_h1
'
,
'
10_cos_h1
'
,
'
10_sin_h2
'
,
'
10_cos_h2
'
,
'
10_sin_h3
'
,
'
10_cos_h3
'
,
'
10_sin_h1
'
,
'
10_cos_h1
'
,
'
10_sin_h2
'
,
'
10_cos_h2
'
,
'
10_sin_h3
'
,
'
10_cos_h3
'
,
...
@@ -141,8 +143,11 @@ while True:
...
@@ -141,8 +143,11 @@ while True:
# If buffer is filled with data ready to be compared in CCA, and the start of the buffer is the start of
# If buffer is filled with data ready to be compared in CCA, and the start of the buffer is the start of
# the Eye Tracking data (Eye Tracking trigger)
# the Eye Tracking data (Eye Tracking trigger)
if
(
len
(
buffer
)
==
fragment_samples
)
and
buffer
[
0
][
0
]
==
1
and
buffer
[
0
][
fragment_samples
-
round
(
delay
*
fs
)]
!=
0
:
if
(
len
(
buffer
)
==
fragment_samples
)
and
buffer
[
0
][
0
]
==
1
:
print
(
len
(
buffer
))
if
(
buffer
[
fragment_samples
-
round
(
delay
*
fs
)
-
1
][
0
]
!=
(
fragment_samples
-
round
(
delay
*
fs
))):
print
(
"
Found invalid stare
"
)
continue
fragment
=
np
.
array
(
buffer
[:
fragment_samples
])
fragment
=
np
.
array
(
buffer
[:
fragment_samples
])
fragment_eeg
=
np
.
array
(
buffer_eeg
[:
fragment_samples
])
fragment_eeg
=
np
.
array
(
buffer_eeg
[:
fragment_samples
])
...
@@ -151,7 +156,7 @@ while True:
...
@@ -151,7 +156,7 @@ while True:
# Makes both streams to a single dataframe
# Makes both streams to a single dataframe
df
=
pd
.
concat
([
pd
.
DataFrame
(
np
.
array
(
fragment
)),
pd
.
DataFrame
(
np
.
array
(
fragment_eeg
))],
axis
=
1
,
join
=
'
inner
'
)
df
=
pd
.
concat
([
pd
.
DataFrame
(
np
.
array
(
fragment
)),
pd
.
DataFrame
(
np
.
array
(
fragment_eeg
))],
axis
=
1
,
join
=
'
inner
'
)
df
.
columns
=
[
'
N
'
]
+
channels
# If any delay added, shift signal accordingly
# If any delay added, shift signal accordingly
df
[
'
N
'
]
=
df
[
'
N
'
].
shift
(
round
(
delay
*
fs
))
df
[
'
N
'
]
=
df
[
'
N
'
].
shift
(
round
(
delay
*
fs
))
df
=
df
.
iloc
[
round
(
delay
*
fs
):]
df
=
df
.
iloc
[
round
(
delay
*
fs
):]
...
...
This diff is collapsed.
Click to expand it.
jitter/ BCISpeller/BCISpellerV3.py
+
7
−
2
View file @
af6957a2
...
@@ -17,6 +17,7 @@ removed_channels = ['Fp1', 'F8', 'F7', 'Fp2', 'F3', 'F4']
...
@@ -17,6 +17,7 @@ removed_channels = ['Fp1', 'F8', 'F7', 'Fp2', 'F3', 'F4']
#The frequencies used for the SSVEP speller
#The frequencies used for the SSVEP speller
#frequencies_main = [4,5,6,7,9,11]
#frequencies_main = [4,5,6,7,9,11]
frequencies_main
=
[
4
,
5
,
5.5
,
6
,
7
,
7.4
]
frequencies_main
=
[
4
,
5
,
5.5
,
6
,
7
,
7.4
]
#frequencies_main = [8.18,9,10,11.25,12.86,15]
#The channels used for the BCI Speller combined with CCA
#The channels used for the BCI Speller combined with CCA
occ_channels
=
[
'
O1
'
,
'
O2
'
,
'
Oz
'
,
'
P3
'
,
'
P4
'
,
'
Pz
'
,
'
P7
'
,
'
P8
'
]
occ_channels
=
[
'
O1
'
,
'
O2
'
,
'
Oz
'
,
'
P3
'
,
'
P4
'
,
'
Pz
'
,
'
P7
'
,
'
P8
'
]
...
@@ -216,8 +217,12 @@ while True:
...
@@ -216,8 +217,12 @@ while True:
# If buffer is filled with data ready to be compared in CCA, and the start of the buffer is the start of
# If buffer is filled with data ready to be compared in CCA, and the start of the buffer is the start of
# the Eye Tracking data (Eye Tracking trigger)
# the Eye Tracking data (Eye Tracking trigger)
if
(
len
(
buffer
)
==
fragment_samples
)
and
buffer
[
0
][
0
]
==
1
and
buffer
[
0
][
fragment_samples
-
round
(
delay
*
fs
)]
!=
0
:
print
(
len
(
buffer
))
if
(
len
(
buffer
)
==
fragment_samples
)
and
(
buffer
[
0
][
0
]
==
1
):
if
(
buffer
[
fragment_samples
-
round
(
delay
*
fs
)
-
1
][
0
]
!=
(
fragment_samples
-
round
(
delay
*
fs
))):
print
(
"
Found invalid stare
"
)
continue
fragment
=
np
.
array
(
buffer
[:
fragment_samples
])
fragment
=
np
.
array
(
buffer
[:
fragment_samples
])
fragment_eeg
=
np
.
array
(
buffer_eeg
[:
fragment_samples
])
fragment_eeg
=
np
.
array
(
buffer_eeg
[:
fragment_samples
])
triggered
=
True
triggered
=
True
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment