Plot bands for a particular channel in EEG feature extraction

51 views Asked by At

I have performed band extraction using DWT function.

I performed the following code:

start_time = 0
end_time = 1

# Find the corresponding indices in the EEG data
start_idx = int(start_time * raw.info['sfreq'])
end_idx = int(end_time * raw.info['sfreq'])

# Extract the relevant portions of each frequency band
delta_segment = delta[start_idx:end_idx]
theta_segment = theta[start_idx:end_idx]
alpha_segment = alpha[start_idx:end_idx]
beta_segment = beta[start_idx:end_idx]
gamma_segment = gamma[start_idx:end_idx]

# Plotting the Delta Band
plt.figure(figsize=(10, 6))
plt.subplot(511)
plt.plot(times[start_idx:end_idx], delta_segment.T)
plt.title("Delta Band")

#Plotting Theta Band
plt.figure(figsize=(10, 6))
plt.subplot(512)
plt.plot(times[start_idx:end_idx], theta_segment.T)
plt.title("Theta Band")

#Plotting Alpha Band
plt.figure(figsize=(10, 6))
plt.subplot(513)
plt.plot(times[start_idx:end_idx], alpha_segment.T)
plt.title("Alpha Band")

#Plotting Beta Band
plt.figure(figsize=(10, 6))
plt.subplot(514)
plt.plot(times[start_idx:end_idx], beta_segment.T)
plt.title("Beta Band")

#Plotting Gamma Band
plt.figure(figsize=(10, 6))
plt.subplot(515)
plt.plot(times[start_idx:end_idx], gamma_segment.T)
plt.title("Gamma Band")

And the outputs I got are:

First:

First

Second:

Second

How can I plot these bands for a particular channel?

0

There are 0 answers