MohammadJavavdD
commited on
Commit
·
d022705
1
Parent(s):
731299b
Add application file
Browse files
app.py
CHANGED
@@ -1,4 +1,22 @@
|
|
|
|
1 |
import streamlit as st
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Import libraries
|
2 |
import streamlit as st
|
3 |
+
import mne
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
|
6 |
+
# Load the edf file
|
7 |
+
edf_file = st.file_uploader("Upload an EEG edf file", type="edf")
|
8 |
+
if edf_file is not None:
|
9 |
+
raw = mne.io.read_raw_edf(edf_file)
|
10 |
+
st.write(f"Loaded {edf_file.name} with {raw.info['nchan']} channels")
|
11 |
+
|
12 |
+
# Select the first channel
|
13 |
+
channel = raw.ch_names[0]
|
14 |
+
st.write(f"Selected channel: {channel}")
|
15 |
+
|
16 |
+
# Plot the first channel
|
17 |
+
fig, ax = plt.subplots()
|
18 |
+
ax.plot(raw.times, raw[channel][0].T)
|
19 |
+
ax.set_xlabel("Time (s)")
|
20 |
+
ax.set_ylabel("Amplitude (µV)")
|
21 |
+
ax.set_title(f"EEG signal of {channel}")
|
22 |
+
st.pyplot(fig)
|