Meditation and effects on the Brain

Published: 7 June 2024| Version 1 | DOI: 10.17632/hkpw54csyg.1
Contributor:
Sunil Maria Benedict

Description

Description of the Brain Activity Simulation and Visualization Script This Python script simulates time series data to study the impact of meditation on various neurological metrics such as brain wave coherence, prefrontal cortex activation, and stress levels. The simulation and visualization are carried out using the numpy library for data generation and matplotlib.pyplot for plotting the results. Simulated Data Generation Time Series Generation: The script creates a time array representing a 10-second period divided into 500 equally spaced points. This array serves as the time axis for the simulated data. Brain Wave Coherence: Pre-Meditation (first 2 seconds): Brain wave coherence is generated using a normal distribution centered around a mean value, simulating a baseline level of brain activity before meditation. During Meditation (next 6 seconds): The coherence data is modeled as a sine wave with added random noise to represent periodic fluctuations in brain activity during meditation. Post-Meditation (last 2 seconds): Similar to the pre-meditation phase, coherence data is generated using a normal distribution to reflect the return to baseline activity. Prefrontal Cortex Activation: Pre-Meditation: Activation levels are simulated using a normal distribution to establish baseline activity. During Meditation: Activation data follows a sine wave pattern, indicating changes in prefrontal cortex activity during meditation, with added noise for realism. Post-Meditation: Similar to the pre-meditation phase, the activation data returns to baseline levels. Stress Levels: Pre-Meditation: Stress levels are generated using a normal distribution to reflect baseline stress. During Meditation: Stress levels are modeled as a negative sine wave to indicate stress reduction during meditation, with random noise added. Post-Meditation: Stress levels return to baseline, similar to the pre-meditation phase. Visualization The script plots the three metrics (brain wave coherence, prefrontal cortex activation, and stress levels) in a single figure with three vertically aligned subplots. Each subplot shares the same time axis for consistency and ease of comparison. Brain Wave Coherence Plot: Displays the coherence data over time, with vertical lines indicating the start and end of the meditation period. The plot includes labels, titles, and a legend to identify the different phases of the experiment. Prefrontal Cortex Activation Plot: Shows the activation levels of the prefrontal cortex, with similar annotations to mark the meditation period. This plot helps visualize changes in brain activity associated with meditation. Stress Levels Plot: Illustrates the variations in stress levels over time, highlighting the reduction in stress during meditation. Annotations and labels provide clarity on the different phases.

Files

Steps to reproduce

import numpy as np import matplotlib.pyplot as plt # Simulate time series data for brain activity time = np.linspace(0, 10, 500) # 10 seconds, 500 data points # Simulate brain wave coherence data coherence_pre = 0.5 + 0.1 * np.random.randn(100) coherence_during = 0.5 + 0.3 * np.sin(np.linspace(0, 2 * np.pi, 300)) + 0.1 * np.random.randn(300) coherence_post = 0.5 + 0.1 * np.random.randn(100) coherence = np.concatenate((coherence_pre, coherence_during, coherence_post)) # Simulate prefrontal cortex activation data pfc_pre = 0.5 + 0.1 * np.random.randn(100) pfc_during = 0.5 + 0.2 * np.sin(np.linspace(0, 2 * np.pi, 300)) + 0.1 * np.random.randn(300) pfc_post = 0.5 + 0.1 * np.random.randn(100) pfc_activation = np.concatenate((pfc_pre, pfc_during, pfc_post)) # Simulate stress level data stress_pre = 0.5 + 0.1 * np.random.randn(100) stress_during = 0.5 - 0.2 * np.sin(np.linspace(0, 2 * np.pi, 300)) + 0.1 * np.random.randn(300) stress_post = 0.5 + 0.1 * np.random.randn(100) stress_levels = np.concatenate((stress_pre, stress_during, stress_post)) # Plot the data fig, axs = plt.subplots(3, 1, figsize=(12, 8), sharex=True) axs[0].plot(time, coherence, label='Brain Wave Coherence', color='blue') axs[0].axvline(x=2, color='gray', linestyle='--', label='Meditation Start') axs[0].axvline(x=8, color='gray', linestyle='--', label='Meditation End') axs[0].set_ylabel('Coherence') axs[0].set_title('Neuronal Synchronization During Meditation') axs[0].legend() axs[1].plot(time, pfc_activation, label='Prefrontal Cortex Activation', color='green') axs[1].axvline(x=2, color='gray', linestyle='--', label='Meditation Start') axs[1].axvline(x=8, color='gray', linestyle='--', label='Meditation End') axs[1].set_ylabel('Activation') axs[1].set_title('Prefrontal Cortex Activation During Meditation') axs[1].legend() axs[2].plot(time, stress_levels, label='Stress Levels', color='red') axs[2].axvline(x=2, color='gray', linestyle='--', label='Meditation Start') axs[2].axvline(x=8, color='gray', linestyle='--', label='Meditation End') axs[2].set_ylabel('Stress Levels') axs[2].set_title('Stress Reduction During Meditation') axs[2].set_xlabel('Time (seconds)') axs[2].legend() plt.tight_layout() plt.show()

Institutions

Independent

Categories

Meditation, Catholicism, Prayer Therapy, Habits of Mind

Licence