Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Föt_24_25
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
Péter Szabolcs Mátyás
Föt_24_25
Commits
4091919b
Commit
4091919b
authored
6 months ago
by
Péter Szabolcs Mátyás
Browse files
Options
Downloads
Patches
Plain Diff
Excel to EDF
parent
765c96b9
Branches
main
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
excel_to_edf.py
+46
-0
46 additions, 0 deletions
excel_to_edf.py
with
46 additions
and
0 deletions
excel_to_edf.py
0 → 100644
+
46
−
0
View file @
4091919b
import
pandas
as
pd
import
pyedflib
import
numpy
as
np
def
convert_excel_to_edf
(
excel_path
,
edf_output_path
):
excel_data
=
pd
.
ExcelFile
(
excel_path
)
#Excel megnyitása
recordings_data
=
excel_data
.
parse
(
'
Recordings
'
)
#A két munkalap betöltése
patients_data
=
excel_data
.
parse
(
'
Patients
'
)
patient_data
=
patients_data
.
iloc
[
0
].
to_dict
()
# Az első sorból kiszedi az adatokat
patient_name
=
patient_data
.
get
(
'
Name
'
,
'
N/A
'
)
patient_birthdate
=
patient_data
.
get
(
'
Birthdate
'
,
'
N/A
'
)
patient_sex
=
patient_data
.
get
(
'
Sex
'
,
'
N/A
'
)
patient_ID
=
patient_data
.
get
(
'
ID
'
,
'
N/A
'
)
record_date
=
patient_data
.
get
(
'
Recording_date
'
,
'
N/A
'
)
record_lenght
=
patient_data
.
get
(
'
Record_lenght
'
,
'
N/A
'
)
patient_height
=
patient_data
.
get
(
'
Height
'
,
'
N/A
'
)
patient_weight
=
patient_data
.
get
(
'
Weight
'
,
'
N/A
'
)
notes
=
patient_data
.
get
(
'
Notes
'
,
'
N/A
'
)
# if pd.isna(patient_birthdate):
# patient_birthdate = 'N/A'
# else:
# patient_birthdate = str(patient_birthdate.date())
# Jeladatok kinyerése
signal_labels
=
recordings_data
.
columns
.
tolist
()
signals
=
[
recordings_data
[
col
].
to_numpy
()
for
col
in
signal_labels
]
# EDF létrehozása
with
pyedflib
.
EdfWriter
(
edf_output_path
,
len
(
signals
),
file_type
=
pyedflib
.
FILETYPE_EDFPLUS
)
as
edf
:
# # Header beállítása
# edf.setHeader({
# })
if
__name__
==
"
__main__
"
:
excel_path
=
"
test_generator2.xlsx
"
edf_output_path
=
"
output_data.edf
"
convert_excel_to_edf
(
excel_path
,
edf_output_path
)
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