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