GithubHelp home page GithubHelp logo

gabrock94 / pysiology Goto Github PK

View Code? Open in Web Editor NEW
59.0 10.0 7.0 4.27 MB

A Python package for physyological's signals processing

Home Page: https://pysiology.rtfd.io

License: GNU General Public License v3.0

Python 54.99% Jupyter Notebook 45.01%
python physiology physiological-signals signal-processing ecg ecg-signal emg emg-signal eda gsr electrophysiology electrophysiological-data

pysiology's Introduction

PySiology

GitHub release PyPI PyPI pyversions PyPI status PyPI downloads Downloads Documentation Status DOI

Introduction

PySiology is a Python package used to analyze Physiological signals. With pysiology you can easily analyze:

  • Electromyographic signals
  • Electrocardiographic signals
  • Electrodermal activity signals

Installation

PySiology can be installed using pip:

pip install pysiology

or downloading / cloning the repository and, from the root folder of the project, running:

python setup.py install

Updating the package

To update the package via pip, you can use:

pip install --user --upgrade pysiology

Documentation

You can check the full documentation here: https://pysiology.rtfd.io

WARNING

Sample data are not downloaded when using Pip. Please download the samples manually from the repository (https://github.com/Gabrock94/Pysiology/tree/master/share/data) and load them using

import pickle

with open("path/to/sample/data.pkl",'rb') as f:
          data = pickle.load(f)

Example

import matplotlib.pyplot as plt #used for visualization purposes in this tutorial.

import pysiology
print(pysiology.__version__)


ECG = pysiology.sampledata.loadsampleECG() #load the sample ECG Signal
EMG = pysiology.sampledata.loadsampleEMG() #load the sample EMG Signal
GSR = pysiology.sampledata.loadsampleEDA() #load the sample GSR Signal

sr = 1000 #samplerate in Hz

#We can define the event in the way we prefer. 
#In this example I will use a 2 x nEvent matrix, containing the name of the event and the onset time.
events = [["A",10],
          ["B",20]]
eventLenght = 8 #lenght in seconds we want to use to compute feature estimation
results = {} #we will store the results in a dict for simplicity.
for event in events:
    startSample = sr * event[1] #samplerate of the signal multiplied by the onset of the event in s
    endSample = startSample + (sr * eventLenght) #Final sample to use for estimation
    results[event[0]] = {} #initialize the results
    results[event[0]]["ECG"] = pysiology.electrocardiography.analyzeECG(ECG[startSample:endSample],sr) #analyze the ECG signal
    results[event[0]]["EMG"] = pysiology.electromyography.analyzeEMG(EMG[startSample:endSample],sr) #analyze the EMG signal
    results[event[0]]["GSR"] = pysiology.electrodermalactivity.analyzeGSR(GSR[startSample:endSample],sr) #analyze the GSR signal

Cite

If you use PySiology, please cite:

Gabrieli G., Azhari A., Esposito G. (2020) PySiology: A Python Package for Physiological Feature Extraction. In: Esposito A., Faundez-Zanuy M., Morabito F., Pasero E. (eds) Neural Approaches to Dynamics of Signal Exchanges. Smart Innovation, Systems and Technologies, vol 151. Springer, Singapore

Requirements

  • Numpy
  • Scipy
  • Peakutils
  • Matplotlib

Contacts

Feel free to contact me for questions, suggestions or to give me advice as well at: [email protected]

Scientific Publications that used pysiology

  • Jain, A., & Kumar, R. (2024, May). Machine Learning based Anxiety Detection using Physiological Signals and Context Features. In 2024 2nd International Conference on Advancement in Computation & Computer Technologies (InCACCT) (pp. 116-121). IEEE.
  • Krivich, E., Mottus, M., & Bauters, M. (2023). Comparing Psychophysiological Responses to Vicarious Pain Experience Elicited by Videos Featuring either Humans or Avatars. In Proceedings of the 26th International Academic Mindtrek Conference.
  • Wiercinski, T., & Zawadzka, T. (2023). Short Paper: Late Fusion Approach for Multimodal Emotion Recognition Based on Convolutional and Graph Neural Networks.
  • Gabrieli, G., Bornstein, M. H., Setoh, P., & Esposito, G. (2023). Machine learning estimation of users’ implicit and explicit aesthetic judgments of web-pages. Behaviour & Information Technology, 42(4), 392-402.- Hsu, S. M., Chen, S. H., &
  • Momota, M. M. R., Morshed, B. I., Ferdous, T., & Fujiwara, T. (2023). Fabrication and Characterization of Inkjet Printed Flexible Dry ECG Electrodes. IEEE Sensors Journal, 23(7), 7917-7928.
  • Warner, J., Gault, R., & McAllister, J. (2022, July). Optimised EMG pipeline for gesture classification. In 2022 44th Annual International Conference of the IEEE Engineering in Medicine & Biology Society (EMBC) (pp. 3628-3631). IEEE.
  • Momota, M. M. R., & Morshed, B. I. (2022). ML algorithms to estimate data reliability metric of ECG from inter-patient data for trustable AI-based cardiac monitors. Smart Health, 26, 100350.
  • Chan, S. H. M., Qiu, L., Esposito, G., Mai, K. P., Tam, K. P., & Cui, J. (2021). Nature in virtual reality improves mood and reduces stress: evidence from young adults and senior citizens. Virtual reality, 1-16.
  • Chan, S. H. M., Qiu, L., Esposito, G., & Mai, K. P. (2021). Vertical greenery buffers against stress: Evidence from psychophysiological responses in virtual reality. Landscape and Urban Planning, 213, 104127.
  • Huang, T. R. (2021). Personal Resilience Can Be Well Estimated from Heart Rate Variability and Paralinguistic Features during Human–Robot Conversations. Sensors, 21(17), 5844.
  • Aqajari, S. A. H., Naeini, E. K., Mehrabadi, M. A., Labbaf, S., Rahmani, A. M., & Dutt, N. (2020). Gsr analysis for stress: Development and validation of an open source tool for noisy naturalistic gsr data. arXiv preprint arXiv:2005.01834.
  • Bizzego, A., Azhari, A., Campostrini, N., Truzzi, A., Ng, L. Y., Gabrieli, G., ... & Esposito, G. (2019). Strangers, friends, and lovers show different physiological synchrony in different emotional states. Behavioral Sciences, 10(1), 11.

Coffee?

Buy Me a Coffee at ko-fi.com

pysiology's People

Contributors

codacy-badger avatar gabrock94 avatar zli353 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pysiology's Issues

GSR Analysis

  • Noise Filtering
  • Signal Decomposition --> Phasic Phase Extraction
  • Features Extraction

Add Pysiology to open-neuroscience.com

Hello!

We are reaching out because we would love to have your project listed on Open Neuroscience, and also share information about this project:

Open Neuroscience is a community run project, where we are curating and highlighting open source projects related to neurosciences!

Briefly, we have a website where short descritptions about projects are listed, with links to the projects themselves, their authors, together with images and other links.

Once a new entry is made, we make a quick check for spam, and publish it.

Once published, we make people aware of the new entry by Twitter and a Facebook group.

To add information about their project, developers only need to fill out this form

In the form, people can add subfields and tags to their entries, so that projects are filterable and searchable on the website!

The reason why we have the form system is that it makes it open for everyone to contribute to the website and allows developers themselves to describe their projects!

Also, there are so many amazing projects coming out in Neurosciences that it would be impossible for us to keep track and log them all!

Please get in touch if you have any questions or would like to collaborate!

Documentation

Documentation should cover

  • Usage of different functions
  • Tutorial with sample data loading and processing
  • Literature used

Future Functions

Generic:

  • Automatic detection of bad signal

EDA/GSR:

  • Add function for separating phasic and tonic component (and keep both)

EMG

  • V V-order
    "An optimal value for v has been reported to be 2, which leads to the definition of RMS feature."
    Phinyomark, A., Phukpattaranont, P., & Limsakul, C. (2012). Feature reduction and selection for EMG signal classification. Expert Systems with Applications, 39(8), 7420-7431.
  • MHWk Multiple hamming windows
  • MTVk Multiple Trapezoidal Windows
  • Auto Regressive Coefficient
  • Cepstral Coefficient

EMG Analysis

Phinyomark, A., Phukpattaranont, P., & Limsakul, C. (2012). Feature reduction and selection for EMG signal classification. Expert Systems with Applications, 39(8), 7420-7431.

Pre Processing

  • Highpass Filter
  • LowPass Filter

Time Domain Features

  • IEMG Integrated EMG
  • MAV Mean absolute value
  • MAV1 Modified Mean Absolute Value 1
  • MAV2 Modified Mean Absolute Value 2
  • SSI Simple Square Integral
  • VAR Variance of EMG
  • TM3 Absolute of the 3rd Temporal Moment
  • TM4 Absolute of the 4rd Temporal Moment
  • TM5 Absolute of the 5rd Temporal Moment
  • RMS Root Mean Square
  • LOG Log Detector
  • WL Waveform Lenght
  • AAC Average Amplitude Change
  • DASDV Difference absolute standard deviation value
  • AFB Amplitude at First Burst
  • ZC Zero Crosstime
  • MYOP Myopulse Percentage Rate
  • WAMP Wilson Amplitude
  • SSC Slope Sign Change
  • MAVSLPk Mean absolute value slope
  • Histogram of EMG

Frequency Domain Features

  • MNF Mean Frequency
  • MDF Median Frequency
  • PKF Peak frequency
  • MNP Mean Power
  • TTP Total Power
  • SM1 1st Spectral Moment
  • SM2 2nd Spectral Moment
  • SM3 3rd Spectral Moment
  • FR Frequency Ratio
  • PSR Power Spectrum Ratio
  • VCF Variance of Central Frequency

Validation

  • Check some example data with other packages / software.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.