Mohammad Javad Darvishi commited on
Commit
f462298
1 Parent(s): 28be895

'plot using mne-python'

Browse files
Files changed (1) hide show
  1. misc.py +23 -10
misc.py CHANGED
@@ -98,18 +98,31 @@ def build_model(model_name, n_classes, n_chans, input_window_samples, drop_prob=
98
 
99
 
100
  def preprocessing_and_plotting(raw):
101
- # Select the first channel
102
- channel = raw.ch_names[0]
103
- st.write(f"Selected channel: {channel}")
104
-
105
- # Plot the first channel
106
- fig, ax = plt.subplots()
107
- ax.plot(raw.times, raw[channel][0].T)
108
- ax.set_xlabel("Time (s)")
109
- ax.set_ylabel("Amplitude (µV)")
110
- ax.set_title(f"EEG signal of {channel}")
111
  st.pyplot(fig)
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  def read_file(edf_file):
114
  # To read file as bytes:
115
  bytes_data = edf_file.getvalue()
 
98
 
99
 
100
  def preprocessing_and_plotting(raw):
101
+ fig = raw.plot(duration=10, scalings='auto',remove_dc=True,show_scrollbars=False) #, n_channels=10
 
 
 
 
 
 
 
 
 
102
  st.pyplot(fig)
103
 
104
+ # # Plot the power spectrum
105
+ # fig, ax = plt.subplots()
106
+ # raw.plot_psd(fmin=1, fmax=60, ax=ax)
107
+ # st.pyplot(fig)
108
+
109
+ # # Plot the spectrogram
110
+ # fig, ax = plt.subplots()
111
+ # raw.plot_spectrogram(n_fft=512, ax=ax)
112
+ # st.pyplot(fig)
113
+
114
+ # # Select the first channel
115
+ # channel = raw.ch_names[0]
116
+ # st.write(f"Selected channel: {channel}")
117
+
118
+ # # Plot the first channel
119
+ # fig, ax = plt.subplots()
120
+ # ax.plot(raw.times, raw[channel][0].T)
121
+ # ax.set_xlabel("Time (s)")
122
+ # ax.set_ylabel("Amplitude (µV)")
123
+ # ax.set_title(f"EEG signal of {channel}")
124
+ # st.pyplot(fig)
125
+
126
  def read_file(edf_file):
127
  # To read file as bytes:
128
  bytes_data = edf_file.getvalue()