To investigate the physiology of meditation, I developed programs to help extract information from the recordings of respiration, heart rhythms and brainwaves and to display data in tables, charts and graphs. The first was a Cardiorespiratory Viewer program that I wrote as part of my final project in an online neuroscience course. More recently, I have been developing a Physiology Viewer program that supports EEG recordings from the Muse Headband while maintaining some of the functionality of the Cardiorespiratory Viewer.
Note: Source Code Availability
Source code for the Physiology Viewer and associated accessory programs are now available at,
The Respiratory Viewer opens a text file of data collected by the Vernier ECG sensor and Respiration Monitor and displays graphs of heart and breath rhythms. The top graph shows the heart signal in millivolts. The lower graph shows the pressure readings of the respiration monitor in kilopascals. The program makes use of an algorithm for finding spikes (the R-wave in the ECG signal and the maximum pressure in the breath signal) and plots these as red and blue tick marks respectively above the graphs. Sliders below the graphs are used to select a time interval of interest and sliders to the right are used to select threshold values for voltage and pressure levels. The threshold levels should be set to capture each cycle once and only once.
Using the icons in the lower left hand corner, the user can zoom in to different parts of the graph for a closer look. See, for example the posting “Heartbeat and respiration during meditation.”
Clicking on the Compute Rates results in a display of heart rate (beats per minute) and breathing rate (breaths per minute). See, for example “Respiration and heart rate during meditation and reading.”
Cardiorespiratory Viewer Version 2
With a few small changes, the Cardiorespiratory Viewer gained new functionality: the ability to display an average waveform for a selected range of cycles in heart heart or breath rhythms. Version 2 of the program was equipped with two additional buttons, v-wave and p-wave.
After selected a time interval over which to average, clicking on these buttons produces the following result:
In the research literature on Zen meditation, there are papers reporting increased heart rate variability (HRV) among meditators. I am considering adding functionality to the Viewer program to include estimates of HRV (an indication of how much the time varies from one heartbeat to the next).
[Note: The Physiology Viewer has been upgraded to version 2.0. See Introducing Physiology Viewer 2.0]
The Physiology Viewer opens data files corresponding to each recorded session (data from the Muse Headband, or from the Vernier the respiration monitor or ECG sensor). It also opens an Excel spreadsheet containing additional information about each session: date and time, subject name, recording name and description, etc. The spreadsheet also has columns that can represent named time intervals within the session corresponding to different segments, such as “counting breath,” “mind wandering,” “thinking about tools” or other arbitrary conditions. The Viewer can save these segments and display corresponding graphs for each.
The Graphs Request tab is used to select a graph type and a time segment within the session to view. Initially there would not be any segments specified other than “entire session.”
Other graphs and charts can be selected by entering other commands. The following chart, called a radar chart shows relative power values of delta, theta, alpha, beta and gamma bands at each of the four sensors left back, left front, right front and right back.
A radar chart is a polar graph in which the radial distance from the center corresponds to the dependent variable (here, relative band power) and the angle around the circle to the independent variable (here, the sensor positions lb, lf, rf and rb). Roughly, these positions correspond to the sites on the scalp (TP9, FP1, FP2, TP10) used in the 1020 system (looking down on the head, nose at the top). The Muse has a reference electrode located in the center of the forehead, directly between FP1 and FP1.
The data displayed in the radar chart above shows values for five different bandwidths measured at four different sensor locations (lb, lf, rf, rb) relative to the reference electrode. The same date could also be displayed in a simple bar graph, as below.
However, the radar chart has the advantage over the bar graph of showing the general area of the head at which the sensors were located.
Other display options include spectrograms, raw EEG time series and tables of values.
The last option is useful for specialized applications such as when copying and pasting into an Excel spreadsheet.
Next page: Breath and Heart