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
f945db35
Commit
f945db35
authored
2 years ago
by
ofplarsen
Browse files
Options
Downloads
Patches
Plain Diff
test this delay thing
parent
2a4b8939
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
jitter/ BCISpeller/BCISpellerV3.py
+14
-10
14 additions, 10 deletions
jitter/ BCISpeller/BCISpellerV3.py
with
14 additions
and
10 deletions
jitter/ BCISpeller/BCISpellerV3.py
+
14
−
10
View file @
f945db35
...
@@ -191,9 +191,9 @@ inlet = StreamInlet(streams_counter[0]) #LSL Eyetracker data
...
@@ -191,9 +191,9 @@ inlet = StreamInlet(streams_counter[0]) #LSL Eyetracker data
inlet_2
=
StreamInlet
(
streams_eeg
[
0
])
# LSL EEG data
inlet_2
=
StreamInlet
(
streams_eeg
[
0
])
# LSL EEG data
fs
=
250
# Sampling frequency
fs
=
250
# Sampling frequency
delay
=
0.061
#
Occular
delay
sync_
delay
=
0.061
#
sync
delay
ocular_delay
=
0.100
# Ocular delay
fragment_duration
=
4
+
delay
# Fragment duration in seconds
fragment_duration
=
4
+
sync_delay
+
ocular_
delay
# Fragment duration in seconds
fragment_samples
=
round
(
fs
*
fragment_duration
)
fragment_samples
=
round
(
fs
*
fragment_duration
)
...
@@ -218,8 +218,9 @@ while True:
...
@@ -218,8 +218,9 @@ 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
):
if
(
len
(
buffer
)
==
fragment_samples
)
and
buffer
[
0
][
round
(
ocular_delay
*
fs
)]
==
1
and
buffer
[
0
][
fragment_samples
-
round
(
sync_delay
*
fs
)]
!=
0
:
if
(
buffer
[
fragment_samples
-
round
(
delay
*
fs
)
-
1
][
0
]
!=
(
fragment_samples
-
round
(
delay
*
fs
))):
# This prob not working :P
if
(
buffer
[
fragment_samples
-
round
(
sync_delay
*
fs
)
-
1
][
0
]
!=
(
fragment_samples
-
round
(
sync_delay
*
fs
))):
print
(
"
Found invalid stare
"
)
print
(
"
Found invalid stare
"
)
continue
continue
...
@@ -250,9 +251,12 @@ while True:
...
@@ -250,9 +251,12 @@ while True:
print
(
"
--- Filter time: %s seconds ---
"
%
(
time
.
time
()
-
start_time
))
print
(
"
--- Filter time: %s seconds ---
"
%
(
time
.
time
()
-
start_time
))
print
(
df
[
'
N
'
].
tolist
())
print
(
df
[
'
N
'
].
tolist
())
df
[
'
N
'
]
=
df
[
'
N
'
].
shift
(
-
round
(
ocular_delay
*
fs
))
# 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
(
sync_
delay
*
fs
))
df
=
df
.
iloc
[
round
(
delay
*
fs
):]
df
=
df
.
iloc
[
round
(
sync_
delay
*
fs
):]
# Reset the index
# Reset the index
df
=
df
.
reset_index
(
drop
=
True
)
df
=
df
.
reset_index
(
drop
=
True
)
...
@@ -276,9 +280,9 @@ while True:
...
@@ -276,9 +280,9 @@ while True:
X_c
,
Y_c
=
ca
.
transform
(
X
,
Y
)
X_c
,
Y_c
=
ca
.
transform
(
X
,
Y
)
# Uses two coefficients pk = sqrt(p1**2+p2*'2)
# Uses two coefficients pk = sqrt(p1**2+p2*'2)
p1
=
np
.
corrcoef
(
X_c
[:,
0
],
Y_c
[:,
0
])[
0
][
1
]
p1
=
np
.
corrcoef
(
X_c
[:,
0
],
Y_c
[:,
0
])[
0
][
1
]
#
freqs.append(p1)
freqs
.
append
(
p1
)
p2
=
np
.
corrcoef
(
X_c
[:,
1
],
Y_c
[:,
1
])[
0
][
1
]
#
p2 = np.corrcoef(X_c[:, 1], Y_c[:, 1])[0][1]
freqs
.
append
(
np
.
sqrt
(
p1
**
2
+
p2
**
2
))
#
freqs.append(np.sqrt(p1 ** 2 + p2 ** 2))
cca
=
freqs
cca
=
freqs
#print("CCA single: " + str(perform_cca(df,1)))
#print("CCA single: " + str(perform_cca(df,1)))
print
(
cca
)
print
(
cca
)
...
...
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