Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MCC Flow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Köllőd Csaba
MCC Flow
Commits
b057712b
Commit
b057712b
authored
2 years ago
by
Köllőd Csaba
Browse files
Options
Downloads
Patches
Plain Diff
Dev: Saving to EDF file
- Now works fine - data conversion must be checked
parent
66e3ff84
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mcc-flow/merge_records.py
+8
-6
8 additions, 6 deletions
mcc-flow/merge_records.py
with
8 additions
and
6 deletions
mcc-flow/merge_records.py
+
8
−
6
View file @
b057712b
...
...
@@ -13,7 +13,7 @@ GYRO_ACC_FS = 50
SOUND_FS
=
6000
GSR_FS
=
10
EEG_EMG_SCALE
=
0.04470348358154
# (
m
V)
EEG_EMG_SCALE
=
0.04470348358154
# (
u
V)
GYRO_SCALE
=
0.0152587890625
# (deg/sec)
ACC_SCALE
=
0.00006103515625
# (g)
...
...
@@ -100,14 +100,14 @@ class FlowPacket:
for
pkt
in
to_save
:
for
i
,
ch_dat
in
enumerate
(
pkt
.
data
):
print
(
sig
)
#
edf.setPhysicalMaximum(sig,
2**7
* EEG_EMG_SCALE)
#
edf.setPhysicalMinimum(sig, -
2**7
* EEG_EMG_SCALE)
edf
.
setPhysicalMaximum
(
sig
,
3000
*
EEG_EMG_SCALE
)
edf
.
setPhysicalMinimum
(
sig
,
-
3000
*
EEG_EMG_SCALE
)
# edf.setDigitalMaximum(sig, 2**7)
# edf.setDigitalMinimum(sig, -2**7)
edf
.
setPhysicalDimension
(
sig
,
pkt
.
unit
)
edf
.
setSamplefrequency
(
sig
,
pkt
.
fs
)
edf
.
setLabel
(
sig
,
f
'
{
pkt
.
type
}{
i
}
'
)
data_buffer
.
append
(
ch_dat
)
data_buffer
.
append
(
np
.
array
(
ch_dat
,
order
=
'
C
'
)
)
sig
+=
1
edf
.
writeSamples
(
data_buffer
)
...
...
@@ -154,6 +154,8 @@ def read_packet(file):
# extra
sound
=
_read_block_data
(
file
,
(
6000
,
1
),
'
h
'
,
2
).
T
gsr
=
_read_block_data
(
file
,
(
10
,
1
),
'
h
'
,
2
).
T
if
not
np
.
array_equal
(
sound
,
np
.
zeros_like
(
sound
)):
sound
=
(
sound
-
np
.
mean
(
sound
))
/
(
np
.
max
(
sound
)
-
np
.
min
(
sound
))
sound
=
PacketData
(
sound
,
'
sound
'
,
'
unit
'
,
SOUND_FS
)
gsr
=
PacketData
(
gsr
,
'
gsr
'
,
'
unit
'
,
GSR_FS
)
# print(sound, gsr)
...
...
@@ -182,8 +184,8 @@ def read_data(path):
for
file
in
files
:
with
open
(
file
,
'
rb
'
)
as
f
:
data
=
read_dat_file
(
f
)
#
data.plot()
data
.
to_edf
(
'
test.edf
'
)
data
.
plot
()
#
data.to_edf('test.edf')
exit
(
12
)
...
...
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