This project proposes fNIRSBand, a textile-based fNIRS headband designed for academia to track focus, relaxation, and fatigue during study sessions and throughout the day.
Assignment 6 - Option C (Wearable Brain Monitor)
Introduction
Design & Technology
fNIRSBand is a soft, stretchable textile headband lined with light-blocking silicone to minimize ambient interference. This product contains multiple layers. The outermost layer distributes mechanical tension to maintain optode contact pressure, as well as serves as structural housing for the wiring that runs within the headband. It also provides comfort and aesthetics for the consumer, through its use of technical fabric. The headband comes in a few colours, which allows consumers to choose what suits them best. Next is a 1-2mm light-blocking silicone layer. This liner is made with black carbon-loaded PDMS silicone, which is known for its strong light absorption and thermal properties, as well as durability (Hiremath et al., 2021). Encapsulated within the silicone layer are semi-rigid optode modules that contain NIR LEDs & photodiodes to detect hemodynamic changes. They are each located ~30mm apart. Each headband has 4 optical channels placed across the forehead, following the International 10-10 placement system. More specifically this device contains sensors located at F3, F4, AF3 & AF4, which are positioned over Brodmann area 9 & 46 (Homan et al., 1987; Scrivener & Reader, 2022). These areas are involved in many executive functions such as working memory, decision making, sustained attention, stress-detection, and cognitive control (Gupta & Tranel, 2012).
Device Metrics
This device will report a variety of metrics to users such as focus/attention, cognitive load, stress, and mental fatigue. Focus/attention will be derived from the simultaneous increase in oxygenated hemoglobin (HbO) and decrease in deoxygenated hemoglobin (HbR) in the dorsolateral prefrontal cortex (DLPFC), located at channels F3 & F4. Research has found that higher activation in these areas is associated with higher engagement (Harrivel et al., 2013; Gu et al., 2022). Cognitive load will be derived from an increase in HbO at all 4 channels. Fatigue will be derived from either the gradual reduction in oxygenated hemoglobin response amplitude over time or a hemispheric asymmetry between channels F3 & F4 (Yan et al., 2025). This is because fatigue is associated with high activation of the prefrontal cortex and slower recovery (Li et al., 2020). Stress will be derived from elevated HbO in the right prefrontal (F4, AF4) during stress and the balanced signals during relaxation (Wutzl et al., 2024). In other words, it will compare F4 & F3 channels for signs of asymmetry.
Challenges, Tradeoffs & Limitations
Although this device has some good qualities, every design comes with inherent limitations and challenges. A major downside to fNIRSBand is its limitation in what and how much it can measure. Firstly, it only contains 4 channels located over the prefrontal cortex of the brain (F3, F4, AF3, AF4). This means that signals from other relevant cortical regions are being missed. Similarly, fNIRS has a limited spatial resolution and can only measure hemodynamic changes 1-2 cm deep. This means that certain mental states can only be inferred from the data rather than directly observed, which significantly constrains the accuracy of collected metrics. The temporal resolution of this technique is also relatively low since it only measures slow hemodynamic responses seconds after neural activity occurs. However, due to the intended functions of the band, this doesnβt pose that large of an issue.
User Experience & Software
fNIRSBandβs analytics can be viewed through an intuitive smartphone application. Users will initially be prompted to measure their baseline activity. At the top of the page, the user will be able to see both their focus and relaxation scores on a simple colour-coded scale based on incoming brain data. These scales will change colour depending on how calm (blue), focused (green), stressed (orange), or fatigued (red) the user is at a given moment. As an individual continues to use the product, the app will pick up on the userβs brain trends. These trends will then be translated into ready to use consumer information through graphs, flow duration charts, and mental fatigue timelines. It will also provide daily feedback on ideal focus times, break suggestions, and environmental correlations such as the time of day or type of event. This will allow users to learn how to optimize their circadian rhythms for success. They will also have the option to log when they are doing certain activities for better trend recognition.
Validation & Scientific Credibility
In order to validate metrics, fNIRSBand will go through a variety of phases prior to being released to the general public. The first phase would be a controlled lab validation, where fNIRSBandβs metrics would be directly compared to clinical fNIRS caps during a variety of standardized cognitive tasks. These tasks would focus on both focus and relaxation. Examples might include the Stroop or breath-focused tasks. The correlation coefficient should be > 0.7 for HbO trends. If successful, it will move on to the behavioural validation phase, where tests will be done to validate the correlations between task performance and reported focus scores. This might be done through reaction time or memory recall tasks. Correlations should be between r= 0.4-0.7 to be considered valid. The next phase would be a field study, where fNIRSBand would be brought into daily life to examine its ecological validity. Devices would likely be sent out to 50+ users for 2-4 weeks to collect self-reported metrics such as concentration, productivity, and mood scores. These metrics would then be compared to actual incoming data. This phase would also help filter out additional motion artifacts. Finally, there would be a pre-market pilot where a small group of early adopters will test the band for usability and comfort. Feedback from this phase would be used to make any final refinements before official production and release. In total, this process would be expected to take approximately 12-18 months to complete.
Business & Market Reality
The device will cost ~$130 to manufacture due to the variety of parts it requires such as optical sensors, detectors, electronics, battery + housing, headband materials, connectors, etc. In addition, it will likely require additional costs such as assembly, quality control, and packaging. In order to make the product viable, it would retail for ~$225-275. This positions the device as a relatively accessible consumer neurotech product. The primary target market includes students, productivity seekers, and mindfulness users. It also has the potential to be aimed for gamers or researchers.
References
- Gupta, R., & Tranel, D. (2012). Memory, Neural Substrates. Elsevier, 593β600. https://doi.org/10.1016/B978-0-12-375000-6.00230-5
- Gu, Y., Yang, L., Chen, H., Liu, W., & Liang, Z. (2022). Improving Attention through Individualized fNIRS Neurofeedback Training: A Pilot Study. Brain Sciences, 12 (7). https://doi.org/10.3390/brainsci12070862
- Harrivel, A., Weissman, D., Noll, D., & Peltier, S. (2013). Monitoring attentional state with fNIRS. Frontiers in Human Neuroscience. https://doi.org/10.3389/fnhum.2013.00861
- Hiremath, S., Shrishail, H., &Kulkarni, S. (2021). Progression and characterization of polydimethylsiloxane-carbon black nanocomposites for photothermal actuator applications, Elsevier, 319. https://doi.org/10.1016/j.sna.2020.112522
- Homan, R. W., Herman, J., & Purdy, P. (1987). Cerebral location of international 10β20 system electrode placement. Electroencephalography and Clinical Neurophysiology, 66 (4), 376β382. https://doi.org/10.1016/0013-4694(87)90206-9
- Leber, A., Cholst, B., Sandt, J., Vogel, N., & Kolle, M. (2018). Stretchable Thermoplastic Elastomer Optical Fibers for Sensing of Extreme Deformations. Institute of Particle Technology. 1-8. https://doi.org/10.1002/adfm.201802629
- Li, G., Huang, S., Xu, w., Jiao, W., Jiang, Y., Gao, Z., & Zhang, J. (2020) The impact of mental fatigue on brain activity: a comparative study both in resting state and task state using EEG. BMC Neuroscience. https://doi.org/10.1186/s12868-020-00569-1
- Scrivener, C., & Reader, A. (2022) Variability of EEG electrode positions and their underlying brain regions: visualizing gel artifacts from a simultaneous EEG β fMRI dataset. 12(2). https://doi.org/10.1002/brb3.2476
- Wutzl, B., Leibnitz, K., Murata, M. (2024). An Analysis of the Correlation between the Asymmetry of Different EEG-Sensor Locations in Diverse Frequency Bands and Short-Term Subjective Well-Being Changes. Brain Sciences, 14 (3). https://doi.org/10.3390/brainsci14030267
- Yan, Y., Guo, Y., Zhou, D. (2025). Mental fatigue causes significant activation of the prefrontal cortex: A systematic review and meta-analysis of fNIRS studies. PubMed, 62 (1). https://doi.org/10.1111/psyp.14747
Other Course Work
π Assignment 1: EEG Analysis
π assignment1_eeg_filtering.ipynb-Colab_Thorsenb - Ella Thorsen-Bell.pdf
View Original PDFPSYCH 403A1 - Neuroimaging and Neurostimulation
Due: September 29, 2025
π―
## What You'll Learn (In Plain English!)
Think of this assignment like cleaning up a noisy radio signal to hear your favorite song
better! By the end, you'll be able to:
π₯ Load brain wave recordings (like opening an audio file, but for brain signals!)
π Understand what EEG signals look like (spoiler: they're very squiggly!)
π§ Apply digital "filters" (like noise-canceling headphones for brain data)
π Create beautiful scientific plots (that you'll be proud to show off!)
π Make colorful frequency charts (showing which brain wave "notes" are
strongest)
π΅
## The Brain Wave "Music" Analogy
Raw EEG = Noisy Radio: Lots of static mixed with the signal
Filtering = Noise Cancellation: Removes the "hiss" to hear the music clearly
Frequency Analysis = Music Equalizer: Shows which "notes" (frequencies) are
loudest
Multiple Channels = Orchestra: Each electrode is like a different instrument
π
## About Our Data
We're using real brain recordings from people doing a memory task:
64 "microphones" placed on the scalp (called electrodes)
500 measurements per second (like a very fast camera for brain activity)
Safe & non-invasive (just like wearing a swimming cap with sensors)
π‘ Don't worry about the technical details - we'll explain everything step by step!
π§
## Assignment 1: EEG Data Loading and Basic Filtering
ξ
Think of this like getting your art supplies before painting! We need to gather our "digital
tools" for brain data analysis.
π
## Step 1: Getting Your Toolbox Ready
ξ
ο§
9/27/25, 11:40 AM assignment1_eeg_filtering.ipynb - Colab
https://colab.research.google.com/github/kylemath/NeuroimagingClass/blob/main/assignment1_eeg_filtering.ipynb#scrollTo=A5PFPYJYQyfv&printMo⦠1/11
What We're Installing:
MNE-Python π§ : The brain data expert (like Photoshop, but for brain signals)
Matplotlib π¨ : Our artist for making beautiful plots
NumPy π’ : The math wizard that does calculations super fast
SciPy β : Extra science tools for advanced analysis
π± Mobile/Tablet Users: This might take 1-2 minutes the first time - perfect time for a
coffee break! β
# π― STEP 1: Import our digital toolbox!
# Think of this like getting your cooking utensils before making a meal
print ( " π§ Setting up your brain data analysis toolkit..." )
print ( " π± Mobile users: This is the perfect time to grab some water! π§ " )
# Check if we're in Google Colab and install packa ges if needed
try :
import google.colab
print ( " π€ Detected Google Colab - installing packages..." )
%pip install -q mne
print ( " β
Packages installed!" )
except ImportError:
print ( " π Running in Binder or local environment - packages should alre
# Import our "tools" (like getting your paintbrush es ready)
import mne # π§ The brain data expert
import numpy as np # π’ The math wizard
import matplotlib.pyplot as plt # π¨ Our plotting artist
from scipy import signal # β Extra science tools
import requests # π‘ For downloading data
import os # π File management helper
from pathlib import Path # π Better file handling
# Make our plots look beautiful and mobile-friendl y
plt.rcParams[ 'figure.figsize' ] = ( 10 , 6 ) # Good size for phones/tablets
plt.rcParams[ 'font.size' ] = 11 # Readable text size
plt.rcParams[ 'lines.linewidth' ] = 1.5 # Nice thick lines
mne.set_log_level( 'WARNING' ) # Less technical chatter
print ( " β
SUCCESS! All tools loaded and ready to go!" )
print ( f " π§ MNE-Python version: {mne. __version__ } " )
print ( f " π’ NumPy version: {np. __version__ } " )
print ( " π You're all set to analyze some brain waves! π " )
# π€ Google Colab AI Tip:
9/27/25, 11:40 AM assignment1_eeg_filtering.ipynb - Colab
https://colab.research.google.com/github/kylemath/NeuroimagingClass/blob/main/assignment1_eeg_filtering.ipynb#scrollTo=A5PFPYJYQyfv&printMo⦠2/11
Click the " β¨ " button next to any code cell to get AI help! # You can ask questions like "What does this code do?" or "How do I modify π§ Setting up your brain data analysis toolkit... π± Mobile users: This is the perfect time to grab some water! π§ π€ Detected Google Colab - installing packages... ββββββββββββββββββββββββββββββββββββββββ 7.4/7 β Packages installed! β SUCCESS! All tools loaded and ready to go! π§ MNE-Python version: 1.10.1 π’ NumPy version: 2.0.2 π You're all set to analyze some brain waves! π Now for the exciting part - getting some real brain data! This is like downloading a song, but instead of music, we're getting brain wave recordings. π΅ ## What We're Loading:
Real EEG data from the MNE sample dataset (built-in, no downloads needed!)
Multiple "channels" (like having multiple microphones recording different parts of the
brain)
Continuous recording (like a very long song of brain activity)
π
## What You'll See:
Lots of squiggly lines (that's normal - brains are busy!)
Different patterns (some fast wiggles, some slow waves)
Multiple colors (each representing a different electrode location)
π± Pro Tip: On mobile, you can pinch-to-zoom on any plot to see details better!
π₯
## Step 2: Loading Your Brain Wave "Music File"
ξ
# π― STEP 2: Load some real brain wave data!
# This is like opening a music file, but instead o f songs, we get brain sig
print ( " π₯ Loading brain wave data (this might take a moment)..." )
print ( " β Perfect time to stretch if you're on mobile!" )
# Get the sample dataset (automatically downloads the first time)
# Think of this like having Spotify download a son g for offline listening
sample_data_folder = mne.datasets.sample.data_path ()
# Load the actual brain recording file
# This is like clicking "play" on your brain wave "song"
raw_file = sample_data_folder / 'MEG' / 'sample' / 'sample_audvis_raw.fif'
raw = mne.io.read_raw_fif(raw_file, preload= True )
9/27/25, 11:40 AM assignment1_eeg_filtering.ipynb - Colab
https://colab.research.google.com/github/kylemath/NeuroimagingClass/blob/main/assignment1_eeg_filtering.ipynb#scrollTo=A5PFPYJYQyfv&printMo⦠3/11
Let's pick just the EEG channels (the brain wave "instruments") # This removes other types of sensors we don't nee d for this assignment raw.pick_types(meg= False , eeg= True , stim= False , exclude= 'bads' ) print ( " β SUCCESS! Brain data loaded!" ) print ( f " π Data info:" ) print ( f " π΅ Length: {raw.times[ -1 ] :.1f } seconds of brain activity" ) print ( f " π€ Channels: { len (raw.ch_names)} EEG electrodes" ) print ( f " β‘ Sampling rate: {raw.info[ 'sfreq' ] :.0f } measurements per secon print ( " π§ Ready to explore some brain waves! π§ " ) π₯ Loading brain wave data (this might take a moment)... β Perfect time to stretch if you're on mobile! β SUCCESS! Brain data loaded! π Data info: π΅ Length: 277.7 seconds of brain activity π€ Channels: 59 EEG electrodes β‘ Sampling rate: 601 measurements per second π§ Ready to explore some brain waves! π§ # π― STEP 3: Visualize the raw brain wave data # This is like looking at the squiggly lines of a song's waveform print ( " π Plotting the raw brain wave data..." ) print ( " π§ Examine the squiggly lines - each color is a different electrode! # Plot the raw data for the first 10 seconds from the first 10 channels # We'll limit the number of channels and time to m ake it easier to see raw.plot(duration= 10 , n_channels= 10 , scalings= 'auto' , butterfly= False ) plt.suptitle( 'Raw EEG Data (First 10 Channels, First 10 Seconds )' , y= 1.05 ) plt.tight_layout() plt.show() print ( " β Plot generated! Take a look at the brain waves above." ) print ( " π‘ Notice the different patterns and amplitudes across channels." ) 9/27/25, 11:40 AM assignment1_eeg_filtering.ipynb - Colab https://colab.research.google.com/github/kylemath/NeuroimagingClass/blob/main/assignment1_eeg_filtering.ipynb#scrollTo=A5PFPYJYQyfv&printMoβ¦ 4/11
π Plotting the raw brain wave data...
π§ Examine the squiggly lines - each color is a different electrode!
β
Plot generated! Take a look at the brain waves above.
π‘ Notice the different patterns and amplitudes across channels.
π§
## Step 4: Filtering for Alpha Waves
ξ
9/27/25, 11:40 AM assignment1_eeg_filtering.ipynb - Colab
https://colab.research.google.com/github/kylemath/NeuroimagingClass/blob/main/assignment1_eeg_filtering.ipynb#scrollTo=A5PFPYJYQyfv&printMo⦠5/11
Now that we've seen the raw data, let's clean it up a bit! We'll use a "bandpass filter" to
keep only the brain waves in a specific frequency range, like tuning into a specific radio
station.
π§
## Alpha Waves (8-13 Hz)
These waves are often associated with relaxation and a calm state.
By filtering for alpha, we can see where and when these waves are strongest.
π
## What the Code Does:
Applies a filter to the raw data object.
Specifies the lower (8 Hz) and upper (13 Hz) frequency limits for the filter.
Creates a new data object ( raw_alpha ) so we keep the original raw data
untouched.
# π― STEP 4: Filter the data for alpha waves (8-13 Hz)
# This is like using a radio tuner to isolate a sp ecific frequency
print ( " π§ Filtering the brain wave data for alpha waves (8-13 Hz)..." )
# Apply a bandpass filter between 8 and 13 Hz
# This creates a new 'raw_alpha' object with only alpha waves
raw_alpha = raw.copy(). filter (l_freq= 8 , h_freq= 13 , fir_design= 'firwin' )
print ( " β
SUCCESS! Data filtered for alpha waves." )
print ( " π§ The 'raw_alpha' object now contains only the alpha wave activity.
π§ Filtering the brain wave data for alpha waves (8-13 Hz)...
β
SUCCESS! Data filtered for alpha waves.
π§ The 'raw_alpha' object now contains only the alpha wave activity.
# Plot the alpha-filtered data for the first 10 se conds and first 10 channe
print ( " π Plotting alpha-filtered EEG data (first 10 seconds, first 10 chan
print ( " π§ Examine the squiggly lines - each color is a different electrode!
# Plot the raw_alpha data for the first 10 seconds from the first 10 channe
raw_alpha.plot(duration= 10 , n_channels= 10 , scalings= 'auto' , butterfly= False
plt.suptitle( 'Alpha-Filtered EEG Data (First 10 Channels, First 10 Seconds)
plt.tight_layout()
plt.show()
print ( " β
Plot generated! Take a look at the alpha-filtered brain waves abo
print ( " π‘ Compare this to the raw data plot to see the effect of filtering.
9/27/25, 11:40 AM assignment1_eeg_filtering.ipynb - Colab
https://colab.research.google.com/github/kylemath/NeuroimagingClass/blob/main/assignment1_eeg_filtering.ipynb#scrollTo=A5PFPYJYQyfv&printMo⦠6/11
π Plotting alpha-filtered EEG data (first 10 seconds, first 10 channels)...
π§ Examine the squiggly lines - each color is a different electrode!
β
Plot generated! Take a look at the alpha-filtered brain waves above.
π‘ Compare this to the raw data plot to see the effect of filtering.
π
## Comparing Raw vs. Filtered Data
ξ
9/27/25, 11:40 AM assignment1_eeg_filtering.ipynb - Colab
https://colab.research.google.com/github/kylemath/NeuroimagingClass/blob/main/assignment1_eeg_filtering.ipynb#scrollTo=A5PFPYJYQyfv&printMo⦠7/11
Here are plots of the raw data and the alpha-filtered data side-by-side. Scroll down to
compare them and see the effect of the filtering!
# Plot raw and filtered data side-by-side for comp arison
print ( " π Plotting raw vs. alpha-filtered data side-by-side..." )
# Define the time segment to plot (e.g., from 10 s econds to 15 seconds)
tmin, tmax = 10 , 15
picks = raw.ch_names[: 5 ] # Select a few channels to keep the plot clean
# Extract data for the specified time window and c hannels
raw_data_segment, times_segment = raw.copy().crop( tmin=tmin, tmax=tmax).pic
alpha_data_segment, _ = raw_alpha.copy().crop(tmin =tmin, tmax=tmax).pick(pi
# Create a figure with two subplots
fig, axes = plt.subplots(nrows= 2 , ncols= 1 , figsize=( 12 , 8 ), sharex= True , sh
# Plot the raw data on the first subplot
for i, pick in enumerate (picks):
# Add an offset to separate the channels visually
axes[ 0 ].plot(times_segment, raw_data_segment[i, :] + i * 5e-5 , label=pi
axes[ 0 ].set_title( 'Raw EEG Data (Comparison Segment)' )
axes[ 0 ].set_ylabel( 'Amplitude (V)' )
axes[ 0 ].legend(loc= 'upper right' )
axes[ 0 ].grid( True )
# Plot the filtered data on the second subplot
for i, pick in enumerate (picks):
# Add the same offset as the raw data for consiste nt visual comparison
axes[ 1 ].plot(times_segment, alpha_data_segment[i, :] + i * 5e-5 , label=
axes[ 1 ].set_title( 'Alpha-Filtered EEG Data (8-13 Hz Comparison Segme nt)' )
axes[ 1 ].set_xlabel( 'Time (s)' )
axes[ 1 ].set_ylabel( 'Amplitude (V)' )
axes[ 1 ].legend(loc= 'upper right' )
axes[ 1 ].grid( True )
# Adjust layout and display the plot
plt.tight_layout()
plt.show()
print ( " β
Side-by-side comparison plot generated!" )
print ( " π§ Examine the plots to see the effect of alpha filtering." )
9/27/25, 11:40 AM assignment1_eeg_filtering.ipynb - Colab
https://colab.research.google.com/github/kylemath/NeuroimagingClass/blob/main/assignment1_eeg_filtering.ipynb#scrollTo=A5PFPYJYQyfv&printMo⦠8/11
π Plotting raw vs. alpha-filtered data side-by-side...
β
Side-by-side comparison plot generated!
π§ Examine the plots to see the effect of alpha filtering.
π
## Step 6: Power Spectrum Analysis (Frequency Colors!)
ξ
9/27/25, 11:40 AM assignment1_eeg_filtering.ipynb - Colab
https://colab.research.google.com/github/kylemath/NeuroimagingClass/blob/main/assignment1_eeg_filtering.ipynb#scrollTo=A5PFPYJYQyfv&printMo⦠9/11
Now, let's create those colorful "power spectrum" plots you mentioned! This is like using an
equalizer to see which musical notes (brain wave frequencies) are loudest.
π
## What is a Power Spectrum?
It's a graph that shows how much "power" (strength) is present at each different
frequency.
Peaks in the plot indicate frequencies with strong brain wave activity.
π§
## What to Look For:
Raw Data: You'll see power across many frequencies.
Filtered Data: You should see a clear peak in the alpha range (8-13 Hz), showing the
filter worked!
Different Channels: See if some brain areas (electrodes) have stronger alpha activity
than others.
# π― STEP 6: Compute and plot the power spectrum
print ( " π Computing and plotting the power spectrum..." )
# Compute the power spectrum for the raw data
# This analyzes the strength of different frequenc ies
raw_spectrum = raw.compute_psd(picks= 'eeg' , method= 'welch' , fmin= 1 , fmax= 40
# Compute the power spectrum for the alpha-filtere d data
alpha_spectrum = raw_alpha.compute_psd(picks= 'eeg' , method= 'welch' , fmin= 1 ,
# Plot the power spectrum for the raw data
fig, axes = plt.subplots(nrows= 2 , ncols= 1 , figsize=( 10 , 8 ), sharex= True )
# Plot the power spectrum for the raw data - remov ing average=True to show
raw_spectrum.plot(axes=axes[ 0 ], amplitude= False ) # Removed average=True
axes[ 0 ].set_title( 'Power Spectrum of Raw EEG Data (Individual Channe ls)' )
# Plot the power spectrum for the alpha-filtered d ata - removing average=Tr
alpha_spectrum.plot(axes=axes[ 1 ], amplitude= False ) # Removed average=True
axes[ 1 ].set_title( 'Power Spectrum of Alpha-Filtered EEG Data (8-13 H z, Indi
axes[ 1 ].set_xlabel( 'Frequency (Hz)' )
plt.tight_layout()
plt.show()
print ( " β
Power spectrum plots with individual channels generated!" )
print ( " π§ Examine the plots to see the frequency content of the raw and fil
9/27/25, 11:40 AM assignment1_eeg_filtering.ipynb - Colab
https://colab.research.google.com/github/kylemath/NeuroimagingClass/blob/main/assignment1_eeg_filtering.ipynb#scrollTo=A5PFPYJYQyfv&printM⦠10/11
π Computing and plotting the power spectrum...
/tmp/ipython-input-2740174212.py:25: UserWarning: This figure includes Axes
plt.tight_layout()
β
Power spectrum plots with individual channels generated!
π§ Examine the plots to see the frequency content of the raw and filtered da
ξ
ξΈ ξΏ ξ‘― ξ
ξ
## format_quote
ξ ξ ο Ο ξ
9/27/25, 11:40 AM assignment1_eeg_filtering.ipynb - Colab
https://colab.research.google.com/github/kylemath/NeuroimagingClass/blob/main/assignment1_eeg_filtering.ipynb#scrollTo=A5PFPYJYQyfv&printM⦠11/11
π¨ Assignment 2: BrainImation
π PSYCH403_Assignment2BrainImation - Ella Thorsen-Bell.pdf
View Original PDF- Ella Thorsen-Bell (1803752)
- Note: Code is pasted in document after write-up section (pg 3) Application Type: Neurofeedback Training Tool Concept Explanation This visual animation illustrates planetary orbits similar to a solar-system. Each βplanetβ is represented by one EEG band (Delta, Theta, Alpha, Beta, or Gamma). The sun in the middle provides dynamic feedback through threshold-controlled pulsing and colour changing cues. When the sun begins to glow and pulse with a green hue, it represents focus within the user. In contrast, if the user gets distracted and loses focus, the sun turns a pulsing red colour. The ring around the Beta wave planet also emphasizes the focus state, providing an easy cue to visualize and better understand patterns. Each addition to this application relates to the overall space theme in order to maintain cohesiveness and create a visual polish. This application is meant to serve as an easy tool to track mental engagement, as well as help improve focus, self-awareness, and control. This tool can also be altered to track and train other brain states through small adjustments in code. Technical Implementation This application uses real-time readings of an individualβs brainwave frequencies and attention level to influence a variety of factors within the animation. More specifically it uses a combination of codes eegData.alpha, .beta, .theta, .delta, .gamma, & .attention. I used the βBand Orbitzβ template as a base for this assignment, where each EEG frequency band is represented as a planet in orbit with a specific radius and colour. The values of the data impact the size and speed of each planet. The most significant change to this template related to the overall goal of this application: the addition of neurofeedback signals. In order to achieve this, I added the yellow shape and a glow effect to the center using βfill(), ellipse() & glowSizeβ functions before
manipulating an overlaying translucent colour and pulsing pattern on top with the code. The
threshold for this tool was set to 0.7. An attention level over 0.7 is indicated by a slow pulse that
expands and contracts from the center, whereas an attention level under 0.7 is indicated by a
faster red pulse. This was added using fill(), ellipse() & stroke(). The Beta frequency band is also
highlighted through the use of a ring using noFill(), stroke (), ellipse() functions to both add to
the overall theme & bring attention to the specific brain state. I also altered the radius of each
orbit to fit better on the screen and added a starry background.
Challenges & What I Learned
One challenge I faced related to the direct understanding of how to work with certain
aspects of code. Throughout this assignment I went through a lot of trial and error, learning how
to manipulate and add to existing code, as well as work through error messages. I did a number
of searches to add a variety of features since Iβm not the most familiar with coding. Another
significant challenge was figuring out how to substantially change the code. I spent time testing
out different applications and altering smaller elements but had to learn how to build upon them
in order to create something bigger. For example, I tried to manipulate the βalpha waveβ template
into the brain art by manipulating the colour to warm/cool colours based on alpha and theta, but
it didnβt feel like enough. I also learned more about how neurofeedback training tools work,
since I had to figure out what to incorporate into my own neurofeedback application.
Code:
// Solar System Orbits - frequency bands
let angle = 0 ;
let stars = [];
function setup() {
colorMode( HSB , 360 , 100 , 100 );
// Create random stars
for ( let i = 0 ; i < 300 ; i++) {
stars.push({
x: random(-width, width),
y: random(-height, height),
size: random( 1 , 3 ),
brightness: random( 60 , 100 )
});
}
}
function draw() {
background( 240 , 50 , 5 , 0.2 );
// Draw star field
noStroke();
for ( let s of stars) {
fill( 60 , 10 , s.brightness, 0.6 );
ellipse(s.x, s.y, s.size);
}
translate(width/ 2 , height/ 2 );
//Focus threshold
let isFocused = eegData.attention > 0.7 ;
let bands = [
{ name: 'Delta' , value: eegData.delta, hue: 10 , sat: 40 , bright: 60 , radius: 50 },
{ name: 'Theta' , value: eegData.theta, hue: 30 , sat: 60 , bright: 70 , radius: 90 },
{ name: 'Alpha' , value: eegData.alpha, hue: 140 , sat: 50 , bright: 60 , radius: 130 },
{ name: 'Beta' , value: eegData.beta, hue: 200 , sat: 70 , bright: 20 , radius: 170 },
{ name: 'Gamma' , value: eegData.gamma, hue: 300 , sat: 50 , bright: 80 , radius: 210 }
];
for ( let i = 0 ; i < bands.length; i++) {
let band = bands[i];
let a = angle + (i * TWO_PI / bands.length);
let r = band.radius;
let size = 10 + band.value * 40 ;
let x = cos(a) * r;
let y = sin(a) * r;
//Add rings to Beta
fill(band.hue, 70 , 90 , 0.8 );
noStroke();
ellipse(x, y, size);
if (band.name === 'Beta' ) {
noFill();
stroke(band.hue, 50 , 100 , 0.5 );
ellipse(x, y, size * 1.5 , size * 0.7 ); // Ring
}
// Draw orbit path
noFill();
stroke(band.hue, 20 , 60 , 0.1 );
ellipse( 0 , 0 , r * 2 );
}
// Draw sun in center
fill( 50 , 80 , 100 , 1 );
ellipse( 0 , 0 , 45 );
for ( let i = 5 ; i > 0 ; i--) {
let glowSize = 15 + i * 10 ;
fill( 50 , 80 , 100 , 0.05 * i);
noStroke();
ellipse( 0 , 0 , glowSize);
}
//Neurofeedback signals
if (isFocused) {
fill( 120 , 60 , 100 , 0.2 );
ellipse( 0 , 0 , 75 + sin(frameCount * 0.1 ) * 10 );
} else {
if (!isFocused) {
fill( 0 , 80 , 100 , 0.15 );
stroke( 0 , 80 , 100 , 0.1 + 0.1 * sin(frameCount * 0.3 ));
ellipse( 0 , 0 , 80 + sin(frameCount * 0.3 ) * 6 );
}
}
angle += 0.02 * eegData.attention;
}
π₯ Video
π― Midterm Project
π ThorsenBell_ProjectSelectionParagraph - Ella Thorsen-Bell.pdf
View Original PDFElla Thorsen-Bell (1803752)
Final Project Selection (Option 1: Mini Data Analysis)
For the final project I plan to do a mini data analysis based on the following research
question: How do sensory evoked potentials (SEPs) differ between auditory and visual stimuli?
In order to respond to the question, I will compare the ERPβs for both categories (visual vs
auditory). I also plan to compare the amplitude of certain electrodes such as N1, P2, N75, &
P100 if available in the dataset(s). I will then use this to compare the peak times across channels.
If available, I may also use a topographical distribution analysis. This will allow me to look at
both the difference in timing as well as the brain regions involved. Understanding these
differences could aid in providing more precise diagnostic tools or experimental designs.
π ThorsenBell_midterm_descriptions - Ella Thorsen-Bell.pdf
View Original PDF- Ella Thorsen-Bell (1803752) Part 1: BCI Innovation: Beyond Basic Control (Option B) For this project I implemented a BCI that combines real-time EEG signals with auditory feedback to create a unique soundscape, specifically using alpha, beta, & theta frequency band oscillators. It works through a continuous feedback loop, where EEG signals are read and mapped into specific sound and visual properties. Alpha activity is translated into lower pitched sounds using sine waves, which is also represented through the animation on screen. Beta activity controls the higher pitches using square-waves and influences the speed of the animation. Theta waves are expressed through a subtle bass layer to represent deep relaxation. Reverb and delay effects were also added to enrich the soundscape. All of them are layered into one simultaneous presentation. This application could be used for a variety of purposes such as neurofeedback, brain art, or potentially even research. This application is different from basic parameter control due to the layered auditory feedback. Instead of mapping a single parameter or only expressing a single frequency band, it attempts to combine multiple frequency bands into one simultaneous auditory environment. Throughout the process I learned how to adjust different frequencies to incoming EEG signals, including how to adjust the amplitude and pitch of each frequency band. I also learned more generally how to implement sound into BCI systems, allowing me to enrich my chosen application. With more manipulations in code, this application has the potential to grow further through the addition of better visual feedback to accompany the auditory experience. Video: ThorsenBell_Midterm1_Part1Vid.webm
- Note: Video recorded using simulated data, real data may appear differently
- Sound needs to be on to work but careful of the volume (it can be loud)
- Part 2: Event-Related Potentials: Build Your Own ERP Experiment For this experiment, I focused on measuring the P300 event related potential (ERP), which is linked to cognitive processes such as attention, working memory, and decision making. The stimulus manipulation of this experiment follows an oddball paradigm using two distinct categories of stimuli: frequent and rare. Each stimulus appears at a different probability, with the frequent stimulus presenting 80% of the time and the rare stimulus appearing only 20% of the time. Both stimuli are shown in 30ms intervals with a 60ms gap. There is also a 1000ms interval between each trial. For this experiment an averaging system is used to isolate the brainβs response to a specific event, or in this case the presentation of the rare stimulus. It works by continuously recording EEG data & extracting time-locked epochs. The epochs are then averaged separately for each stimulus category to allow for independent averaging and to generate the corresponding ERP wavelengths. Based on existing literature on P300 ERP oddball experiments, I would expect to see a larger P300 response to the rare stimulus in comparison to the frequent one, due to the rare one being less predictable to the brain. A positive peak around 300ms post-stimulus onset would also be expected, since that amplitude is particularly sensitive to novelty. Video: ThorsenBell_Midterm_Part2Vid.webm
- Note: Video recorded using simulated data, real data may appear differently
π ThorsenBell_midterm_part2 - Ella Thorsen-Bell.txt
π‘ Code is embedded in this portfolio - opens instantly in the live BrainImation editor (no internet required!)
π ThorsenBell_midterm_part1 - Ella Thorsen-Bell.txt
π‘ Code is embedded in this portfolio - opens instantly in the live BrainImation editor (no internet required!)