Skip to main content
Log in

Power spectrum and spectrogram of EEG analysis during general anesthesia: Python-based computer programming analysis

  • Review Paper
  • Published:
Journal of Clinical Monitoring and Computing Aims and scope Submit manuscript

This article has been updated

Abstract

The commonly used principle for measuring the depth of anesthesia involves changes in the frequency components of the electroencephalogram (EEG) under general anesthesia. Therefore, it is essential to construct an effective spectrum and spectrogram to analyze the relationship between the depth of anesthesia and the EEG frequency during general anesthesia. This paper reviews the computer programming techniques for analyzing the spectrum and spectrogram derived from a single-channel EEG recorded during general anesthesia. A periodogram is obtained by repeating a Fourier transform on EEG segments separated by short time intervals, but spectral leakage (i.e., dissociation from the true spectrum) occurs as a consequence of unnatural segmentation and noise. While offsetting the securing of the dynamic range, practical analyses of the adaptation of the window function are explained. Finally, the multitaper method, which can suppress artifacts caused by the edges of the analysis segments, suppress noise, and probabilistically infer values that are close to the real power spectral density, is explained using practical examples of the analysis. All analyses were performed and all graphs plotted using Python under Jupyter Notebook. The analyses demonstrated the effectiveness of Python-based programming under the integrated development environment Jupyter Notebook for constructing an effective spectrum and spectrogram for analyzing the relationship between the depth of anesthesia and EEG frequency analysis in general anesthesia.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8

Similar content being viewed by others

Data availability

The sample data and programming code using the analysis in this paper are available as supplementary data.

Code availability

The supplementary archive file (spectral_analysis.zip) contains all the Python programming code files (.ipynb files of Jupyter Notebook, and the PDF print files) for the EEG analyses described in this paper: (1) EDF2rawEEG.pdf: Python code that transforms the EEG in EDF format to microvolt data. (2) eeg_bis_10_20_2.tsv: Sample EEG data used in the following spectral analyses. (3) spectral_analysis_1.pdf and spectral_analysis_1.ipynb: Python code for the spectral analysis of the EEG data using sine and cosine waves, and the ARIMA model. (4) spectral_analysis_2_deep_anesth.pdf and spectral_analysis_2_deep_anesth.ipynb: Python code for the spectral analysis of the EEG data at the phase of deep general anesthesia. (5) spectral_analysis_3_before_emeregence.pdf and spectral_analysis_3_before_emeregence.ipynb: Python code for the spectral analysis of the EEG data at the phase before emergence from general anesthesia. (6) spectral_analysis_4_emergence.pdf and spectral_analysis_4_emergence.ipynb: Python code for the spectral analysis of EEG data at the phase of emergence from general anesthesia.

Change history

  • 24 December 2021

    Supplementary file has been included to the article.

References

  1. Fernández-Candil JL, Terradas SP, Barriuso EV, García LM, Cogollo MG, Gallego LG. Predicting unconsciousness after propofol administration: qCON, BIS, and ALPHA band frequency power. J Clin Monit Comput. 2021;35:723–9. https://doi.org/10.1007/s10877-020-00528-5.

    Article  PubMed  Google Scholar 

  2. Martín-Mateos I, Méndez Pérez JA, Reboso Morales JA, Gómez-González JF. Adaptive pharmacokinetic and pharmacodynamic modelling to predict propofol effect using BIS-guided anesthesia. Comput Biol Med. 2016;75:173–80. https://doi.org/10.1016/j.compbiomed.2016.06.007.

    Article  CAS  PubMed  Google Scholar 

  3. Alfonso-Pérez G, Méndez-Pérez JA, Torres-Álvarez ST, Morales JAR, Fragoso AML. Modelling the PSI response in general anesthesia. J Clin Monit Comput. 2010. https://doi.org/10.1007/s10877-020-00558-z.

    Article  Google Scholar 

  4. Ching S, Cimenser A, Purdon PL, Brown EN, Kopell NJ. Thalamocortical model for a propofol-induced alpha-rhythm associated with loss of consciousness. Proc Natl Acad Sci USA. 2010;107:22665–70. https://doi.org/10.1073/pnas.1017069108.

    Article  PubMed  PubMed Central  Google Scholar 

  5. Supp GG, Siegel M, Hipp JF, Engel AK. Cortical hypersynchrony predicts breakdown of sensory processing during loss of consciousness. Curr Biol. 2011;21:1988–93. https://doi.org/10.1016/j.cub.2011.10.017.

    Article  CAS  PubMed  Google Scholar 

  6. Flores FJ, Hartnack KE, Fath AB, Kim SE, Wilson M, Brown EN, Purdon PL. Thalamocortical synchronization during induction and emergence from propofol-induced unconsciousness. Proc Natl Acad Sci USA. 2017;114:E6660–8. https://doi.org/10.1073/pnas.1700148114.

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  7. Purdon PL, Sampson A, Pavone KJ, Brown EN. Clinical electroencephalography for anesthesiologists: part I: background and basic signatures. Anesthesiology. 2015;123:937–60. https://doi.org/10.1097/ALN.0000000000000841.

    Article  CAS  PubMed  Google Scholar 

  8. Sawa T. EEG Analyszer. ver 54_GP. Science to Medicine. http://anesth-kpum.org/blog_ts/?p=3169 (2020). Accessed 6 Nov 2020.

  9. Hayase K, Kainuma A, Akiyama K, Kinoshita M, Shibasaki M, Sawa T. Poincaré plot area of gamma-Band EEG as a measure of emergence from inhalation general anesthesia. Front Physiol. 2021;12: 627088. https://doi.org/10.3389/fphys.2021.627088.

    Article  PubMed  PubMed Central  Google Scholar 

  10. Fourier transform. Wikipedia. https://en.wikipedia.org/wiki/Fourier_transform (2021). Accessed 29 Sept 2021.

  11. Discrete Fourier Transform (numpy.fft). NumPy. NumPy v1.21 Manual. The NumPy community. https://numpy.org/doc/stable/reference/routines.fft.html (2021). Accessed 29 Sept 2021.

  12. Kemp B, Värri A, Rosa AC, Nielsen KD, Gade J. A simple format for exchange of digitized polygraphic recordings. Electroencephalogr Clin Neurophysiol. 1992;82:391–3. https://doi.org/10.1016/0013-4694(92)90009-7.

    Article  CAS  PubMed  Google Scholar 

  13. Kemp B, Olivan J. European data format “plus” (EDF+), an EDF alike standard format for the exchange of physiological data. Clin Neurophysiol. 2003;114:1755–61. https://doi.org/10.1016/s1388-2457(03)00123-8.

    Article  PubMed  Google Scholar 

  14. von Dincklage F, Jurth C, Schneider G, Garcia PS, Kreuzer M. Technical considerations when using the EEG export of the SEDLine Root device. J Clin Monit Comput. 2020. https://doi.org/10.1007/s10877-020-00578-9.

    Article  Google Scholar 

  15. Thomson DJ. Spectrum estimation and harmonic analysis. Proc IEEE. 1982;70:1055–96. https://doi.org/10.1109/PROC.1982.12433.

    Article  Google Scholar 

  16. Babadi B, Brown EN. A review of multitaper spectral analysis. IEEE Trans Biomed Eng. 2014;61:1555–64. https://doi.org/10.1109/TBME.2014.2311996.

    Article  PubMed  Google Scholar 

  17. Kim S-E, Behr MK, Ba D, Brown EN. State-space multitaper time-frequency analysis. Proc Natl Acad Sci. 2018;115:E5–14. https://doi.org/10.1073/pnas.1702877115.

    Article  CAS  PubMed  Google Scholar 

  18. Slepian D. Prolate spheroidal wave functions, fourier analysis, and uncertainty - V: the discrete case. Bell Syst Techn J. 1978;57:1371–430. https://doi.org/10.1002/j.1538-7305.1978.tb02104.x.

    Article  Google Scholar 

  19. Reassignment method. Wikipedia. https://en.wikipedia.org/wiki/Reassignment_method Accessed 6 Nov 2020.

  20. Meliza D. libtfr. fast multitaper conventional and reassignment spectrograms. https://github.com/melizalab/libtfr (2021). Accessed 17 Mar 2021.

Download references

Acknowledgements

We thank Edanz (https://jp.edanz.com/ac) for editing a draft of this manuscript.

Funding

We do not have any financial or other interest in any product mentioned in this manuscript.

Author information

Authors and Affiliations

Authors

Contributions

TS conducted the study, data collection, data analysis, and manuscript preparation. TY and YO helped revise the manuscript. All authors gave final approval of the submitted manuscript.

Corresponding author

Correspondence to Teiji Sawa.

Ethics declarations

Conflict of interest

The authors declare that they have no conflict of interest.

Ethical approval

The EEG data used as examples for spectral analyses in this review were obtained from an anesthetized patient under ethical approval (No. ERB-C-1074-2) by the Institutional Review Board for Human Experiments at the Kyoto Prefectural University of Medicine (IRB of KPUM).

Informed consent

For this non-interventional and noninvasive retrospective observational study, informed patient consent was waived by the IRB of KPUM; patients were provided with an opt-out option, of which they were notified in the preoperative anesthesia clinic.

Research involving human and animal rights

The EEG data used as an example for the data analysis in this review were approved and the requirement for written informed consent was waived by the institutional review board of KPUM.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Supplementary Information

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Sawa, T., Yamada, T. & Obata, Y. Power spectrum and spectrogram of EEG analysis during general anesthesia: Python-based computer programming analysis. J Clin Monit Comput 36, 609–621 (2022). https://doi.org/10.1007/s10877-021-00771-4

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10877-021-00771-4

Keywords

Navigation